I have a few thousand small 2MB audio recordings from a recording device that turns over every so often. The total amount of recording time is several days, but each file contains about 5 minutes worth. Normally, it is only meant to record audio when there is some volume happening (speech). Problem is that I had the sensitivity setting too sensitive. The result is a mix of audio files with speech in it, but with the bulk of them only having recorded a soft background hiss. I can't just "grep" the files for a bunch of zeros. I was thinking of writing a quick little Java application that loads each file, and then calculate the amount of energy in it, by simply adding the different between each sample. But I was hoping that someone might now a simple clever way of wiring together some bash/awk/play/mpg123 something anything. Possibly there exists a command line app in one of the audio tool sets that I'm not aware of yet?

  • 1
    Take a look at chromaprint. – Satō Katsura Mar 16 '18 at 16:50
  • 1
    I don't have a way to test, but lame's replaygain option looks promising. (one use) – Jeff Schaller Mar 16 '18 at 16:57
  • 1
    Have a look at sox with stat and stats effect. You'll need to parse the output. – dirkt Mar 16 '18 at 18:27
  • This is all useful. I guess that chromaprint can perhaps help provide more accurate assessments. Lame I'm not sure can analyze a source without going through the rigmarole of compressing mp3. But sox seems very promising. The syntax is: sox file -n stat. Out comes various things like "Volume adjustment". I'm testing now to see if the numbers are accurate enough where I can use it to select files. I might use awk to extract the number and do the comparisons. It seems I might not have to hack together a Java app after all. Dirkt, once this works, turn it into an answer so I can vote on it. – Mike Mar 16 '18 at 18:53
  • 1
    Also check out sox silence which can trim out parts of a file with sound below a given threshold. Might be useful even in the future when you have the right trigger level. There are examples in the man page. – meuh Mar 18 '18 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.