hendriks73 / ffsampledsp

FFmpeg based service provider for javax.sound.sampled.
GNU Lesser General Public License v2.1
24 stars 5 forks source link

Can I do silence trimming with ffsampledsp? #4

Closed ovninosa closed 3 years ago

ovninosa commented 7 years ago

Hello,

I want to remove silence from beginning and end of a wav just with a threshold.

Can I do this with this library?

THanks Jave

hendriks73 commented 7 years ago

You don't need this library for that. Just use the standard APIs.

ovninosa commented 7 years ago

@hendriks73 I googled for about 2 hours and I cannot find any sample to do it with the standard API.

Do you have any good resource to use as example?

Thanks Jave

hendriks73 commented 7 years ago

You need to decode the WAV to PCM. Then take chunks of samples and average their absolute values. Those averages can be seen as approximations of loudness, which can help you to detect relative "silence".

To get started with Java and audio, you need to learn the javax.sound.sampled API. For starting points, see https://stackoverflow.com/tags/javasound/info