How To Find (and Delete) Silent Audio Files

Posted on February 6, 2013 by David Hilowitz

The Problem

If you’re anything like me, you have a ton of audio files on your hard drive. When I’m working on music (or an audio synthesis project), I will export out songs that I’m working on in one piece of software in order to import them into another. I keep the intermediary tracks in my Dropbox so that I can use and reuse the little snippets when I’m building my compositions. Life has gotten much easier for me in the past few years as most modern audio sequencers (Cubase, Live, PreSonus Studio One) now offer the possibility of exporting all the component tracks of a composition. The problem is, if you have 12 tracks in your song file and only 4 of them are actually being used in the section of song you are exporting, you’ll end up with 12 audio files—8 of which will be blank. If only there were some easy way of find and deleting those blank files so that they didn’t take up so much of my valuable Dropbox space…

The Solution

Luckily, if you’re using a Mac/Linux box, it’s possible to find (and yes, delete) silent audio files en masse using the command-line. It’s undoubtedly possible in Windows, too, using Cygwin, but I haven’t tried it. NOTE: This is very much a use-at-your-own-risk solution. When I do this, I never delete the files directly. I always just use this system to generate a file list. Then I drop the list of files into Winamp and have a relaxing “silent file listening session.” In other words, I check to make sure they are, in fact, actually silent.

OK, so how does it work?

For starters, you will need to install a super useful tool call SoX. SoX is a command-line tool which can be used to perform conversions from one audio file format to another, to apply filters to your files, as well as to generate useful statistics about your audio. In OS X, you can install it via MacPorts (simply type “sudo port install sox” at the Terminal) and on Linux via apt-get. You can also go the old-fashioned route by downloading the source files and compiling it.

Once you have it installed, try it out. Open up a Terminal window, cd into a directory that contains some audio files, and type this:

sox <name_of_audio_file> -n stat

You should get a response that looks like this:

~/loops $ sox <name_of_audio_file> -n stat
Samples read: 2596058
Length (seconds): 13.521135
Scaled by: 2147483647.0
Maximum amplitude: 0.848263
Minimum amplitude: -0.943067
Midline amplitude: -0.047402
Mean norm: 0.083552
Mean amplitude: -0.000062
RMS amplitude: 0.120734
Maximum delta: 0.157007
Minimum delta: 0.000000
Mean delta: 0.024596
RMS delta: 0.034412
Rough frequency: 4354
Volume adjustment: 1.060

We can see from the output that this .wav file is definitely not silent. If it were silent, the Max, Min, and Midline amplitudes would all be 0.000000.

OK, now that we’ve seen what SoX provides us with, how do we find the silent files?

Open up your favorite text editor and paste this into a text file:


## A quick hack like script to list all the files that have
## a low amplitude.
## Input is a bash file list or glob.
## $ find_silent_audio_files *.wav
## Each time the script runs it will remove the output list
## and regenerate it. Stderr will output each file and it's
## amplitude.

Max=0.0 # Any amplitude greater than this will NOT be listed
OutList=~/output.list # The name of the file that contains a
# list of file names only of all the
# low-amplitude files.

# rm $OutList
for each in "$@"
do amplitude=$(sox "$each" -n stat 2>&1 | grep "Maximum amplitude" | cut -d ":" -f 2 | sed 's/ g')
if [[ $(echo "if (${amplitude} > ${Max}) 1 else 0" | bc) -eq 0 ]]
then echo "$each --> $amplitude" >&2
echo "$each" >> $OutList

Save this as find_silent_audio_files somewhere in your PATH (maybe in /usr/local/bin or a ~/bin directory if you have one). chmod it so that it’s executable (chmod +x ./find_silent_audio_files).

Great. You are now ready to use this tool. Run it as follows:

