Play audio in reverse (needed to "scratch")

Hi all

I’m trying to play an .mp3 backwards (not just sent back audio back and play it straight).

What I’m currently trying to do is:

First I start playing the audioSource.
Then I set the audioSource.pitch to >0 and it speeds up.
Then I set the audioSource.pitch to <=0 and nothing happens ever.

Reading on forum its a know-never solved issue.

A solution could be having 2 samples of the same audio source playing at the same time.
When a scratching back is needed the first sample volume turns to 0 and the second one (after some time calculations) get to 1.

Any ideas?Plugins that do this?

I want to realize a “scratching” effect.

Scratching is like playing audio backwards right? I think this would be best done with two audioclips, one that has the audio normally, the other one has it backwards.

AudioClip has Get/SetData that you can use to reverse the audio; first get the data, then invert the array and Set it to a new audioclip. When you need to scratch, you need to calculate the new playing position for the other clip ( clip.length-current
Position) and start playing from the other clip at that position.

I suppose this can be done with just one audioclip, but is more computationally expensive, as you’d need to invert the audioclip twice every time you want to scratch.

Here is what I have so far kinda working:

float val = 1;
float Val{
		return val;
		val = value;
		audio.pitch = val;
void Start(){
	audio.loop =true;
void Update(){
		Val = 1;
void OnGUI(){
	Val = GUI.HorizontalSlider(new Rect (100,100,100,100),Val,-1,2);

It is not perfect but could be a base for you. Note that using an mp3 would not reverse it but using a wav worked fine.

Hi 1911_Dev,

No problem changing playback speed as the clip is playing. Just make sure your file is in an uncompressed format ( wav ), and that in import settings it’s set to load into memory.

You can then tweak playback speed as if you were scratching : invert, slow down, speed up, all in real time. If the clip is set to loop, it will loop both ways.

The question is how reactive is 60 fps, and how close to real scratching can you get this way? I’d say pretty close.

Jamora’s suggestion is, sorry Jamora, inappopriate : inverting an array is pretty easy, resampling it to alter playback speed is not. And FMOD ( Unity’s audio backend ) does it for you already, via precisely the pitch field.

Anyways, you’re on the right track, what you need is a proper controller for this pitch parameter, and an uncompressed, load into memory, looped sample.