rubymp3playbackbackground-music

how do I play mp3 file?


How can I write a script in ruby which plays mp3 file (background-music) when executed from command-line?

I tried this

run = "mplayer #{"/Users/bhushan/resume/m.mp3"} -ao sdl -vo x11 -framedrop -cache 16384 -cache-min 20/100"
system(run)

but it is not working also, above is player specific. what if user don't have mplayer installed. Id there a better way?


Solution

  • I usually just do

    pid = fork{ exec 'mpg123','-q', file }