dave:~ dhilowitz$ cd ~/wave_files
dave:wave_files dhilowitz$ find_silent_audio_files *.wav
202_what_you_working_on_chorus 13-Audio.wav --> 0.000000
202_what_you_working_on_chorus 2 - 12 C HEND.wav --> 0.000000
202_what_you_working_on_chorus A-Return.wav --> 0.000000
202_what_you_working_on_chorus B-Return.wav --> 0.000000
202_what_you_working_on_chorus MIDI Tracks.wav --> 0.000000
202_what_you_working_on_chorus MOOG.wav --> 0.000000
202_what_you_working_on_verse 13-Audio.wav --> 0.000000
202_what_you_working_on_verse 2 - 12 C HEND.wav --> 0.000000
202_what_you_working_on_verse A-Return.wav --> 0.000000
202_what_you_working_on_verse B-Return.wav --> 0.000000
202_what_you_working_on_verse MIDI Tracks.wav --> 0.000000
202_what_you_working_on_verse MOOG.wav --> 0.000000

The output of the command will be echoed to stdout as well as to a file in your user directory called ~/output.list. As you can see from the code listing above, this file name can be changed. Once you know the names of the files, it should be pretty easy to delete them. Obviously, changing “echo” to “rm” in the script above will accomplish this, but, as I said before, I wouldn’t recommend it unless you have backups or really don’t care.

OK. That’s about it. Good luck! I hope this is useful to someone out there.


TIP: Cubase SX 3: Getting TubeBooster to work in Windows 7 64-bit

Posted on February 12, 2012 by David Hilowitz

I spent most of my day yesterday getting my new music recording PC set up (my new PC is a Mac Mini i5 2.3 Ghz running Windows 7 64-bit). After installing Cubase SX 3.1.1 on my PC, and installing all my most essential VST plugins, I discovered that the song that I have been working on most recently wouldn’t load. Cubase itself would start up just fine, but when I tried to load the song itself it would just hang for hours. Whenever this would happen, Process Explorer would show that the CPU was running at about 25%. The only way to get out of these hangs was to kill the process.

I did a lot of research on what might cause this sort of a problem.  A few other people had had similar issues in the forums, and responding posters had suggested that the problems might be related to one of the plug-ins they had running. I went into C:\Program Files (x86)\VstPlugins and removed all of my plugins, storing them in a folder on my desktop.

I started up Cubase, I loaded my project, and presto, it loaded up almost immediately.

One by one, I added the plugins back in. Each time I did, I would close Cubase, copy the plug-in back to the VstPlugins folder, and relaunch Cubase (ugh). Then I would open the project to see if it loaded.

Finally, when I got to Wurr Audio‘s fantastic TubeBooster plug-in the program began to hang. Uh oh. This plug-in is used *everywhere* in my projects. Like, maybe in every single project I’ve done for the past two or three years. It’s central to my vocal sound. I tried fooling with the settings in Cubase’s *Plug-in Information* window (the ones with names like “Old Host Behavior” and “Lock VST Automation”), but nothing worked.

Finally, after reading about people who had problems with running 32-bit plug-ins on 64-bit hosts, I discovered jBridge. jBridge is a program that allows you to run 32-bit plugins on 64-bit hosts and vice-versa. It does this by “wrapping” the plug-in in another plug-in. Now, bear in mind that while I am running 64-bit operating system, I am running a 32-bit version of Cubase and a 32-bit version of this plug-in. This should not be an issue. And yet…

I downloaded jBridge, wrapped TubeBooster, and it worked! My project loaded like charm. All the settings I had in TubeBooster were preserved as well. Without hesitation I paid the 15 euro fee for the full version jBridge.

Hope this helps somebody out there.



TIP: How to do disk image backups in Ubuntu Linux 10.04

Posted on November 28, 2011 by David Hilowitz

So, I just installed Ubuntu Linux 10.04 on my trusty Toshiba Portege 3480CT8. (Yes, it works beautifully as a lightweight LAMP server.)

One of the first things I set out to do was make a disk image of my new server, so that if something goes awry, I can restore things later on.

Here’s what I did:

First, I plugged my external drive into the USB port. This got assigned to /dev/sdb.   I mounted the drive.

$ sudo mkdir /media/backup_04 
$ sudo mount /dev/sdb1 /media/backup_04 -t ntfs 
$ sudo mkdir /media/backup_04/portege-linux-backups

Next,  I installed dcfldd. This is just like dd, which comes with most Linux distributions, except that it can output time remaining (among other things).

$ apt-get install dcfldd

Finally, I started the backup:

$ dcfldd if=/dev/sda of=/media/backup_04/portege-linux-backups/2011_11_28.img sizeprobe=if

