Command line tool to find clipping audio files?

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

Moderators: khz, MattKingUSA

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

Command line tool to find clipping audio files?

Postby jmpr » Fri Feb 19, 2016 2:10 pm

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?

Postby tnovelli » Fri Feb 19, 2016 8:15 pm

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?

Postby jmpr » Sun Feb 21, 2016 2:54 pm

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?

Postby vma » Wed Aug 21, 2019 6:32 am

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: 1119
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland & Frankfurt, Germany

Re: Command line tool to find clipping audio files?

Postby bluebell » Wed Aug 21, 2019 12:43 pm

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 – https://soundcloud.com/suedwestlicht

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

Re: Command line tool to find clipping audio files?

Postby vma » Thu Aug 22, 2019 7:21 am

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.


Return to “Linux Distributions & Other Software”

Who is online

Users browsing this forum: Bing [Bot] and 2 guests