batch-converting audio using soX (for arduino waveshield)

i’m currently experimenting with the waveshield a.k.a. audioshield for arduino by ladyada. it’s a pretty handy extension for arduino thats add’s the capability to output audio and read/write sd-cards with arduino, they also provide nice libraries to work with. in respect to¬† the limited calculating power of the arduino it can only play uncompressed wave files that are mono, have a samplerate of maximum 22khz and a resolution of 16 bit. this is quite ok for most things you would like to do with it, but you first have to convert most wave files you have to this format.

on the waveshield’s website there are instructions for the conversion with itunes and audacity, but they also point to converting files with soX. soX (sound eXchange) calls itself to be the “swiss army knife of sound processing programs” and, yes, it is! it’s a small cross-platform command-line utility that can perform manipulations and conversion of audio in all thinkable kinds of formats – the list of features is truely impressive.

i only wanted to use it to convert wavefiles in different folders to a waveshield-compatible format without touching the original files while preserving the original folderstructure, so i wrote a little bash-script to do this. you might use the script for just that purpose as is. nevertheless it should be easy to edit the script for doing all kinds of batchprocessing with soX, i.e. editing the volume of your audio data or even apply effects to them. just have a look a soX’ manpage to see what you can do with it.
Continue reading “batch-converting audio using soX (for arduino waveshield)”