nix, shell, perl, php, mysql and mac os x tips and tricks

Monday, October 13, 2008

encode mp3s on the fly

I use this to record audio programs (voice quality). This gives fairly
small files, which I like because it makes it possible to save a LOT of
sound on a cd, and I find that the quality is satisfactory for me.



Here is the command:
sox -t ossdsp -w -s -r 44100 -c 1 /dev/dsp -t raw - | lame --nores -b 16
-x -m m - $(date +"/home/david/test--%a%d%b%Y_%I-%M%p.mp3") &

Change the number 16 to something else, like 32 to get better quality.
Like this. (These examples produce mono.)
sox -t ossdsp -w -s -r 44100 -c 1 /dev/dsp -t raw - | lame -b 32 -x -m m -
$(date +"/home/david/audio-temp/--ChangeMyName--%a%d%b%Y_%I-%M%p.mp3") &
This part of the command:
$(date+"/home/david/test--%a%d%b%Y_%I-%M%p.mp3")
produces a file name with a date and time extension as part of it.



For stereo, try this:
sox -t ossdsp -w -s -r 44100 /dev/dsp -t raw - | lame -t -r -x -h -b 160
-s 22.05 -q 5 --nores --strictly-enforce-iso - $(date
+"/home/david/test_%a%d%b%Y_%I-%M%p.mp3")
or
sox -t ossdsp -w -s -r 44100 /dev/dsp -t raw - | lame -t -r -x -h -b 128
-s 22.05 -q 5 --nores --strictly-enforce-iso - $(date
+"/home/david/test_%a%d%b%Y_%I-%M%p.mp3") 

No comments:

Post a Comment