How I can change the speed of a song or sound?

I'm trying to change the speed of the audio but I could not find a way to do it.

Could someone please help me.

I know this question is old, but this thread appears near the top of most Google results about music speed, and times have changed over the last 8 years. I did find a solution, but it requires learning Audio Mixers. It’s not perfect; you’ll hear imperfections in the sped up audio, but it’s better than constantly setting AudioSource.time or creating your own audio buffers.

Press Ctrl+8 to open the Audio Mixer tab (or find it in the Window menu at the top), then add a mixer. I put my mixer in the Resources folder so I can fetch it with var pitchBendGroup = Resources.Load("Pitch Bend Mixer"); audioSource.outputAudioMixerGroup = pitchBendGroup;.
Once you made one, add the Pitch Shifter effect to the Master slider. You should see this in your Inspector (not the Audio Mixer tab):
126921-pitchbendmaster.png
The bottom slider that says Pitch is the one you want. If you right click the word “Pitch” you can expose it in your mixer so you can change the value by code (that makes the arrow appear next to it). So if you want to keep the song pitch the same but speed up the tempo by 50%, you do:
audioSource.pitch = 1.5f; pitchBendGroup.audioMixer.SetFloat("pitchBend", 1f / 1.5f);
It seems pretty lightweight on DSP CPU, so I don’t think there’s a need to create your own audio buffers or crazy stuff like that, just use a mixer. If you want to save CPU while the tempo is at 100%, set outputAudioMixerGroup to null. Also I recommend lowering the volume by 3 dB because that tends to be how much louder it gets with 4.00 overlap.

EDIT: I realized there is an extra step for newer versions. Once you make the arrow appear next to Pitch you have to go back to Audio Mixer and open up Exposed Parameters at the top-right of the panel. It’s recommended to right-click and rename the ‘MyExposedParam’ entry (I named it ‘pitchBend’).

Unity can only change the speed of an AudioSource. It calls this parameter "Pitch". However, changing it will always change both pitch and tempo, since this is just a matterl of changin the playback sampling rate and can be done in realtime at almost no cost and with (almost) no sound distortion.

Unity cannot change just the pitch (and keep the tempo constant) or just the tempo (and keep the pitch constant). What you are looking for is the latter.

Up until recently I would have answered this is a very expensive process since you actually need to resample your audio clip by splitting it into very short segments and then overlap or copy&extend them, so you would have a hard time doing this in realtime during your game.

However, as the videoplayer vlc has shown in recent versions (>=1.0 I think), there is an algorithm that can be evaluated in realtime to do just that (When increasing/decreasing the video playback speed in vlc, the audio can still be heard, with matching speed, astonishingly few distortions, and most importantly unchanged and constant pitch.) So I'd suggest to put it on the Unity wish list.

EDIT: If you are not interested in dynamically changing the tempo, but instead just change it once and then keep that new tempo, I'd suggest to use some audio software to modify your audio sample. ("Audacity" is a frelly available tool to do that and other stuff)

You can use an audio editor such as Audacity here to edit the sound file and change it's speed: http://audacity.sourceforge.net

The AudioSource Pitch handles the speed of playback. Value of 1 is normal playback.

Hey guys

I have an FBX animation that was animated to a specific audio file… this was done at 30FPS in 3ds max. After importing to unity and plying the audio along with the animation it is some what off… is there a workflow to fix this?

Many Thanks