Command line tool to find clipping audio files?

What other apps and distros do you use to round out your studio?

Moderators: MattKingUSA, khz

Post Reply
jmpr
Established Member
Posts: 5
Joined: Fri Feb 19, 2016 2:05 pm

Command line tool to find clipping audio files?

Post by jmpr »

I am currently sampling audio files with synthclone. This is a great way to automate the task but I want to know for sure that no samples are clipping. Is there a command line tool that I can run on the sample folder to analyze all audio files and tell me which ones are clipping? Or something else similar? Would be a quick and easy way to identify any individual samples that I might potentially have to fix.
tnovelli
Established Member
Posts: 277
Joined: Wed Apr 20, 2011 4:52 pm

Re: Command line tool to find clipping audio files?

Post by tnovelli »

Allright, I needed to figure this out too. This seems to work:

Code: Select all

for i in *; do echo $i `sox $i -n --norm -R gain 0.1 2>&1`; done |grep clipped
That lists audio files with clipping. It's not exact so I added "gain 0.1" (in decibels) to catch anything *almost* clipping just to be on the safe side. You might want to leave that out or tweak the gain.

Audacity has a Find Clipping tool under the Analyze menu.
jmpr
Established Member
Posts: 5
Joined: Fri Feb 19, 2016 2:05 pm

Re: Command line tool to find clipping audio files?

Post by jmpr »

tnovelli wrote:Allright, I needed to figure this out too. This seems to work:

Code: Select all

for i in *; do echo $i `sox $i -n --norm -R gain 0.1 2>&1`; done |grep clipped
That lists audio files with clipping. It's not exact so I added "gain 0.1" (in decibels) to catch anything *almost* clipping just to be on the safe side. You might want to leave that out or tweak the gain.

Audacity has a Find Clipping tool under the Analyze menu.
Thank you very much. That works exactly how I wanted :)
vma
Posts: 2
Joined: Wed Aug 21, 2019 6:20 am

Re: Command line tool to find clipping audio files?

Post by vma »

Thank you for the command. It would be nice to do it recursively, to check all files in one step.
User avatar
bluebell
Established Member
Posts: 1910
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

Re: Command line tool to find clipping audio files?

Post by bluebell »

vma wrote:Thank you for the command. It would be nice to do it recursively, to check all files in one step.
I can't test it at the moment but a shell file like this should work:

Code: Select all

#!/bin/bash
find . | while read LINE
do
 sox "$LINE" -n --norm -R gain 0.1 2>&1 | grep clipped && echo "$LINE"
done
- save it as clippedfiles.sh
- chmod 755 clippedfiles.sh
- go to the desired directory with the audio files
- run the script with /path/to/your/script/clippedfiles.sh

Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/

vma
Posts: 2
Joined: Wed Aug 21, 2019 6:20 am

Re: Command line tool to find clipping audio files?

Post by vma »

Thank you very much bluebell. I do not have my music files here, but I used my "service" computer to run your bash script and it works.
Post Reply