OpenWrt Forum Archive

Topic: [HowTo] Openwrt cheap Digital Stereo WiFi Internet Radio & MP3 Player

The content of this topic has been archived between 7 Apr 2018 and 5 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Wake up with your favorite radio station smile

Example: if you want to wake up every day from Monday to Friday at 07:00 AM with the internet radio playing your preferred channel,

edit the file "/etc/crontabs/root" file (if it doesn't exist create it with: touch /etc/crontabs/root) and add the following line:

00 07 * * 1-5 /usr/bin/killall madplay ;  /bin/sleep 2 ; /usr/bin/wget -O - http://streaming.radionomy.com/PassionLoveRadio | /usr/bin/madplay  -

then reboot to make it active.

(Last edited by pilovis on 16 Feb 2015, 09:09)

pilovis wrote:

Like i said before i am using this little blue usb audio card. When i listem to radio and especially when using earphones i can hear that the music is a little bit clicky, maybe some electrical interference. But i want to know if there is some other setting i can do to see if this noise goes away?

I have the same adapter but never experienced any noise or clicks sad

Is it possible to use 14.07 instead of 12.09 on mr3020 or isn't there space to do the first operations to make /overlay?

If you use a standard 14.07 release, there is not enough space on 3020 to install USB and FS drivers to make external overlay because of Luci, you should compile a version by yourself without Luci, then install USB and external overlay, then install Luci.

Are you using Wireless to connect Internet or RJ45?

I would like to make a 14.07 with the system builder but here we are arriving to my limits. First i have to learn how to compile and second i have to learn how to setup internet connection etc. once i install the compiled version.

EDIT:

For test purpose i used a Tp-Link TL-WR842ND that is one of my other Routers and installed BB 14.07 and used your step by step as before.

Surprise, the audio is now smooth like butter, the problem maybe in mr3020.

You are using the 710 that has his own power supply built in without any noise?

(Last edited by omiez on 16 Feb 2015, 23:57)

omiez wrote:

Are you using Wireless to connect Internet or RJ45?

WiFi

Strange, maybe the 710 has a better shielding i cross tested and mr3020 noisy and Tl-Wr842 no noise.

Do you think it is possible to implement volume controls on nmsradio?


EDIT:

Maurizio is it possible to give a little more buffer to mdp when i play radios from the internet?

If yes where and is it a good option or not?

(Last edited by omiez on 20 Feb 2015, 02:44)

omiez wrote:

Strange, maybe the 710 has a better shielding i cross tested and mr3020 noisy and Tl-Wr842 no noise.

Do you think it is possible to implement volume controls on nmsradio?


EDIT:

Maurizio is it possible to give a little more buffer to mdp when i play radios from the internet?

If yes where and is it a good option or not?

yes, you should edit "/etc/mpd.conf" as the following:


# MPD Internal Buffering ######################################################
#
# This setting adjusts the size of internal decoded audio buffering. Changing
# this may have undesired effects. Don't change this if you don't know what you
# are doing.
#
#audio_buffer_size              "8192"
#
# This setting controls the percentage of the buffer which is filled before
# beginning to play. Increasing this reduces the chance of audio file skipping,
# at the cost of increased time prior to audio playback.
#
buffer_before_play              "20%"
#
###############################################################################

# Resource Limitations ########################################################
#
# These settings are various limitations to prevent MPD from using too many
# resources. Generally, these settings should be minimized to prevent security
# risks, depending on the operating resources.
#
connection_timeout              "60"
max_connections         "10"
max_playlist_length             "16384"
max_command_list_size           "2048"
max_output_buffer_size          "8192"


For sure it's a good idea to increase MPD buffer size.

(Last edited by pilovis on 20 Feb 2015, 18:03)

Hello pilovis

Thanks for your post.

I wonder if this audio card from creative would work out of the box?

Creative Xfi Go Usb

(Last edited by omiez on 20 Feb 2015, 19:11)

I am searching a Router that is small and has 8mb flash minimum or more.

I think the Creative USB audio card is worth to be tetsted. The better the audio quality the more I like it.

EDIT:

Is it possible to listen the Radio that is playing on madplay through a client in windows,android or similar?

(Last edited by omiez on 22 Feb 2015, 02:53)

The Nexx WT3020 is small and cheap (but at this time, failsafe appears to be broken and I don't know how well the audio support is). Currently I can recommend the TP-Link WR710N and the D-LINK DIR-505. They both use the ar71xx with flawless USB audio support, are small, include a power plug, but are a bit more costly.

See http://github.com/probonopd/minikrebs for a custom radio firmware builder.

(Last edited by probono on 22 Feb 2015, 13:56)

probono wrote:

The Nexx WT3020 is small and cheap (but at this time, failsafe appears to be broken and I don't know how well the audio support is). Currently I can recommend the TP-Link WR710N and the D-LINK DIR-505. They both use the ar71xx with flawless USB audio support, are small, include a power plug, but are a bit more costly.

See http://github.com/probonopd/minikrebs for a custom radio firmware builder.

Thank you probono

Both are available here. the 505 and 710.

pilovis wrote:

I've just updated the How To, I added instructions for Barrier Breaker 14.07 (tested on TP-Link TL-WR710N) and corrected some typos.
smile

P.S.: I also successfully tested this audio device:

http://www.music4company.com/images/Products/0-5ce1deb0-500.jpg

please note you need to modify configuration files to adapt device name (from "PCM" to "Speaker") , check it with command "alsamixer".

please send me config mpd.conf of this device.
i can't adjust volume

https://lh4.googleusercontent.com/-syeITSqlCNo/VS4ZQmtb60I/AAAAAAAAKPA/8DJ6kGIUvxI/w978-h550-no/Screenshot%2Bfrom%2B2015-04-15%2B14%3A53%3A42.png


Thanks

(Last edited by hoatienii on 15 Apr 2015, 08:55)

I've just tested this Infrared USB Remote Controller device with my OpenWRT Internet MP3/Radio and it works very well.
I paid it 10 Euro.
No drivers are needed, just plug in and use it (with Triggerhappy).

By using this device you can remote control your OpenWRT radio with a lot of functions, simply use Triggerhappy and configure some or all buttons of this remote controller with different functions of your Digital Radio smile

http://img.dxcdn.com/productimages/sku_26368_1.jpg

Example of some triggerhappy commands configuration for this remote controller (please read comments): 

file /etc/triggerhappy/triggers.d/example.conf

#
# NOTE: do not press the red power button, if you do it, the event code names will change and a restart is needed to go back to default.
# I would suggest you to remove or cut this button
#
#
## control an mpd instance - MP3/Radio Player
#
# start playing
KEY_PLAYPAUSE 1 /usr/bin/killall madplay mpd ; sleep 2 ; /usr/bin/mpd ; /usr/bin/mpc listall | /usr/bin/mpc add ; /usr/bin/mpc play
# jump to next song
KEY_NEXTSONG 1 /usr/bin/mpc next
# jump to previous song
KEY_PREVIOUSSONG 1 /usr/bin/mpc prev
#
## Audio volume controls
## IMPORTANT NOTE: You might need to change "Speaker" device name to "PCM" if you use a different USB sound card.
#
# increase volume
KEY_VOLUMEUP 1 /usr/bin/amixer -q set Speaker 1%+
# decrease volume
KEY_VOLUMEDOWN 1 /usr/bin/amixer -q set Speaker 1%-
# Stop playing
KEY_STOPCD 1 /usr/bin/killall madplay mpd
# set audio volume to minimum audible level
KEY_MIN_INTERESTING 1 amixer -q set Speaker 4
#
## Control Madplay Internet Radio by selecting four different stations with the four ABCD coloured buttons: green, orange, blue and yellow.
# note: event value generated by these four coloured buttons is 0 when pressed
#
# Obviously, more stations can be associated to other buttons, just check event names and values with "thd --dump /dev/input/event*" command
#
KEY_F1 0 /usr/bin/killall madplay ; /usr/bin/killall mpd ; sleep 2 ; /usr/bin/wget -O - http://streaming.radionomy.com/PassionLoveRadio | /usr/bin/madplay --replay-gain=audiophile --attenuate=-4 - &
#
KEY_F2 0 /usr/bin/killall madplay ; /usr/bin/killall mpd ; sleep 2 ; /usr/bin/wget -O - http://streaming.radionomy.com/CristalRelax | /usr/bin/madplay --replay-gain=audiophile --attenuate=-4 - &
#
KEY_F3 0 /usr/bin/killall madplay ; /usr/bin/killall mpd ; sleep 2 ; /usr/bin/wget -O - http://streaming.radionomy.com/Radio-Quelite | /usr/bin/madplay --replay-gain=audiophile --attenuate=-4 - &
#
KEY_F4 0 /usr/bin/killall madplay ; /usr/bin/killall mpd ; sleep 2 ; /usr/bin/wget -O - http://radionova128.media.vistatec.ie:80 | /usr/bin/madplay --replay-gain=audiophile --attenuate=-4 - &

(Last edited by pilovis on 1 May 2015, 21:16)

If you want to record Internet Radio streams (in MP3 format) to play songs in offline mode later with Madplay, you just need to install streamripper program.

opkg update
opkg install streamripper

"cd" to the directory you want to use for saving your MP3s

example:
cd /mnt/external_flash

note: don't save MP3s into the internal router flash memory otherwise you will fill it in a second wink

then use this simple command:
/usr/bin/streamripper stream-url

example:
/usr/bin/streamripper http://stream.srg-ssr.ch/m/rsj/mp3_128

Note: you won't hear any audio during ripping.
To stop ripping press "Ctrl+c" otherwise Streamripper will run indefinitely.
If you want to limit the total space occupied by ripped MP3s, you can limit streamripper using "-M megabytes" option to be added to the end of the above command line, or to limit streamripper in time by fixing a maximum time for it to run, you can use "-l seconds" option.

[Optional] You may also want to fix MP3s variable bit rate with Vbrfix:
http://tuxtweaks.com/2012/03/fixing-var … th-vbrfix/


To remove spaces from MP3 filenames in current directory and convert them to underscores (not recursive):
for f in *\ *; do mv "$f" "${f// /_}"; done


Single line command (not recursive) to play in sequence all .mp3 files present in a directory using Madplay:
/usr/bin/find /mnt/external_flash -name \*[mM][Pp]3 | /usr/bin/awk '{print "\""$0"\""}' | /usr/bin/xargs /usr/bin/madplay - &

or if you prefere playing them randomly:
/usr/bin/find /mnt/external_flash -name \*[mM][Pp]3 | /usr/bin/awk '{print "\""$0"\""}' | /usr/bin/xargs /usr/bin/madplay -z - &

(Last edited by pilovis on 18 May 2015, 20:28)

Hello pilovis!
i made my first radio like it describt in http://mightyohm.com/blog/2008/10/build … roduction/
then i trying  http://en.code-bude.net/2013/11/05/radi … -webradio/  but i more electronics engeneer then programming and author dont give the whole information about his progect, dont answer  a letter. You progect very interesting for me, so i have some question for you:
1.That do you think about web interface like radioduinowrt
2. i install only mpd and mpc , can i  control for play/pause/record from web inerface?
thanks
Andy

- First question.

Look here:

https://github.com/codebude/RadioduinoWRT

- Second question.

Look here, you'll find some usefull ideas:

http://www.linuxquestions.org/questions … 175474123/

http://www.musicpd.org/doc/protocol/pla … mands.html

http://www.linuxquestions.org/questions … pd-268273/

https://bbs.archlinux.org/viewtopic.php?id=42369

http://stackoverflow.com/questions/1128 … or-stopped

http://mpd.wikia.com/wiki/Clients

(Last edited by pilovis on 18 Aug 2015, 10:01)

My homebuilt digital vacuum tube HiFi radios smile

WiFi Internet vacuum tube radios with OpenWRT (the openwrt router is hidden inside the cabinets):

- 1) Stereo 8+8 W HiFi internet WiFi radio and MP3 player (old style radio)
http://www.lovisolo.com/valvole/P1080046.JPG


- 2) Stereo 1+1 W (HeadPhones) HiFi internet Wifi radio and MP3 player (old fashion)
http://www.lovisolo.com/valvole/ampli5.jpg


- 3) Digital satellite vacuum tube radio (prototype):

