User Tools

Site Tools


raspberry-pi:music_player

This is an old revision of the document!


Music Player

Software install

Download Raspberry OS lite (Buster)
https://www.raspberrypi.org/downloads/raspberry-pi-os
Then flash using Balena Etcher or similar
https://www.balena.io/etcher/

Note: /etc/init.d/resize2fs_once is triggered on first boot, then removes itself.

WIFI config:
create wpa_supplicant.conf in /boot

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=<Insert 2 letter ISO 3166-1 country code here>

network={
 ssid="<Name of your wireless LAN>"
 psk="<Password for your wireless LAN>"
}

Enable SSH Server:
create empty file ssh in boot folder

/boot/config.txt

#Set GPU memory to lowest value
gpu_mem=16

#Disable boot splash screen
disable_splash=1

#Configure Pimoroni Pirate audio DAC
dtoverlay=hifiberry-dac
gpio=25=op,dh

#Enable SPI for display of Pimoroni Pirate Audio
dtparam=spi=on

#Switch off onboard audio
dtparam=audio=off

# Turn off HDMI?
#hdmi_blanking=0 # HDMI Output will be blank when DPMS is triggered
#hdmi_blanking=1 # HDMI Output will be disabled when DPMS is triggered
hdmi_blanking=2 # HDMI Output will be disabled on boot and can be enabled using the above listed commands.

[pi0]
# Disable the ACT LED on the Pi Zero only
dtparam=act_led_trigger=none
dtparam=act_led_activelow=on

Disable HDMI port on boot (power saving during headless operation)
/usr/bin/tvservice -o (-p to re-enable)
Add the line to /etc/rc.local to disable HDMI on boot.

Security. Default user pi with password raspberry
https://www.raspberrypi.org/documentation/configuration/security.md

Install git if not already installed:

sudo apt-get install git

# https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-pirate-audio

#This will install python3 pip,wheel and pirate audio modules
#Then add mopidy apt sources and install mopidy including mopidy-spotify
#Then install mopidy-iris web interface and Pirate Audio plugins
#And create system service to autostart mopidy

cd /usr/src
sudo git clone https://github.com/pimoroni/pirate-audio
cd pirate-audio/mopidy
sudo ./install.sh

Alternative web interface:
https://github.com/pimusicbox/mopidy-musicbox-webclient

#Removing mopidy spotify plugin and bluetooth support

sudo apt-get purge mopidy-spotify
sudo apt-get purge bluez bluez-firmware
sudo apt autoremove

#Display will show ip and default mopidy port :6680 for web interface. Iris web client needs to be selected

#Edit Mopidy config
sudo vi /etc/mopidy/mopidy.conf

#file section change
media_dirs = 
    /media/music
    /media/network

#add to http section
enabled = true
#port = 80 #issue with mopidy user and ports <1024
zeroconf = Mopidy HTTP server on $hostname:$port
default_app = iris

#change in audio section
mixer_volume = 20

#add iris section:
[iris]
enabled = true
country = GB
locale = en_GB
sudo mkdir /media/network
sudo mkdir /media/music
sudo apt-get upgrade

SMB mount the manual way (/etc/rc.local or /etc/fstab):
#Note experiment with rsize=61440 option and/or use nounix mount option

sudo mount -t cifs -o ro,username=media,password=media,uid=1000,gid=1000,vers=1.0,cache=none //192.168.1.6/music/beets2 "/home/mopidy/FOO/"

sudo vi /etc/fstab
#add

//192.168.1.6/music	/media/music/beets2	cifs	username=media,password=media,ro,vers=1.0,cache=none,iocharset=utf8,noperm,file_mode=0644,dir_mode=0755,users	0	0
mount /media/network
sudo reboot

Other music player projects

raspberry-pi/music_player.1603634855.txt.gz · Last modified: 2023/05/29 11:53 (external edit)