I’m a newbie to fmod doing a quick job for someone.
How can I reverse a sound? If I’ve loaded it from disk (createSound), I can play it and I can set the speed, but only > 0. How do I play it backwards?
(And no I’m not investigating the last tracks on Black Sabbath records…).
- IainDowns asked 4 years ago
Unfortunately, no FMOD product is capable of playing an audio file backwards. If you want to give the impression of a track running backwards in a game, the easiest option is to cheat and play a file that [i:19hwgjaa]sounds[/i:19hwgjaa] like it’s being rewinded – possibly even using a backwards version of the audio file prepared using another DAW.
EDIT: I was wrong. As explained below, it is entirely possible to play a sound backwards.
In a post I found elsewhere ([url:60npw87r]http://gmc.yoyogames.com/index.php?showtopic=333705&st=260&p=3146454&#entry3146454[/url:60npw87r]), I read that if you called FMODGroupSetPitch() with pitch -1, the sound would play backwards. Clearly this is from an earlier version of the library (non object oriented).
Would this have worked? Would it work now? or do I have to look elsewhere?
Further to this topic, I note that the help file says of software that it supports Reverse sample playback.
I’ve tried the following:-
result = system.createSound("../../../../../examples/media/wave.mp3", FMOD.MODE.SOFTWARE | FMOD.MODE.CREATESAMPLE, ref sound1);
result = sound1.setMode(FMOD.MODE.LOOP_OFF);
result = system.createChannelGroup("Group A", ref groupA);
result = system.playSound(FMOD.CHANNELINDEX.FREE, sound1, false, ref channel);
result = channel.setChannelGroup(groupA);
And then later
FMOD.RESULT result = groupA.setPitch(<pitch>);
This code works fine until the pitch is set below zero. At this point, the sample ceases to play.
Can you clarify how to get reverse sample playback as per the help file?
You can in fact play an FMOD sound in reverse, to do this set the frequency (Channel::setFrequency) to be negative.
So if the current frequency is 48000Hz, set it to -48000 for normal speed reverse playback. Keep in mind that this feature is limited to non-streaming FMOD::Sound objects loaded as FMOD_SOFTWARE.
Please login first to submit.