0.0.1 • Published 10 years ago

streamr-mpc v0.0.1

Weekly downloads
5
License
-
Repository
-
Last release
10 years ago

Streamr-mpc

MPD-Client for Streamr (https://www.npmjs.org/package/streamr)

working with streamr version >0.0.9

Installation

Prerequisites

Install Raspbian on your Raspberry Pi and configure the network adapter settings

Install node.js

tested with version 0.10.26 for Raspberry Pi (ARM)

mkdir ~/node
cd ~/node
wget http://nodejs.org/dist/v0.10.26/node-v0.10.26-linux-arm-pi.tar.gz
tar -xvzf node-v0.10.26-linux-arm-pi.tar.gz

Add node.js to path variables

NODE_JS_HOME=/home/pi/node/node-v0.10.26-linux-arm-pi
PATH=$PATH:$NODE_JS_HOME/bin
sudo bash -c 'echo "PATH=$PATH:/home/pi/node/node-v0.10.26-linux-arm-pi/bin" >> /etc/profile'

Install required tools (screen & dos2unix)

sudo apt-get update
sudo apt-get install screen
sudo apt-get install dos2unix
sudo apt-get install mpd
sudo apt-get install mpc

Configure MPD

edit configuration file sudo nano /etc/mpd.conf and change following lines:

bind_to_address         "localhost"
audio_output {
        type            "alsa"
        name            "My ALSA Device"
        device          "hw:0,0"        # optional
#        format          "44100:16:2"    # optional
#        mixer_device    "default"       # optional
#        mixer_control   "PCM"           # optional
#        mixer_index     "0"             # optional
}

Install streamr-mpc

cd ~
npm install streamr-mpc

Install required submodules

cd ~/node_modules/streamr-mpc
npm install

Configure autostart

cd ~
dos2unix node_modules/streamr-mpc/scripts/*
sudo cp node_modules/streamr-mpc/scripts/streamr-mpc /etc/init.d/
sudo chmod 755 /etc/init.d/streamr-mpc
sudo update-rc.d mpd defaults
sudo update-rc.d streamr-mpc defaults

following warning can be ignored:

insserv: warning: script 'mathkernel' missing LSB tags and overrides

Hifiberry (optional)

I recommend using HifiBerry instead of built-in 3,5mm audio. If you want to use HifiBerry you have to do following steps (from http://www.hifiberry.com/products/dac/hifiberry-dac-software/)

Load necessary modules

add following entries using sudo nano /etc/modules:

snd_soc_bcm2708
snd_soc_bcm2708_i2s
bcm2708_dmaengine
snd_soc_pcm5102a
snd_soc_hifiberry_dac

Reboot and then aplay -l must print something similar:

pi@raspberrypi ~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 1: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

Remember the card number and device number and change output device in mpd config file using sudo nano /etc/mpd.conf (replace hw:0,0 with hw:yourCardNumber,yourDeviceNumber):

audio_output {
        type            "alsa"
        name            "Hifiberry"
        device          "hw:1,0"        # optional
        format          "44100:16:2"    # optional
        mixer_device    "default"       # optional
        mixer_control   "PCM"           # optional
        mixer_index     "0"             # optional
}

You also have to change the mixer to software when using hifiberry:

mixer_type                      "software"

Restart your Raspberry after configuration.