0
0

I need to play a streaming sound backward in my app so I’m looking for a bit of help here. I cannot use negative frequence because I have HUGE files to play and to change their playback frequency during playback.

I have figured out that i can "load" a stream into a buffer using the Sound::readData function. This buffer is than filled with PCM music data.

To somehow create a reverse play effect i want now to copy the samples out of the buffer into a second buffer in reverse order.

My question is now:
how are the samples encoded in the PCM buffer I get from readData function?

I guess they are some bitlenght representing the sample rate of the file but it’s just a guess ๐Ÿ˜‰

so any help would be apreciated

  • You must to post comments
0
0

There are a few things you can do depending on exactly what you are trying to do and the format of the files you are using.

If you just want to play the whole file in reverse, the easiest thing to do would be to create a separate file where the data is already reversed.

Another option to play the file in reverse would be to replace FMOD’s file functions with System::setFileSystem. If you do this, you will have to reverse the data sections of the file while leaving the header intact. You also have to properly reverse the sound data sample by sample and still have valid data. This is easy with PCM data, slight more complicated with other formats.

If the effect you are trying to create is more dynamic, namely playing foreward for a while and then reversing for a few seconds then going foreward again, then you should be able use Sound::readData or the pcmreadcallback to maintain a buffer of the last X seconds of sound. You should be able to create a memory sound using this data when you need to reverse the stream.

  • You must to post comments
0
0

[quote="jcole":3t8bst5m]
If the effect you are trying to create is more dynamic, namely playing foreward for a while and then reversing for a few seconds then going foreward again, then you should be able use Sound::readData or the pcmreadcallback to maintain a buffer of the last X seconds of sound. You should be able to create a memory sound using this data when you need to reverse the stream.[/quote:3t8bst5m]

yes, This is what I’m trying to build ๐Ÿ˜‰

I wan’t to be able to reverse the play "direction" at any time during playback so i need to write my own streaming function wich is capable of buffering data from any side of the stream. This sould be possible with a bit of work and a big buffer. My real concern is the reversing of the sample order because i fist of all have to identify a single sample.
As I understod it the readData function already decodes the music format so I don’t have to take care of that and stiff have the freedom of format coice.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.