Sox

From LQWiki
Jump to navigation Jump to search

sox is a powerful sound sample converter capable of converting between well over 20 different sound file formats. They include .8svx, .aiff, .au, .avr, .cdr, .cvs, .dat, .gsm, .hcom, .maud, .mp3, .nul, .ogg, ossdsp, .prc, .sf, .sph, .smp, .snd, .sndt, sunau, .txw, .vms, .voc, .vox, .wav, .wve, and .raw, (From sox -h) so the conversion you need should be in there. Sox can also perform some effects, such as fade-in/out, or tasks like turning up/down the volume, or resampling the audio.

Install it

Install it by means of your distribution as described at installing Software. E.g. for SUSE Linux install it like this:

yast -i sox

Examples

  • Used in its most simple form, sox can be used to convert one audio format to another:
sox input.wav output.ogg
  • Generate a phaser sound:
sox -n phaser.wav synth .5 sine 10000-5
  • Generate a more complex phaser sound:
sox -n phaser2.wav synth 0.5 sine 1600-100 \
  synth 0.6 sine fmod 200-1400
  • Use mplayer to listen to your sounds:
mplayer phaser2.wav
  • Have you been told you snore or talk in your sleep? Use the 'rec' utility with silence detection to find out!:
rec -r 22050 -c1 -p | sox -p do_i_snore.flac silence -l 1 00:00:00.1 -70d -1 00:00:00.1 -70d
  • The above 'rec' example will only record noise with the thresholds given. The file size stays very small (unless you snore alot), because it only keeps the noise, not the silence.
  • See the sox man page for complete details on why this works.

Web Site

http://sox.sourceforge.net/

See also