Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 593
Bhushan Lodha Avatar asked Mar 27 '12 14:03

Bhushan Lodha


People also ask

Why is my MP3 file not playing?

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.

Does my computer have an MP3 player?

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.

Can I play MP3 on Windows Media Player?

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.

What app opens MP3 files?

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.


1 Answers

I usually just do

pid = fork{ exec 'mpg123','-q', file }
like image 130
nex Avatar answered Sep 30 '22 13:09

nex