A simple guitar tuner – SOX

sox is a command line audio tool.  I use it from time to time to automate some audio related activities.  I play guitar from time to time, and I do like the idea of tuning my guitar by simply listening to the note.  Now there’s a ton of apps out there that can do the trick, but I decided to create an audio file that I can copy onto  my phone, and use it to tune my guitar wherever I may be.

A standard guitar is tuned E (164.81 Hz), A (220 Hz), D (293.66 Hz), G (392 Hz), B (493.88 Hz), E (659.26 Hz).  Using a simple script, I spliced it together, and generated this little file.  Easy enough.

# == generate the individual tones
sox -n -r 8000 1.wav synth 5 sine 164.81
sox -n -r 8000 2.wav synth 5 sine 220
sox -n -r 8000 3.wav synth 5 sine 293.66
sox -n -r 8000 4.wav synth 5 sine 392
sox -n -r 8000 5.wav synth 5 sine 493.88
sox -n -r 8000 6.wav synth 5 sine 659.26
# == merge them into a single file
sox 1.wav 2.wav 3.wav 4.wav 5.wav 6.wav guitar.wav
# == encode it to an mp3
lame -m s -b 64 guitar.wav guitar.mp3

[ Download ] enclosure

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *