OpenWRT - Cheap MP3 player & Wi-Fi Internet stereo radio

sezione dedicata ai sistemi operativi alternativi Open Source

Re: OpenWRT - Cheap Wi-Fi Internet radio with TP-Link TL-MR

Messaggio da leggereda root » 20/10/2014, 19:57

Addendum:

in case you use Tp-Link TL-WR710N or any other router that has at least 8 MB of flash, and you don't want or can't use an external HDD overlay, but you want to add the MP3 player functionality to your OpenWrt Internet Radio, you can also use "madplay" for this function.

This "single line command" searches for .mp3 files in "/root" directory (or anywhere else if you adapt the path) and plays mp3 files in sequence:

find /root/ -name \*[mM][Pp]3 | awk '{print "\""$0"\""}' | xargs madplay

The bad news is there aren't the "prev" and "next" functions that you can have with mpd/mpc,
the good news is that madplay uses much less resources than mpd/mpc.
Maurizio
Avatar utente
root
Amministratore
 
Messaggi: 394
Iscritto il: 10/04/2012, 10:55
Località: Turin

Re: OpenWRT - Cheap Wi-Fi Internet radio with TP-Link TL-MR

Messaggio da leggereda root » 21/10/2014, 18:42

-----------------------------
Another extra-feature :)
-----------------------------

1) connect anytime an USB flash drive, fat32 formatted, with a lot of mp3 inside
2) press a "key" to start playing all mp3 in sequence
3) listen ... :D

Note: I choosed Fat32 to have full Windows/Mac/Linux compatibility and to avoid any file permission problems I could have with EXT or NTFS partitions (FAT32 formatted drives do not support file permissions ;) ).


Instructions:

opkg update
opkg install kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1


create and edit the "/root/mount.sh" file:

nano /root/mount.sh

mkdir -p /mnt/music
mount -t vfat /dev/sdb1 /mnt/music
find /mnt/music -name \*[mM][Pp]3 | awk '{print "\""$0"\""}' | xargs madplay


Ctrl+x to save

chmod 777 /root/mount.sh

than attach the following "single command line MP3 player" to a key:

/bin/sh /root/mount.sh - &

triggerhappy configuration example:

KEY_BACKSPACE 1 /usr/bin/killall madplay ; /usr/bin/killall mpd ; sleep 2 ; /bin/sh /root/mount.sh - &

Note: "/usr/bin/killall madplay ; /usr/bin/killall mpd ; sleep 2" is needed to stop all running instances of madplay or mpd (if any) before starting the new madplay istance.
Maurizio
Avatar utente
root
Amministratore
 
Messaggi: 394
Iscritto il: 10/04/2012, 10:55
Località: Turin

Re: OpenWRT - Cheap Wi-Fi Internet radio with TP-Link TL-MR

Messaggio da leggereda root » 21/10/2014, 22:37

------------------------
Audio normalization
------------------------
I noticed that Internet Streaming Radio Stations use different audio volume levels one from each other, some of them have audio volume too high, some others too low, in consequence of this I have to adjust volume level too much frequently, same for MP3 files. :(

So, I came up with the idea to normalize the audio level on the fly :)

Actually it is quite simple, for madplay it is enough to add two options in the command line, for MPD/MPC it is just a matter to enable an option in the config file.

- Example to enable audio normalization for madplay:

/usr/bin/wget -O - http://205.164.62.15:9010/ | /usr/bin/madplay --replay-gain=audiophile --attenuate=-0 - &

note: you can also do some fine tuning for each preset station by using "attenuate" or "amplify" options:

ex:
/usr/bin/wget -O - http://205.164.62.15:9010/ | /usr/bin/madplay --replay-gain=audiophile --attenuate=-2 - &

/usr/bin/wget -O - http://205.164.62.15:9010/ | /usr/bin/madplay --replay-gain=audiophile --amplify=+1 - &

just to be safe:
opkg update
opkg install lame


- Enable normalization for MPD/MPC:

nano /etc/mpd.conf

change the following line:
#volume_normalization "no"

to:
volume_normalization "yes"

--------------------------

Note: Audio normalization is the application of a constant amount of gain to an audio recording to bring the average or peak amplitude to a target level.
The standard used to normalize audio is "ReplayGain.
ReplayGain is a proposed standard published by David Robinson in 2001 to measure the perceived loudness of audio in computer audio formats such as MP3 and Ogg Vorbis. It allows players to normalize loudness for individual tracks or albums. This avoids the common problem of having manually to adjust volume levels between tracks when playing audio files from albums that have been mastered at different loudness levels"
Maurizio
Avatar utente
root
Amministratore
 
Messaggi: 394
Iscritto il: 10/04/2012, 10:55
Località: Turin

Re: OpenWRT - Cheap Wi-Fi Internet radio with TP-Link TL-MR

Messaggio da leggereda root » 29/10/2014, 14:40

You'll find my "ready to use" configuration files here:

http://www.lovisolo.com/openwrt
Maurizio
Avatar utente
root
Amministratore
 
Messaggi: 394
Iscritto il: 10/04/2012, 10:55
Località: Turin

Re: OpenWRT - Cheap Wi-Fi Internet radio with TP-Link TL-MR

Messaggio da leggereda root » 29/10/2014, 14:41

Another discovery :)

Up to now to increase or decrease the audio volume you should press the + or - buttons several times, for each press you can change about 1% of it, but if you keep the buttons pressed nothing happens.

To increase or decrease audio volume continuously by keeping pressed the + and - keys you need to add the following two lines to the triggerhappy configuration file (/etc/triggerhappy/triggers.d/example.conf):

