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)”

utilizing a 74HC4051 to multiplex inputs

for my next project (which is going to be a neat little pedal-controlled sample-based instrument – more about that later), i will need to know the states of lots of buttons, but utilizing as little as possible of arduino’s pins. using shift registers for this purpose came directly to my mind, but then I had a look at the schematics of the pocket piano arduino shield from critter and guitari. they used  74HC4051 8bit-multiplexers to read the buttons which seemed to me to be a safer way to get the button states right. besides, if you need to multiplex more than 8 inputs, you can save input pins by using multiplexers: for each shift register you attach to the arduino, you need two pins (clock and input), for the first multiplexer you always need 3 pins (output to select the outputted bit), but for every additional multiplexer you need only one more input pin!

today i tried the multiplexers and made up a small code snippet, which scans though all inputs of the 74HC4051s and outputs the numbers of the active inputs via serial. with a little bit twiddling it got quite short:

Continue reading “utilizing a 74HC4051 to multiplex inputs”

shortcut to arduino IDE on a linux system

i’m currently running ubuntu 9.10 as my main os and the Arduino IDE (v017) works on it like a charm after following the instructions over at in short it was just the following two commands in the terminal:

sudo apt-get install sun-java6-jre gcc-avr avr-libc
sudo apt-get remove brltty

after installing these dependencies and removing the conflict with brltty, it was no problem to run the arduino IDE. just downloading and double-clicking the file arduino (a batch script) did the job.

the only inconvenience about it was, that it was not possible to set up a shortcut on the desktop or the menu to start the always have to navigate to the program folder via terminal or a file manager and click the original batch script to start the IDE. starting a shortcut to it always ended with the following error message:

Exception in thread "main" java.lang.NoClassDefFoundError: processing/app/Base
Caused by: java.lang.ClassNotFoundException:
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClassInternal(
Could not find the main class: Program will exit.

this is a known issue and already documented over at the arduino-site on googlecode. luckily p.d.oliver already posted a fix for the bash-script, that will do the trick. if you are too lazy, to do the changes on your own, you can just download the edited scipt and replace the original one with the new one.

Continue reading “shortcut to arduino IDE on a linux system”