andihas
Posts: 10
Joined: Thu May 17, 2012 5:31 pm

mpd Web-Radio

Thu May 17, 2012 6:05 pm

Hi everybody!

I've just got my Rasperry Pi!
I played around a bit with the debian6-19-04-2012 distribution.

Thirst thing I want to do is to get mpd working.

So I did this:
System update / upgrade:

Code: Select all

sudo apt-get update
sudo apt-get upgrade
Installed mpd and mpc:

Code: Select all

sudo apt-get install pmd mpc
next i load the alpha audio treiber:

Code: Select all

sudo modprobe snd_bcm2835
changed mpd.conf

Code: Select all

sudo nano /etc/mpd.conf
and restart mpd:

Code: Select all

sudo /etc/init.d/mpd restart
Now I can connect to the mpd with qmpd form my ubuntu linux machine.
I also can play a WebRadio stream.

I checked MPD with TOP.
MPD takes about 98 % of CPU power. That is not okay!!! :cry:

I have also tried the OSS but also the same problem.

Has anybody an idea what is wrong? Or where is the problem? Or can tell me a place where I can find a solution for my problem.


P.S. Sorry for my English.

Nick Scott
Posts: 13
Joined: Fri Oct 07, 2011 11:17 pm
Location: Christchurch, New Zealand
Contact: Website

Re: mpd Web-Radio

Fri May 18, 2012 12:51 am

I presume you have HTTP streaming enabled at the moment. From what I can tell, it re-encodes the MP3's when doing that. Can you try disabling HTTP streaming, restart MPD, and see what the CPU usage is?

andihas
Posts: 10
Joined: Thu May 17, 2012 5:31 pm

Re: mpd Web-Radio

Fri May 18, 2012 5:39 pm

Hi Nick Scott,

No, HTTP streaming is not enabled. I checked it. THX

I had tested different Radio streams, mp3 and ogg files. The CPU load depends on the file or stream codec I think.

Web-stream MPEG AAC Audio (mp4a) --> CPU load 98%
Web-stream MPEG Audio layer 1/2/3(mpga) --> CPU load 10%
OGG Audio files --> CPU load 8%

Andi

andihas
Posts: 10
Joined: Thu May 17, 2012 5:31 pm

Re: mpd Web-Radio

Fri May 18, 2012 9:14 pm

Here are some images of the Display for my mpd-WIFI-Radio.
LCD_1.jpg
LCD_1.jpg (49.03 KiB) Viewed 85208 times
LCD_3.jpg
LCD_3.jpg (53 KiB) Viewed 85208 times
LCD_2.jpg
LCD_2.jpg (60.73 KiB) Viewed 85208 times

User avatar
paaland
Posts: 71
Joined: Mon Mar 12, 2012 2:30 pm
Location: Norway
Contact: Website

Re: mpd Web-Radio

Fri May 18, 2012 10:02 pm

I made a small web-radio solution using mdp and php via lighthttpd. I only have mp3 streams that I listen to and the CPU load is not a problem for me.

But I've got other problems.
1. After changeing station 3-4 times mdp stops responding. Commands sendt via mpc times out. If I try to restart mdp all I get is:

Code: Select all

$ /etc/init.d/mpd restart
Stopping Music Player Daemon: mpd.
Starting Music Player Daemon: mpdlisten: bind to 127.0.0.1:6600 failed: Address already in use (continuing any way, because at least one address is bound)
2. There are issues with volume (using 3.5mm jack outout, not hdmi). Seems I can only choose between 35% and 100%. Anything else and volume reports wrong (like 235%) and no sound is audible.

Anyone else have those problems?
Dragon 32>BBC Model B>PC>PC>PC>PC>Raspberry PI (circle complete)

andihas
Posts: 10
Joined: Thu May 17, 2012 5:31 pm

Re: mpd Web-Radio

Sat May 19, 2012 10:18 am

Hi paaland,

I also had the problem your write in point 1. Sometimes port 6600 is blocked when your want to restart mpd.

In the /etc/mpd.conf I use the Software Volume control not the hardware control. I had also problems with the hardware control.

There is also a little noise when your switch to the next song. :?
Maybe it's because the sound driver is Beta.

Andi

Nick Scott
Posts: 13
Joined: Fri Oct 07, 2011 11:17 pm
Location: Christchurch, New Zealand
Contact: Website

Re: mpd Web-Radio

Mon May 21, 2012 7:51 pm

Ok, can't help you on the CPU usage then, but as to the port being blocked, I have seen that on my install at home (during setup, while restarting the service a few times). It would seem to be an MPD bug, where it doesn't correctly free the port when the service stops.

Jospfh
Posts: 4
Joined: Wed May 30, 2012 6:30 am

Re: mpd Web-Radio

Wed May 30, 2012 6:34 am

andihas wrote: changed mpd.conf
Can you post your mpd.conf? Especially the part where you configured the audio output and your mixer settings.

Thanks in advance!

andihas
Posts: 10
Joined: Thu May 17, 2012 5:31 pm

