Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Temophor

Pages: [1]
1
Audio / Re: how to cut the end of a sound?
« on: May 07, 2015, 11:12:38 pm »
Nevermind, I just solved it myself:

buffer.getSamples() + cut determines the starting position of the new buffer. So of course I just want buffer.getSamples() here to start from the beginning (and not cut the beginning.
buffer.getSampleCount() - cut is the number of remaining samples. If I didn't cut in the beginning by not adding cut to the starting point, it will cut the audio at the end, just like intented.

cheers,
Temophor

2
Audio / how to cut the end of a sound?
« on: May 07, 2015, 11:07:20 pm »
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

Pages: [1]
anything