KEY_KPPLUS 2 /usr/bin/amixer -q set Speaker 1dB+
KEY_KPMINUS 2 /usr/bin/amixer -q set Speaker 1dB-


this is the complete section of audio volume controls:

# set volume control to minumun addible level
KEY_BACKSPACE 1 /usr/bin/amixer -q set Speaker 4
#
# Volume controls
KEY_KPMINUS 1 /usr/bin/amixer -q set Speaker 1%-
KEY_KPPLUS 1 /usr/bin/amixer -q set Speaker 1%+
KEY_KPPLUS 2 /usr/bin/amixer -q set Speaker 1dB+
KEY_KPMINUS 2 /usr/bin/amixer -q set Speaker 1dB-
#
# Stop playing
KEY_KPENTER 1 /usr/bin/killall madplay ; /usr/bin/killall mpd


Note: A value of KEY_xxxxx 1 corresponds to pressing a key, while 2 is generated by holding it; releasing it yields a value of 0.
By using of set 1% value, instead of 2% as per my previous posts, allows a more granular control over the audio volume level.

You might need to change "Speaker" device name if you use a different USB sound card.
Maurizio
Avatar utente
root
Amministratore
 
Messaggi: 394
Iscritto il: 10/04/2012, 10:55
Località: Turin

Re: OpenWRT - Cheap Wi-Fi Internet radio with TP-Link TL-MR

Messaggio da leggereda root » 29/10/2014, 14:41

Summarizing:

this audio device needs "Speaker" device name:

Immagine

this other needs "PCM" device name:

Immagine

Other USB audio devices might need different device name (check it with command alsamixer under "Item:.....")

A good list of USB-audio adapters known to work with OpenWrt/mpd:
https://mightyohm.com/forum/viewtopic.php?f=2&t=232
Maurizio
Avatar utente
root
Amministratore
 
Messaggi: 394
Iscritto il: 10/04/2012, 10:55
Località: Turin

Re: OpenWRT - Cheap Wi-Fi Internet radio with TP-Link TL-MR

Messaggio da leggereda root » 29/10/2014, 15:09

[BUG - OpenWrt 12.09 'Attitude Adjustment']

I wanted to disable "watchdog" because the router rebooted too frequently.
I tried to "killall watchdog" or execute the "/etc/init.d/watchdog stop" in command line, but it doesn't work.
Also /etc/init.d/watchdog disable had no effect, after reboot watchdog were still running.

Solution:
-----------

Comment out the following code in '/etc/hotplug2.rules':

#DEVICENAME == watchdog {
# exec /sbin/watchdog -t 5 /dev/watchdog
# next-event
#}

it restores '/etc/init.d/watchdog enable|disable' functionality.
Watchdog service may be enabled or disabled accordingly.
Maurizio
Avatar utente
root
Amministratore
 
Messaggi: 394
Iscritto il: 10/04/2012, 10:55
Località: Turin

Mount an external USB CD-ROM to play MP3 files stored on a C

Messaggio da leggereda root » 10/11/2014, 14:29

New feature added to the WiFi Internet Radio & MP3 Player :)

-----------------------------------------------------------------------------
Mount an external USB CD-ROM to play MP3 files stored on a CD
-----------------------------------------------------------------------------

opkg update
opkg install kmod-scsi-cdrom
opkg install kmod-scsi-core
opkg install kmod-scsi-generic
opkg install kmod-fs-isofs


Reboot the router

Connect and mount the USB CD-ROM (ISO9660 filesystem):

mkdir -p /mnt/cdrom
mount /dev/sr0 /mnt/cdrom


Command to play in sequence all .mp3 files present on a CD:

find /mnt/cdrom -name \*[mM][Pp]3 | awk '{print "\""$0"\""}' | xargs madplay - &

Immagine

I'm also trying to add Audio CD playback capability ...

opkg install http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/oldpackages/cdparanoia_10.2-1_ar71xx.ipk

cdparanoia -Z -q -w "1" - | aplay &
it works, but choppy audio playback (buffer underrun) :(

cdparanoia -Z -q -w "1" - | buffer | aplay &
it would be perfect, but "buffer" program is not implemented in openwrt :(

cdparanoia -Z -q -w "1" tmp.wav ; aplay tmp.wav &
it works, audio OK, but needs to create a temporary file (about 30-40 MB), also playing won't start until the temporary file is fully created (about 20-30 seconds total delay) :o

note: "1" = track 1, "2" = track 2, etc.
Maurizio
Avatar utente
root
Amministratore
 
Messaggi: 394
Iscritto il: 10/04/2012, 10:55
Località: Turin

Re: OpenWRT - Cheap Wi-Fi Internet radio with TP-Link TL-MR

Messaggio da leggereda root » 30/12/2014, 23:14

Maurizio
Avatar utente
root
Amministratore
 
Messaggi: 394
Iscritto il: 10/04/2012, 10:55
Località: Turin

music/audio player for Openwrt

Messaggio da leggereda root » 31/01/2015, 0:48

Another interesting music/audio player for Openwrt is "cmus" with a little nice console "graphic" interface.

opkg update
opkg install cmus


optional plugins:
opkg install cmus-plugin-oss
opkg install cmus-plugin-pulses


to lauch it:

cmus

note:
press 5 for directory list
:quit to exit

Tutorial:
https://github.com/cmus/cmus/blob/master/Doc/cmus-tutorial.txt

Official site:
http://cmus.github.io/
Maurizio
Avatar utente
root
Amministratore
 
Messaggi: 394
Iscritto il: 10/04/2012, 10:55
Località: Turin

PrecedenteProssimo

Torna a OpenWRT

Chi c’è in linea

Visitano il forum: Nessuno e 1 ospite

cron