libetl/soundtransform

Remove silence after PitchSoundTransform

alla2040 opened this issue · 1 comments

Thank you for your lib! Could you please help me with one question:
I am changing the pitch of the sound with this code (I run this on Android device):
FluentClient.start() .withFile(destinationFile) .convertIntoSound() .apply(new PitchSoundTransform(100 + soundPitch)) // soundPitch - is my rate .exportToFile(destinationFile);

And after that I use ExoPlayer to play audio file. On audio finishes I stop the video. But after PitchSoundTransform the size of the file stays the same, so the video is playing but the audio (music) is stopped. I tried to fix this with stopWithSound():

FluentClientReady fluentClient = FluentClient.start(); Sound sound = fluentClient.withFile(destinationFile).convertIntoSound() .apply(new PitchSoundTransform(100 + soundPitch)).stopWithSound(); fluentClient.withSound(sound).exportToFile(destinationFile);

but it didn't help.
Can you please advise how to fix it?

Hmmm... So the sound duration stays the same even after pitching ?

Try to add a loop sound transform after your pitch transform.

FluentClient.start() .withFile(destinationFile) .convertIntoSound()
 .apply(new PitchSoundTransform(100 + soundPitch))
 .apply(new LoopSoundTransform(
    voiceSound.getSamplesLength() * (100 - soundPitch) / 100.0))
 .exportToFile(destinationFile);