Sox
various sox effects
show information about file
sox file.wav -e stat
trim parts of a file - starts at 0 seconds and plays until 10 secs
sox file1.wav file2.wav trim 0 10
fade a file in for 3 seconds
sox file.wav file2.wav fade t 3 0 0
fade out the last 3 secs. of a 245 second file
sox file.wav file2.wav fade t 0 242 3
MP3
mp3 streams into wav
This will take an mp3 stream and turn it into a wav file.
mpg123 -b 10000 -s http://some.stream | sox -t raw -r 44100 \
-s -w -c 2 - stream.wav
mp3 files to wav
This will convert your MP3 file back to a *.wav file
mpg123 -w new_wav.wav mp3_file.mp3
Ogg Vorbis
rip a CD track to ogg
To rip something directly to ogg, your version of sox should have
ogg vorbis support. Recent versions do.
cdparanoia -qer 19 -| sox -t raw -r 44100 -s -w -c 2 - Artist_Song.ogg
Notes:
- drop the 'e' option if you don't want to see the output
- 'r' is little-endian - most sound cards
- 'q' is quiet
encode wav to ogg
If you've ripped the file with cdparanoia, for example.
oggenc -a "artist" -t "song_title" -l "Album Name" -b 192 \
wav_to_encode.wav -n "%a_%t.ogg"
ogg stream back to ogg
Use sox to convert a remote ogg stream back to a local
ogg file.
ogg123 http://some.ogg.site/stream.ogg -d wav -f - | \
sox -t wav -r 44100 -s -w -c 2 - stream.ogg
ogg stream to wav
Similar to above, this converts the stream to *.wav, which you
will be able to edit.
ogg123 -d oss -d wav -f stream.wav http://some.stream.site/stream.ogg
ogg2cdda
If you have some *.ogg files that you want to put on a CD in CD audio
format (to be played in a conventional CD player), the following
script will speed up the process.
#!/bin/sh
for oggfile in *.ogg ; do
cddafile="`basename $oggfile .oggcdda"
oggdec -b 16 -e 1 -o $cddafile done
You can then burn a CD:
cdrecord -v dev=/dev/sga speed=8 -audio -dao pregap=0 -eject *.cdda
note: for big files, use -pad before -audio
General
change sound of PC's beep
You can change the sound of the beep from your PC's speaker by
changing these numbers. First is length, followed by pitch and tone.
xset b 30 550 300
[ return to main tips page ]
|