Re: mpd Web-Radio

Wed May 30, 2012 9:08 pm

Hi,
Okay, I added my mpd.conf and the part with the audio settings:

Code: Select all

audio_output {
	type		"alsa"
	name		"My ALSA Device"
	device		"hw:0,0"	# optional
#   	auto_resample	"no"
#   	use_mmap	"yes"
#	format		"44100:16:2"	# optional
#	mixer_device	"default"	# optional
#	mixer_control	"PCM"		# optional
#	mixer_index	"1"		# optional
}
and the mixer:

Code: Select all

# Volume control mixer ########################################################
#
# These are the global volume control settings. By default, this setting will
# be detected to the available audio output device, with preference going to 
# hardware mixing. Hardware and software mixers for individual audio_output
# sections cannot yet be mixed.
#
# An example for controlling an ALSA, OSS or Pulseaudio mixer; If this
# setting is used other sound applications will be affected by the volume
# being controlled by MPD.
#
#mixer_type			"hardware"
#
# An example for controlling all mixers through software. This will control
# all controls, even if the mixer is not supported by the device and will not
# affect any other sound producing applications.
#
mixer_type			"software"
#
# This example will not allow MPD to touch the mixer at all and will disable
# all volume controls.
#
#mixer_type			"disabled"
#
###############################################################################
Maybe there is a better mpd.conf ! Let me know if your have a better solution.

Don't forget to load the alpha audio driver (You have to load after restarting your pi):

Code: Select all

sudo modprobe snd_bcm2835
or,
Add the following command to the end of your /etc/rc.local before the line "exit 0" to load the driver after a restart.

Code: Select all

modprobe snd_bcm2835
Attachments
mpd.conf.tar.gz
(4.08 KiB) Downloaded 1014 times

Jospfh
Posts: 4
Joined: Wed May 30, 2012 6:30 am

Re: mpd Web-Radio

Sun Jun 03, 2012 7:56 am

Thanks for that! I did not have the software mixer enabled which made the mixer go haywire....

I'm now working to get mp3 output through http working. That would make my current mpd server obsolete :)
I already recompiled mpd with zerozonf enabled, that seems to work well.

Sn0opy
Posts: 2
Joined: Sun Jun 03, 2012 8:45 pm

Re: mpd Web-Radio

Sun Jun 03, 2012 9:07 pm

andihas, could you explain, how you display the informations on the display? I see a beagle board or something like this, which is connected to your lcd screen. I've got an Arduino, which should be also able to do the job.

So, how do you get the informations over USB?

andihas
Posts: 10
Joined: Thu May 17, 2012 5:31 pm

Re: mpd Web-Radio

Mon Jun 04, 2012 8:04 pm

For the communication with the LCD Module (4x20 HD44780-Controller) I use the "USB-4-all" from this Site:
http://www.sprut.de/electronic/pic/proj ... sb4all.htm (German only).

It's not the best way. But for my first test it is okay.
Your also can use a Arduino Board to control the LCD or maybe the IO's form the Raspberry.

I use the program mpc client to control the mpd daemon.
With mpc it is very easy to control the mpd (see "man mpc").

You only have to write a script that read the output form a mpc command and write it to the LCD-Board.
Here is a similar project:
http://mightyohm.com/blog/2008/10/build ... roduction/

Sn0opy
Posts: 2
Joined: Sun Jun 03, 2012 8:45 pm

Re: mpd Web-Radio

Mon Jun 04, 2012 8:20 pm

Currently getting my Arduino to work with serial data sent via USB. Thanks for the info.

MrMartini83
Posts: 2
Joined: Wed Jun 13, 2012 6:57 am
Location: Austria

Re: mpd Web-Radio

Tue Jun 19, 2012 11:06 am

hi!
just a question. I readed the article, but I'm a linux beginner, so it's a bit "much" informations for me.
I'm currently searching for a meaningful use. First, I thought I'll build a youtube player, but I found out, that there is no flash an the discussed alternatives should not be that kind of easy to use, so that everyone in my family would be able to use it...
Next I thought a WebRadio would be nice, but now I'm not sure if this "mpd" will provide those functions.
Maybe one of you can answer if this will provide the following functions:

- Audio-Output by HDMI or ANALOG on the board?
- Connect to "WebRadio-Stations" (is there a list of stations?)
- Is there a "beginner" user interface for the debian desktop?

My final goal would be "more linux expiriences" than now, and a tool, which can play webradio stations, maybe also a arduino board with IR control and a small display.

I would be also disposed to write a simple "step-by-step" how to for starters, because I'm a great fan of really easy to use guide lines. - Maybe a I have to ask someone here in the forum to get it up running first...

Tanks, Danke und best regards from Austria,

Martin

andihas
Posts: 10
Joined: Thu May 17, 2012 5:31 pm

Re: mpd Web-Radio

Tue Jun 19, 2012 2:08 pm

Hi,

mpd is just a Music Player Daemon. (server - runs in the background on the pi)
Info: http://mpd.wikia.com/wiki/What_MPD_Is_and_Is_Not

