Sound Recording

Hello all,
Is there a way to record a ofSoundStream to be able to play it a moment after ?
Thank you :slight_smile:

Yes, you can store the incoming sample data in a very large buffer (an array or vector or whatever container you want). Then whenever you want to play it pass it to the ofSoundStream output callback. You will need to keep track of the playback head as the output callback will only play a certain chunk of samples each time the callback is called. Keep passing it data until your buffer is empty.

Thank you for the answer, grimus.
However, I don’t see what you mean by the output callback of ofSoundStream.

I achieved to record video: Each frame is stored in a buffer, and then drawed thanks to ofImage.

I see how to store audio in a vector of float*[256], but how to play it after ? ofSoundPlayer is only able to play audio files.

by the ofSoundStream output callback grimus means implementing audioRequested() in your test app, just as you’ve implemented audioReceived() (as your input callback). Do you want to record sounds to play them back at some arbitary time or a fixed time?

basically you want to save your sound into an array of floats in audioReceived() and then output them in audioRequested(). The tricky bit is managing the array.