For a project I am working on, I need to use the SoX tool for audio generation. If there is a way to use SoX to generate certain notes/tones for a certain duration, please let me know! I have done quite some research on this to no avail.
Moreover, any way to make it output directly into your speakers? I'm thinking something like redirection to /dev/audio.
Audio recorder SoX includes a very handy way of recording audio using the rec command. The simplest use is to type rec filename which will start recording from the default input until you stop it by pressing ctrl-c in the terminal window.
SoX is a cross-platform (Windows, Linux, MacOS X, etc.) command line utility that can convert various formats of computer audio files in to other formats. It can also apply various effects to these sound files, and, as an added bonus, SoX can play and record audio files on most platforms.
SoX reads and writes audio files in most popular formats and can optionally apply effects to them. It can combine multiple input sources, synthesise audio, and, on many systems, act as a general purpose audio player or a multi-track audio recorder.
You can synthesise sound effects using synth
and the -n
option.
For instance, the following command creates a 3 seconds sine wav at 500 Hz:
sox -n -r 8000 output.wav synth 3 sine 500
You can set the sample frequancy using the option -r
. Default value is 48kHz.
You can play audio directly to /dev/audio. If you just need to play the file, and not save it, you can use play
utility (provided by sox) as follows:
play -n -c1 synth 3 sine 500
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With