0
$\begingroup$

Is there any method via python of any other means, to return a list of wav files in a folder that are clipped?

I know that Adobe Audition can tell if a file is clipped, but I have to open up each file and then check. Can this process be automated somehow? Any direction is sincerely appreciated!

$\endgroup$
8
  • 1
    $\begingroup$ Duplicate: What are good ways to detect signal clipping in a recording? $\endgroup$
    – Jdip
    Sep 12, 2022 at 0:20
  • 2
    $\begingroup$ That’s a programming question then, not a signal processing one. $\endgroup$
    – Jdip
    Sep 12, 2022 at 1:55
  • 1
    $\begingroup$ Can't you just loop over all files in a directory or file list? I don't think I understand what your problem with "batch mode " is $\endgroup$
    – Hilmar
    Sep 12, 2022 at 2:01
  • 1
    $\begingroup$ Orban Loudness meter has some good tools but, dunno if it detects cllpping only. orban.com/meter , orban-europe.com/downloads/Orban_Loudness_Meter/Documentation/… $\endgroup$
    – Juha P
    Sep 12, 2022 at 7:22
  • 1
    $\begingroup$ I would use sox in.wav -n stats, grep for "Pk lev dB" and "Pk count". If "Pk lev dB" is 0 dBFS and "Pk count" is greater than 2, then there might be clipping present. $\endgroup$
    – jojeck
    Sep 12, 2022 at 9:00

1 Answer 1

1
$\begingroup$

As what @jojek suggests, With sox it is quite easy to find clipped audio files:

for i in *; do echo $i `sox $i -n --norm -R gain 0.1 2>&1`; done |grep clipped

lists audio files with clipping.

Notice: It's not exact so "gain 0.1" (in decibels) is suggestion to catch anything almost clipping just to be on the safe side. You might want to leave that out or tweak the gain.

To check all files in one step you could use script like this:

#!/bin/bash
find . | while read LINE
do
 sox "$LINE" -n --norm -R gain 0.1 2>&1 | grep clipped && echo "$LINE"
done

Same notice as with the 1st script.

$\endgroup$
2
  • $\begingroup$ thanks for your suggestion. Is it possible to convert your code to batch formatting? Thanks again! $\endgroup$
    – Joe
    Sep 14, 2022 at 18:04
  • 1
    $\begingroup$ Sorry, but I have not played with batch files for years now. In generally speaking you just need to loop the sox command for audio files. Scripting languages (VBScript, JScript) works in this too and you should be well with entering sox commands directly to command prompt as well sox.sourceforge.net/sox.html , madskjeldgaard.dk/posts/sox-tutorial-batch-processing $\endgroup$
    – Juha P
    Sep 14, 2022 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.