http://www.lovisolo.com/valvole/P1080043.JPG


Electrical schematics (in case anyone is interested in replicating them):

http://www.lovisolo.com/valvole/807b.jpg


http://www.lovisolo.com/valvole/per-cuffia.jpg


Low voltage 1 +1 W stereo vacuum tube amplifier
http://www.lovisolo.com/valvole/6sl7-pl504.jpg

(Last edited by pilovis on 6 Sep 2015, 20:51)

Hi everyone, I have question.
Because I'm not good in programming I need code to stop madplayer when I press button on the keyboard.
I'm trying write code, it's my exmple:

KEY_VOLUMEUP 1 kill -9 madplay
But isn't workink.

Finally i want to have:
I press button 1, first time - radio play
I hold button 1 - radio stop
I press button 2 - volume up
I press button 3 - volume down

Can I count on your help?

(Last edited by tygrysss on 15 Sep 2015, 18:49)

OK! It's work!
KEY_BACKSPACE 1 /usr/bin/killall madplay   - it's stop internet radio very well!
But How can resume playing from the place where they were staying?
And what witch volume?

Update...
I'm trying and all works. But i have last problem.
When i use option number 2 (held) - router do nothing.
I add logger - Does not work.
Whether this option works?

When I do: opkg install kmod-hid kmod-hid-generic it says:
Unknown package 'kmod-hid-generic'.
Collected errors:
* opkg_install_cmd: Cannot install package kmod-hid-generic.

