Play audio file in reverse

Hi,

I was wondering if there is an easy way of playing audio files in reverse? I’ve search everywhere on the forum and couldn’t find any clear answers or examples. Feels like this should be an easy thing to do. I’m currently playing audio file using the juce::AudioTransportSource. I wish there was a function in there that just reverse the audio for you. That would be super helpful!

If anyone has any suggestions or example of this, it would be a great help!

If you’ve got a shortish file just load it all into RAM and call the reverse function on AudioBuffer. If it’s long you’ll need to do something fancy I guess…

I’m dealing with large audio files like 20mins long. It would be really nice if there’s just a way to read the whole file backwards from disk.

I think writing a ReverseAudioFormatReaderSource should be fairly trivial, since the AudioFormatReader allows random access to the positions in the file.
Performancewise compressed formats might be not so nice, because they might need to decode packets and discard parts of it afterwards, but I would deal with that once it becomes a problem, which I doubt.