- Get an SSD cloud server in less than a minute!
- Protect your important files with HubiC. Get your free 35GB account TODAY!
- Get paid for reading email!
- Earn cash while shopping for everyday household items and groceries
I have mentioned sox briefly in passing in a couple other posts. This awesome command line music player and editor is a truly great addition to anyone’s CLI arsenal though, so I figured I’d devote a whole post to it. So, without further ado, let’s have sox!
play file name.ext
as in play guitarsolo.ogg
or to record yourself,
To convert file from wav to ogg:
sox scream.wav scream.ogg
The sox manual does a great job at explaining play and rec, so I will keep it brief here. The purpose of this article is more to discuss the synth function and all the really neat stuff you can do with it.
There are several sound types you can choose from when using synth, they are brown, pink, pluck, saw, square, triangle and white. To play a single guitar note, an E, you can do the following:
play -n synth 2 pl E2
Notice the use of pl instead of pluck in the line above. You can use abbreviated synth types for any of the sound types, pi for pink, tri for triangle, etc. If, you want to write your note to a file, do it like this:
sox -n note.ogg synth 2 pl E2
Using the play command will fail here because it will try to play the file note.ogg instead of writing to it. There are lots of effects you can add to your notes including overdrive, flanger, etc. Each is well documented in the sox manual. One thing that I found difficult to understand at first was linking multiple notes together. There are some simple demonstrations of chords in the manual, but, if you want to have sox play a song, you will run into the daunting task of making some huge delays for each note, or you can link multiple sox commands together like this:
play "|sox -np synth .25 pl E2" "|sox -np synth .7 pl B2"
I have written a script to play the song "Twinkle Twinkle Little Star" using sox. It is available here. Now, if we stopped here, that would have been some good sox, but I’m all about the really great sox. So, There is a second script that turns your keyboard into a keyboard (synthesizer) which you can download from here. Simply tar xzf soxsynth.tar.gz and cd to the soxsynth directory. run the script with ./soxsynth.
I have really enjoyed this sox with you. I hope it was as good for you as it was for me.