This produces an output that looks like this:

$ [16% of 28615Mb] 155136 blocks (4848Mb) written. 01:17:37 remaining.


TIP: Installing Ruby on Rails on Mac OS X 10.6.8

Posted on October 4, 2011 by David Hilowitz

1. Install XCODE 4. This is actually trickier than it seems. You have to:

a) download XCode;
b) run the .dmg.
c) quit iTunes, then go into Activity Monitor and force quit on anything iTunes related (iTunesHelper as well);
d) go into the Applications folder and find the “Install XCode” app, and run that. (Yes, you have to run a second Install XCode app…and I had to run it twice. It failed the first time. If you want to watch it fail, drop into Terminal and type this: tail -f /var/log/install.log.

2. Install MacPorts.

3. Test MacPorts by installing joe. Type:

$ sudo bash
$ port install joe.

Enter your password.

4. A bunch of things will be preinstalled with the wrong architecture. We’re trying to get ruby as an x86_64 architecture. So…uninstall libiconv and zlib (you may have to tinker with this a bit because it will ask you which version you want to uninstall — the answer is “all of them”)

$ sudo port uninstall -f libiconv @1.13.1_0
$ sudo port uninstall -f libiconv @1.14_0
$ sudo port uninstall -f zlib
$ port uninstall -f readline
$ port uninstall -f openssl
$ port uninstall -f ncurses @5.8_1
$ port uninstall -f ncurses @5.9_0
$ port uninstall -f ncurses @5.9_1
$ port uninstall -f gdbm

5. Install ruby by doing:

$ port install ruby

7. Update your gems:

$ gem update --system

8. And, finally, install Rails:

$ gem install rails --pre

Useful links:

TIP: Final Cut Pro Tip: A Faster Way to Do a Roll Trim

Posted on February 26, 2011 by David Hilowitz

“Roll trims are my bread and butter. Here’s how to eat faster. Select an edit point. Put your playhead where you want the selected edit point to move and press E. The selected edit point jumps to the position of the playhead—provided you have asufficient handles in your media.

This is essentially a Roll trim in real time.”

Source: Final Cut Pro Power Skills: Work Faster and Smarter in Final Cut Pro 7

TIP: How to make .htaccess files work on OS X 10.5

Posted on January 23, 2011 by David Hilowitz


To make .htaccess files work as expected, you need to edit /etc/apache2/sites-available/default. Look for a section that looks like this:

        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                # Uncomment this directive is you want to see apache2's
                # default start page (in /apache2-default) when you go to /
                #RedirectMatch ^/$ /apache2-default/


You need to modify the line containing AllowOverride None to read AllowOverride All. This tells Apache that it’s okay to allow.htaccess files to over-ride previous directives. You must reload Apache before this change will have an effect:

sudo /etc/init.d/apache2 reload


Introducing Tito

Posted on October 20, 2010 by David Hilowitz

Tito ScreenshotHi Everyone,

I wanted to introduce the first of what I hope will be several Chrome Experiments (prediction: all HTML5, and all music-related). It’s called Tito, and you can play with it here.

What is it? It’s an early prototype for a musical instrument that uses a bouncing ball gravity model to trigger and manipulate audio samples. It’s an instrument that designed to be played as chord accompaniment for a lead instrument. You “play” the instrument by  clicking the chord buttons on the right. Note for music geeks: 7ths and Dim notes are provided with each chord, but muted by default. Click on the notes at the bottom of the bouncing ball graphs to enable them.

Requirements: Tito requires Chrome, Safari, or Firefox. Also, Tito requires Flash as the audio portion is still being done in Flash (Currently Firefox 4 is the only browser to have an HTML5 spec for audio data, alas.)

Here are the new features I’m working on for the next version:

  • Ability to choose between multiple different sample sets.
  • Option to retrigger all the balls on each chord change.
  • Ability to position falling balls by clicking on them and letting go. Done! 10/21/10.
  • Sliders for changing gravity settings.
  • And finally, whatever features you want. @reply me on twitter (@dhilowitz).
  • Ability to mute specific balls. Done! 10/19/2010.
  • Ability to change chords. Done! 10/1/2010.

Please enjoy!


« Newer PostsOlder Posts »