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?
MP3, like many other file types, can get corrupted and damaged due to various reasons. When these files are damaged, they won't play in any media players on your computer. You'll need to first repair those MP3 files before they can be played again.
Virtually all modern computers have built-in audio players that will automatically play your MP3 file. On many computers, all you need to do is double-click the file. Alternatively, you may have to choose the file and then “right-click” to reveal a drop-down menu that includes a “play” option.
The basic playback of MP3 files and other digital audio files from your Windows Media Player Library is simple. Just navigate through Windows Media Player and double-click or double-tap on a song. Alternatively, you can also select a tune and press Play on the Playback Controls.
File Viewer Plus can open MP3 files, and it comes with standard playback options. It allows you to inspect the metadata of the audio file and can also convert the audio to the MPEG-4 audio format at different bitrates and frequencies.
I usually just do
pid = fork{ exec 'mpg123','-q', file }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With