BASH MP3

From Indie IT Wiki

HOWTO:

SPLIT AN MP3 FILE FOR BURNING MULTIPLE TRACKS TO A CD

Use the mp3splt command line tool. The example below makes 6 minute long tracks and automatically adjusts the spilt to occur during moments of silence.

mp3splt podcast.mp3 -g %[@N=0,@o] -o "@n_@f" -t 6.0 -a

Thanks to Librivox

Now you can use the method below to convert all the MP3 files to WAV files, and then burn them to a CD.

BURN MP3 ON TO AN AUDIO CD

First, you need to convert your MP3 (myfile.mp3) into a WAV (myfile.wav) file. You use the mpg123 command line tool for this. Make sure it is stereo.

mpg123 --stereo --wav myfile.wav myfile.mp3

Or, for multiple files.

for file in *.mp3; do mpg123 --stereo --wav "${file}".wav "$file"; done

Find your CD Burner

cdrecord -scanbus

Then burn your WAV file on to the CD

cdrecord dev=2,0,0 speed=4 -pad -audio myfile.wav

Or, burn all your WAV files on to the CD (just make sure they are numbered sequentially)

cdrecord dev=2,0,0 speed=4 -pad -audio *.wav

Troubleshooting: If you receive this error, then use the --stereo switch shown above to convert it from mono.

Inappropriate audio coding in 'myfile.wav'.

Thanks to Cyberciti

HOWTO: PLAY:

FILES OVER SSH CONNECTION

That will play all mp3 files in the folder /home/user/music/artist on the server, and the sound will be on the client’s speakers.

ssh user@server "cat /home/user/music/artist/*.mp3" | mpg123 -

FILES ON SERVER OVER SSH CONNECTION

ssh user@server
screen
mpg123 -C /home/user/music/artist/*.mp3
CTRL+A D  (to detach from running screen session)