Posted April 19, 2012
by Lensyl Urbano
I’ve been using the command line program SoX to generate tones for my physics demonstrations on sound waves.
Combine two tones allows you to talk about interference and beats.
SoX can do a lot more than this, so I though I’d compile what I’m using it for in a single, reference post. For the record: I’m using SoX in Terminal on a Mac.
To play a single note (frequency 173.5 Hz) for 5 seconds, use:
> play -n synth 5 sin 347
To save the note to a mp3 file (called note.mp3) use:
> sox -n note.mp3 synth 5 sin 347
The SoX command to play two notes with frequencies of 347 and 357 Hz is:
> play -n synth 15 sin 347 sin 357
and to make an mp3 file use:
> sox -n beat_10.mp3 synth 15 sin 347 sin 357