Power & Source of Big Ideas

How can I play an MP3?

Moderators: chensy, FATechsupport

How can I play an MP3?

I am sitting here at the root prompt on a Nanopi NEO with Ubuntu 15.10 loaded from the FriendlyARM file.
I can get sound by running the speaker-test program, but I cannot play MP3 files.
I have downloaded and built mpg123 but all it does is complain that it cannot open the default sound device.

For people who CAN play MP3's on this hardware, with this O/S, how did you do it,please?
Doctordien wrote:
How can I play an MP3?
I have downloaded and built mpg123 but all it does is complain that it cannot open the default sound device.
For people who CAN play MP3's on this hardware, with this O/S, how did you do it,please?

You dont have to download/built mpg123 - you could install it with
apt-get install mpg123
:)
For the default sound device use
aplay -l
to list your sound devices.

Then you must configure it in the /etc/asound.conf

On my Neo with the I2S PCM1502 Hat it look like this:

Code: Select all

root@neo-pcm5102a:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: audiocodec [audiocodec], device 0: SUNXI-CODEC sndcodec-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: snddaudio [snddaudio], device 0: SUNXI-TDM0 snddaudio-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: sndhdmi [sndhdmi], device 0: SUNXI-HDMIAUDIO sndhdmi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0


and

Code: Select all

root@neo-pcm5102a:~# more /etc/asound.conf
pcm.!default {
    type hw
    card 1
    device 0
}

ctl.!default {
    type hw
    card 1
}


in the /etc/asound.conf configure the number of your sounddevice...

But - how did you connect your speaker on a Neo?
Via Audio-Pins? I think you have to use a amplified Speaker, because without that the Volume will be to low.

You can change the Volmue a bit with the command
alsamixer

If you got a .m3u playlist for internet-radio, the you could also play internet-radio via commandline :)

Code: Select all

Play .ogg via command line:
apt-get install vorbis-tools
ogg123 lied.ogg
ogg123 -d alsa lied.ogg

Play Internet Radio via command line:
mpg123 -@ /home/guido/absolut_128.m3u
mpg321 -@ /home/guido/absolut_128.m3u  -o alsa
mplayer -playlist -ao alsa:device=hw=1.0 /home/guido/absolut_128.m3u

cat ~/.mplayer/config
ao=alsa:device=hw=1.0

root@nanoneo:~# echo ao=alsa:device=hw=1.0 >  ~/.mplayer/config
root@nanoneo:~# more ~/.mplayer/config
ao=alsa:device=hw=1.0

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests (based on users active over the past 5 minutes)
Most users ever online was 59 on Thu Aug 30, 2018 2:59 pm

Users browsing this forum: No registered users and 3 guests