Also the same when I try to search this package unavailable packages at 192.168.1.1 GUI Webpage.


And when I do that: thd --dump /dev/input/event* it gives me this:Error opening '/dev/input/event*': No such file or directory

Am I wrong or missing something?

Thanks.

NOTE: I only have the USB Thumbdrive prepared as extf4 swap and the MR3020.  I don't have a USB and Keyboard plugged.

Pilovis

What about New Version of Openwrt? Is it possible to use the new version to install the Radio?

Thank you in advance.

Hi!  Is there any way to get this working on a SoundMate M1 (nearly the same as the Airmusic NW11)?

There's a whole topic about it here with hardware details etc.  Some of it is a little over my head, though I've been working with all kinds of systems for over 20 years and I'm sure I can follow instructions and learn!

It has OpenWRT with a very minimal BusyBox.  Apparently it has no make, no opkg, and as far as I can tell, no way to compile anything!

But it's an adorable convenient form factor and has built-in SPDIF, and you can't beat the $17 price (amazon).

Any help greatly appreciated.  Thanks!

(Last edited by therentabrain on 19 Nov 2015, 00:31)

omiez wrote:

Pilovis

What about New Version of Openwrt? Is it possible to use the new version to install the Radio?

Thank you in advance.

You can use Attitude Adjustment or Barrier Breaker, don't use Chaos Calmer, it sucks, there are too many packages missing.

Script to display the streaming URL that madplay is currently playing  (usefull when you use a large selection of streaming URL to be played):


#!/bin/sh
# you need to use the full path commands when playing a streaming URL
# example:
# /usr/bin/wget -O - http://streaming.radionomy.com/PassionLoveRadio | /usr/bin/madplay  -
#
a=$(/bin/ps w | /bin/grep -v grep  | /bin/grep wget)
b=${a:45:65}
/bin/echo "Now playing:" $b

(Last edited by pilovis on 4 Jan 2016, 13:00)

After more than two years of intensive testing about Openwrt with many routers, I can say that (in my opinion) Openwrt is very unreliable: too many crashes, bad USB support, fake bluetooth support, very unstable usb "overlay".
This the end word at my Openwrt  story, from now on I will move to Raspberry devices.
sad