User Tools

Site Tools


raspberry-pi:music_player

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
raspberry-pi:music_player [2020/10/18 15:32] Wulf Rajekraspberry-pi:music_player [2023/05/29 11:55] (current) – external edit 127.0.0.1
Line 6: Line 6:
 https://mopidy.com/ https://mopidy.com/
  
 +===== Hardware =====
  
 Pimoroni Pirate Audio Headphone AMP: Pimoroni Pirate Audio Headphone AMP:
Line 14: Line 15:
 https://shop.pimoroni.com/products/pirate-audio-mini-speaker  https://shop.pimoroni.com/products/pirate-audio-mini-speaker 
  
-Pimoroni Pirate Audio Case:+Pimoroni Pirate Audio Case with buttons: 
 +https://www.thingiverse.com/thing:5245754 
 + 
 +Pimoroni Pirate Audio Case (link dead):
 https://www.thingiverse.com/thing:4087948 https://www.thingiverse.com/thing:4087948
  
 Alternative case ideas: Alternative case ideas:
 https://www.yeggi.com/q/pimoroni+pirate+audio/  https://www.yeggi.com/q/pimoroni+pirate+audio/ 
 +
 +Angled case:
 +https://www.thingiverse.com/thing:5248110/comments
 +
 +===== System installation =====
 +
 +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
 +<code - /boot/wpa_supplicant.conf>
 +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>"
 +}
 +</code>
 +
 +Enable SSH Server:
 +create empty file ssh in boot folder
 +
 +/boot/config.txt
 +<code - /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
 +</code>
 +
 +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.
 +
 +Now insert the SD-Card into the Pi and power it up. Then connect to it via SSH.
 +
 +Security. Default user pi with password raspberry
 +https://www.raspberrypi.org/documentation/configuration/security.md
 +
 +
 +===== Mopidy Installation =====
 +
 +Install git if not already installed:
 +<code>
 +sudo apt-get install git
 +</code>
 +
 +# 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
 +<code>
 +cd /usr/src
 +sudo git clone https://github.com/pimoroni/pirate-audio
 +cd pirate-audio/mopidy
 +sudo ./install.sh
 +</code>
 +
 +Additional web interfaces can be installed:
 +https://github.com/pimusicbox/mopidy-musicbox-webclient
 +<code>
 +sudo python3 -m pip install Mopidy-MusicBox-Webclient
 +</code>
 +
 +https://github.com/tkem/mopidy-mobile
 +<code>
 +sudo python3 -m pip install Mopidy-Mobile
 +</code>
 +
 +#Removing mopidy spotify plugin and bluetooth support
 +<code>
 +sudo apt-get purge mopidy-spotify
 +sudo apt-get purge bluez bluez-firmware
 +sudo apt autoremove
 +</code>
 +
 +Install mopidy-local extension backend (local+sqlite combined) to build local index for search and increased performance.
 +https://github.com/mopidy/mopidy-local
 +<code>
 +sudo python3 -m pip install Mopidy-Local
 +</code>
 +
 +#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
 +<code>
 +#disable file extension
 +[file]
 +enabled = false
 +
 +#enable local with sqlite extension
 +[local]
 +enabled = true
 +media_dir = /media/network
 +scan_timeout = 5000
 +scan_flush_threshold = 50
 +album_art_files =
 +  cover.*
 +  folder.*
 +directories =
 +  Albums                  local:directory?type=album
 +  Artists                 local:directory?type=artist
 +  Composers               local:directory?type=artist&role=composer
 +  Genres                  local:directory?type=genre
 +  Performers              local:directory?type=artist&role=performer
 +  Release Years           local:directory?type=date&format=%25Y
 +  Tracks                  local:directory?type=track
 +  Last Week's Updates     local:directory?max-age=604800
 +  Last Month's Updates    local:directory?max-age=2592000
 +timeout = 10
 +
 +
 +#add to http section to enable web server for web front-ends
 +enabled = true
 +#port = 80 #issue with mopidy user and ports <1024
 +zeroconf = Mopidy HTTP server on $hostname:$port
 +# Set to iris, mobile or musicbox_webclient, depending on which is installed
 +default_app = iris
 +
 +#change in audio section
 +mixer_volume = 20
 +</code>
 +
 +When using Iris webclient:
 +<code>
 +#add iris section:
 +[iris]
 +enabled = true
 +country = GB
 +locale = en_GB
 +</code>
 +
 +When using MusicBox Webclient:
 +<code>
 +[musicbox_webclient]
 +enabled = true
 +musicbox = false #when on Pi MusicBox, adds system control/config options
 +websocket_host =
 +websocket_port =
 +on_track_click = PLAY_ALL
 +# on_track_click: The action performed when clicking on a track. Valid options are: PLAY_ALL (default), PLAY_NOW, PLAY_NEXT, ADD_THIS_BOTTOM, ADD_ALL_BOTTOM, and DYNAMIC (repeats last action).
 +</code>
 +
 +<code>
 +sudo mkdir /media/network
 +sudo mkdir /media/music
 +</code>
 +
 +<code>
 +sudo apt-get upgrade
 +</code>
 +
 +SMB mount the manual way (/etc/rc.local or /etc/fstab):
 +#Note experiment with rsize=61440 option and/or use nounix mount option
 +<code>
 +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/"
 +</code>
 +
 +sudo vi /etc/fstab
 +#add
 +<code>
 +//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
 +</code>
 +
 +<code>
 +mount /media/network
 +</code>
 +
 +<code>
 +sudo reboot
 +</code>
 +
 +
 +Trigger scan of media directories (when mopidy runs as service):
 +<code>
 +sudo mopidyctl local scan
 +</code>
 +or when running from terminal as logged in user:
 +<code>
 +mopidy local scan
 +</code>
 +
 +Note the default configuration files mopidy is looking for are in ~/.config/mopidy/mopidy.conf or /usr/share/mopidy/conf.d whereas the default service loads /usr/share/mopidy/conf.d and /etc/mopidy/mopidy.conf
 +The service file using the mopidy user is:
 +/etc/systemd/system/multi-user.target.wants/mopidy.service
 +
 +===== Mopidy MPD =====
 +
 +https://github.com/mopidy/mopidy-mpd
 +
 +<code>sudo python3 -m pip install Mopidy-MPD</code>
 +<code>
 +[mpd]
 +hostname = 0.0.0.0
 +</code>
 +
 +===== Edit the volume button's sensibility =====
 +
 +Default volume button step is 5%. Adding <code>step = x</code> to the [raspberry-gpio] section of /etc/mopidy/mopidy.conf adjusts it. The total volume range is 0-100.
 +
 +
 +===== Other music player projects =====
 +
 +Volumio (headless music player)
 +https://pimylifeup.com/raspberry-pi-volumio/
 +
 +Pi MusicBox (appears to be dead)
 +https://pimylifeup.com/raspberry-pi-music-player/
 +https://www.pimusicbox.com/
 +
 +
 +===== Various Links =====
 +
 +Mopidy Extensions: https://mopidy.com/ext/
 +Mopidy Config: https://docs.mopidy.com/en/latest/config/#audio-section
 +Mopidy Iris: https://github.com/jaedb/Iris/wiki/Getting-started#installing
 +Install guide: https://chrismolloy.com/p201.php
 +Mopidy Beets: https://github.com/mopidy/mopidy-beets/issues/29
 +Mopidy Beets2: https://github.com/mopidy/mopidy-beets/issues/28
 +Mopidy Beets3: https://github.com/mopidy/mopidy-beets/issues
 +Mopidy Beets ext: https://mopidy.com/ext/beets/
 +Github Mopidy repos: https://github.com/search?q=mopidy
 +Mopidy-Pidi https://github.com/pimoroni/mopidy-pidi
 +Mopidy-Pidi 2 https://github.com/pimoroni/mopidy-pidi/issues/10
 +Pirate Audio Mopidy https://github.com/pimoroni/pirate-audio/tree/master/mopidy
 +Jivelite on a Pirate Audio screen: https://forums.slimdevices.com/showthread.php?111502-Jivelite-on-a-Pirate-Audio-240x240-screen/page35
 +
 +Pimoroni Pirate Audio Case: https://www.thingiverse.com/thing:4087948
  
raspberry-pi/music_player.1603031541.txt.gz · Last modified: 2023/05/29 11:53 (external edit)