Your can choose the Audio output.
http://elinux.org/R-Pi_Troubleshooting

You can add your favourite radio stream to an Playlist. But there is no station list in the mpd.
Some clients have a station list. (Ario)

There are a lots of clients (user interface) out there. For console, android, apple, linux, and win.

best regards, "hoffe ich konnte helfen" :-)
Andi

felixfurtak
Posts: 47
Joined: Wed Nov 16, 2011 10:41 am

Re: mpd Web-Radio

Thu Jun 21, 2012 5:45 am

Yes, I have mpd up and running on the pi and have successfully used it to stream web radio.
Setting up the backend daemon is reasonably easy and you can then choose a number of different front ends. I use client175 which is a web browser interface so the pi does not need to be physically connected to a monitor. I can control it directly from my laptop and phone.

The only problem that I have at the moment is the buggy nature of the bcm sound module which emits some strange white noise a the beginning of a song (when using the analogue output, hdmi audio seems to work fine)

paat
Posts: 1
Joined: Thu Jun 21, 2012 6:01 pm

Re: mpd Web-Radio

Thu Jun 21, 2012 6:15 pm

Hi guys,

does anyone know how to get the build-in http-streaming of mpd to work? I disabled the standard ALSA output and it won't work :/. With http-streaming activated mpd doesn't even start.

felixfurtak
Posts: 47
Joined: Wed Nov 16, 2011 10:41 am

Re: mpd Web-Radio

Sun Jul 01, 2012 12:28 pm

@paat. I managed to stream music from mpd to a remote client (is this what you mean?), but it is not 100% reliable. I compiled the git version 0.17 from source and that worked slightly better, for me but I think the Pi may be struggling to re-compress audio stream on the fly.

pimseb
Posts: 7
Joined: Mon Jul 02, 2012 8:30 pm

Re: mpd Web-Radio

Mon Jul 02, 2012 8:32 pm

andihas > could you tell me what kind of LCD screen is that ?
I'd like to install a raspberry in my car with a 3G usb dongle and that kind of little screen to listen to webradios. Maybe you can help :)
thx

andihas
Posts: 10
Joined: Thu May 17, 2012 5:31 pm

Re: mpd Web-Radio

Tue Jul 03, 2012 8:11 pm

@ pimseb

For my test I used a 20x4 character LCD with an HD44780 Controller. There are many displays with this controller. Sometimes the controller is different but the protocol is the same (SED1278 from Epson). More infos to the LCD-Displays in german here -> http://www.sprut.de/electronic/lcd/index.htm

I used a USB controller for the LCD but all your really need is 8 I/O's form the raspberrypi and the right software.

A friend of mine had done this and use the LCD lib from Arduino http://arduino.cc/en/Reference/LiquidCr ... LCDLibrary
Maybe he wants to share the code :-)

max00
Posts: 2
Joined: Sat Jul 07, 2012 9:39 am
Location: Austria

Re: mpd Web-Radio

Sat Jul 07, 2012 2:14 pm

sure i want to share my code, you can find it here:
https://bitbucket.org/marcoster/rpi_lcd

It's really easy to use (for normal purpose you'll only need to look through the main.c"

greets
Marco
There are only 10 types of people in the world:
Those who understand binary, and those who don't!

pimseb
Posts: 7
Joined: Mon Jul 02, 2012 8:30 pm

Re: mpd Web-Radio

Sun Jul 08, 2012 10:08 am

This is gonna be very hard for me as I'm not a coder at all :)
Let me explain what I'd like to do.
I've ordered a raspberry pi but I haven't received it yet.
I'd like to plug a 3G USB stick on it and put the small computer in my car. The goal is to receive webradios in my car.
The sound would go out from the jack and the device would have a small remote control (wired or not if possible) to change radios.
If it could have a little lcd screen to show the radio name and/or title of song currently played, it would be even better.
The player should decode mp3 streams and aac+. Wma optionally
Do you think this config is possible ?
If someone is interested to build that and help me I would love him/her :)

andihas
Posts: 10
Joined: Thu May 17, 2012 5:31 pm

Re: mpd Web-Radio

Tue Jul 10, 2012 6:24 pm

Hi pimseb,

3G USB, LCD, AUDIO WEB-Radio, remote control ..... all is possible with the raspberrypi. ;)
But I don't think someone will build "YOUR" project.
Plan your project step by step and and try coding. The Forum is full of helpful informations.

You also do not need a raspberrypi to start the project. Start with a PC with linux like Ubuntu or Debian. Install mpd , mpc and try them.

regards andihas

Cubitus
Posts: 1
Joined: Sat Sep 27, 2014 10:07 am

Re: mpd Web-Radio

Sat Sep 27, 2014 10:11 am

sudo apt-get install pmd mpc
-> sudo apt-get install mpd mpc

This post helped me in getting along, so thanks and I just wanted to mention the typo :D

Return to “Media centres”

Who is online

Users browsing this forum: No registered users and 13 guests