Internet radio on Orange PI

Having any microcomputer you have many options. What about Internet radio? Basically I have chosen node.js and some debian music player like mplayer. What about me presenting just few glimpses here? Maybe you would like to copy that? No problem. So follow steps here.

Prerequisities

I assume you have PC with internet and OrangePi or similiar Debian-powered microcontroller. Disclaimer: I was not testing that on other computers than OrangePiPc but I suppose there will be no problem with that.

Node and express way of web app

We want to have quickly web application.  Cool way of making it fast is using express and it’s generator which makes app in a fast.  Few commands and we have web app running, proudly speaking to us at localhost:3000: „Welcome to express”. The rest of the app what was made by me can be found on my github.

Prepare Mediaplayer

Our node radio app will be communicating via fifo file. This fifo file has to be created and mplayer is to use that file to accept commands.
[code lang=”bash”]
apt-get install mplayer
apt-get install mplayer
[/code]
Then make fifo file and run mplayer. Mplayer will use this fifo as communication channel.
[code lang=”bash”]
mkfifo /tmp/mplayer_fifo
mplayer -slave -quiet -input file=/tmp/mplayer_fifo -idle</pre>
[/code]

Radio app

On my supermicrocomputer I had to install nodejs to get it all running.
[code lang=”bash”]
apt-get update
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash –
sudo apt-get install -y nodejs
[/code]
Here we are, you can test if you can node any *.js file. Or you need not if you don’t want. Then downloading my project and running it is possible.
[code lang=”bash”]
git clone https://github.com/pishon/radiogaga.git
cd radiogaga
npm install
npm start
[/code]
Then go to localhost:3000 and you should see web interface where you can send commands to your radio.

Automatisation

It’s troublesome to do it always manually. So there is a bash script prepared that turns on radio, makes fifo file and starts node app. Having that script place him on /etc/init.d

Troubleshooting

No sound, man!

If having problems with sound in OrangePi(PC) ensure the right card is selected as default, this settings can be found at
[code lang=”bash”]
nano /etc/asound.conf
[/code]
You also can have your sound muted, than go to alsamixer and ensure your LineOut is not muted – usually it is maked as „MM” at the bottom of sound bar.  After changing settings you have to save them.
[code lang=”bash”]
sudo alsactl store
[/code]