hey guys!
I'm recording a sound, unfortunately it puts like 0.5 seconds of non-recorded silence at the end of the recording.
I want the recording to loop seamlessly.
I found this code which cuts the sound from the beginning:
sf::SoundBuffer withoutSilence;
const std::size_t cut = buffer.getSampleRate() * buffer.getChannelCount() * 0.5f;;
withoutSilence.loadFromSamples(buffer.getSamples() + cut, buffer.getSampleCount() - cut, buffer.getChannelCount(), buffer.getSampleRate());
I then feed the new buffer appropriately to create, play and loop the sound.
I don't quite understand the loadFromSamples function. It successfully cuts the sound, but from the beginning instead from the end.
Any ideas?
Thank you
Temophor