I have my app recording from the mic on iPhone. The user can record a max of 30 seconds of audio, which i have set in the "sound exit info". But, if the user only records, say 10 seconds of audio and presses the "stop recording" button, the sound is still really 30 seconds.
I have tried setting the exit info length to zero, but i receive this error: "FMOD error! (37) An invalid parameter was passed to this function." I am recording to the disk, like in the recordtodisk example.
Is there a way to record a sound without a specified length? Alternatively, is there a way to crop/trim a sound to a specified time range after recording? Thanks in advance.
- zeek asked 7 years ago
When you specify the size of the FMOD::Sound via FMOD_CREATESOUNDEXINFO you are telling FMOD how much memory to allocate. So if it’s 30 seconds, then a buffer with 30 seconds of silence is allocated. If you don’t fill the entire buffer during your recording you will have silence at the end, as you have noticed. If you wanted to crop the sound you can access the data via Sound::lock, at this point you could save the data to disk (if you wish), do processing on the bits or even copy it to a smaller FMOD::Sound object.
Please login first to submit.