1

Trying to detect silence at the end of audio in mp3 format, well all formats would be useful but mp3 format is the most important

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
  • 3
    Interesting question, but what have you tried so far? – Widor Jun 06 '12 at 16:29
  • I recently wrote a small c++ application: WaveMix, what you need maybe transcode mp3 format to linear PCM, and check if the sample value is `0` for signed data, check if the sample value is **middle value** for unsigned data – LiuYan 刘研 Jun 06 '12 at 16:40

1 Answers1

3

The only way I know of to reliably detect silence at the end of a sound clip is to convert it to a PCM format and do one of the following calculations checking for a certain minimum cut-off amplitude.

I've never managed to implement dB, but RMS is relatively simple, and should work for this use. I used it for the small bars seen on the lower left/right of trace area of the DukeBox player.

DukeBox screenshot

As to how to do any of that with MP3 format, see the details on the Java Sound info. page.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • There's isn't really any need to calculate dB or RMS on every sample. Theoretically, since you are looking for silence, you could just look for samples with value of zero, but, in practice, you'll need a small cutoff -- there's no need to calculate RMS or dB for that purpose. Absolute value will do just fine. – Bjorn Roche Jun 07 '12 at 13:51