Players/musicpd: Difference between revisions

From Snakeoil OS Reference
Jump to navigation Jump to search
m (Formatting)
Line 193: Line 193:
[[File:Dual outputs process.jpg|alt=|frame|center]]
[[File:Dual outputs process.jpg|alt=|frame|center]]


#SSH into the SnakeOil instance and navigate to /var/www/players  '''''"cd /var/www/players"'''''
 
#Change the folder read,write privileges, then change file read, write privileges '''''"sudo chmod +rw mpd-v22";    "cd mpd-v22";    "sudo chmod +rw mpd.conf.template"'''''
SSH into the SnakeOil instance and navigate to /var/www/players  <syntaxhighlight lang="text">
#Edit mpd.conf.template   "'''''nano mpd.conf.template"'''''  (or use WinSCP’s editor)  <br />Scroll down to section with comments on “ALSA output”. Add the following audio outputs for DAC1 and DAC2:
cd /var/www/players
<syntaxhighlight lang="text">
</syntaxhighlight>
 
 
Change the folder read,write privileges, then change file read, write privileges <syntaxhighlight lang="text">
sudo chmod +rw mpd-v22
cd mpd-v22
sudo chmod +rw mpd.conf.template
</syntaxhighlight>
 
 
Edit mpd.conf.template<syntaxhighlight lang="text">
nano mpd.conf.template
</syntaxhighlight>(or use WinSCP’s editor)   
 
<br />Scroll down to section with comments on “ALSA output”. Add the following audio outputs for DAC1 and DAC2:<syntaxhighlight lang="text">
# Audio Output ################################################################
# Audio Output ################################################################
#
#

Revision as of 04:57, 22 March 2021

Music Player - mpd

Short for Music Player Daemon, MPD is a very lightweight player that can run on the slowest computer you have kept unused in the shed/storeroom.

MPD handles both music management and playback and does not require a secondary client to work. MPD is designed to run from a headless computer. In other words, you are running MPD off a computer that is not connected to a keyboard or a mouse.

You control MPD using secondary devices like your mobile phone, a tablet or another computer. This secondary device is a like your TV remote control, only better. More on this at the end of this article.

Different versions of MPD may impart a different sonic signature, so pick the version that sounds best to you.

There was a time when v17 and v19 used to sound very different, but I think the gap has closed since. v17 is included for historical reference (as a comparison). Always use the latest version avilable if you can.

Do not be deceived by the simplicity of MPD. This is an ultra high quality, no-frills player. It is THE player adopted by many high end commercial products, including Bryston, SoTM and Chord.

If you are looking for simplicity and exceptional sound quality, go with MPD. Sonic signature that can be associated with MPD includes:

  • pin-point accuracy
  • very detailed
  • very transparent
  • heart pounding attack
  • exceptional attack speed

To put in another way - MPD delivers absolute precision when playing back. MPD will tell you a lot about the recording itself. If your audio system is up to it, MPD will turn you into a super bat! You'd pick up the tiniest noise in the recording, details you have never heard before, minute details you may never realise it's there until now.

DSD Playback

MPD supports DoP or native DSD when playing back DSD material. Modern versions of MPD (0.20+) will auto-detect DSD compatibility if you have a native DSD DAC, try setting the hardware to "Native (PCM/DSD)" and let MPD handle the DSD detection - this will do native DSD streaming.

MPD-dsd-rt supports native DSD, refer to the player's page on how to set this up.

Common MPD Configuration

You can specify the following configuration options to tweak MPD. Separate each option with a ';' (semi-colon). Specific configuration options may exist for different versions of MPD, please refer to their pages for more information.

Volume Mixer

Use this if you want to enable MPD's built in software volume control (SVC). in MPD. Snakeoil disables SVC by default. The assumption is you are running your Snakeoil PC through an high quality pre-amplifier. Add the following option to enable MPD's SVC if you want to connect your PC straight to your speaker system.

MPD Option Settings Comments
mixer_type hardware Use the hahrdware audio volume control (if available)
software Use ALSA to adjust volume control
none Disable MPD volume control. (Default)

On Screen Display (OSD)

Applies to Raspberry Pi only. This will enable the OLED on screen display. Refer to this forum thread for more information.

MPD Option Settings Comments
mpd_oled [none] Enable OLED OSD

Tidal

MPD 0.21.8 on wards support Tidal via a plugin. Configuration is only available in activated editions for now. Avaiable since Blind Testing U5.

MPD Option Settings Comments
tidal_token [string] The Tidal application token. Since Tidal is unwilling to assign a token to MPD, this needs to be reverse-engineered from another (approved) Tidal client.
tidal_username [string] Your Tidal user name
tidal_passwd [string] Your Tidal password
tidal_quality HI_RES Highest resolution. MQA?
LOSSLESS Bit perfect?
HIGH High quality lossy?
LOW Low quality lossy?

Qobuz

MPD 0.21.8 onwards support Qobuz via a plugin. This option is only usable in activated editions for now. Avaiable since Blind Testing U5.

MPD Option Settings Comments
qobuz_id [string] The Qobuz application id. (See Application authentication)
qobuz_secret [string] The Qobuz application secret. (See User authentication)
qobuz_username [string] The Qobuz user name.
qobuz_passwd [string] The Qobuz password.
qobuz_quality 5 For MP3 320. (See Qobuz format identifier)
6 For FLAC Lossless
7 For FLAC Hi-Res 24 bit =< 96kHz
27 for FLAC Hi-Res 24 bit >96 kHz & =< 192 kHz

MPD Versions Available in Snakeoil

MPD Client - myMPD

There is a a long list of MPD clients you can use to queue music for MPD, see this site for a full list.

For Android devices my favourite is MPDroid; Peep in the Apple world can try out MPad. Using a mobile device is the ideal method for remote control as it allows you to browse the albums and artists while sitting comfortably. Finding a remote app that works best for you is really all about personal choices, so take your time to find the one that suits your workflow best.

Snakeoil OS firmware 1.0.9 onwards comes bundled with a web client call ympd. To launch ympd, go to the 'Music Players', and click the label myMPD in Audio State, highlighted here:

Musicplayers - remote client mpd

This will launch yMPD in a new browser tab, like so:

yMPD - Web client

Database Scan

If you are running MPD for the very first time, you need to run a music. This step will add all your music in your music library to the MPD database.

To start scanning, this click the "Settings" menu item at the top to get into the settings page, followed by the "Update DB" button (arrow).

Ympd - settings

Be patient, the first scan may take a long time (It takes around 20 minutes to parse 45,000 music files). If you quit MPD while the database is scanning you may be required to re-do the scan on restart. Note that each version of MPD has it's own database. So you will need to run a scan for every version you want to run.

Browse Music

Click on "Browse Database" at the top navigation bar to get to this view:

Ympd - browser

Your playlists and music library are displayed in this single view. Your music files are organised as what is called the 'folder view'. i.e. how your music file is stored in your file system will be displayed as such in this view.

Click the '+' button associated with a folder to add a folder to the queue. Click on the playlist to add its contents to the queue. Here's an example of using the browser and dive deep into one of the folders. You can navigate around your folder structure quickly by clicking one of the links as marked.

Ympd - browser inside a folder

Queue

Click on the "Queue" button in the navigation menu to see this view. This is more commonly known as the playlist, and here is the list of music that the MPD has played, is playing, or about to play. Unlike other MPD clients, the order of the playlist can't be changed.

Ympd - queue

Dirble

Dirble is created to make internet radio modern again and is focusing on giving that good experience of finding your new favourite radio station. It is a directory listing radio stations found on the Internet.

Ympd - drible

Unfortunately because of the design of the API, you'd need to install a browser extension to disable CORS. Disabling CORS is not ideal as it allows hackers to compromise your computer using a technique called 'cross site scripting'. Eventually Dirble will provide the right headers to make this work. Until then advanced users can install a browser extension to disable CORS if they like. Note that you are doing this at your own risk.

Folder Art Configuration For Your MPD Client

MPD has a very low footprint, this minimal overhead means things like album cover art is not supported. To work around this limitation - cover art is supported via the Snakeoil OS Web server instead. To get this to work you need to create JPG file for each folder. Unfortunately this means your albums have to be organised in folder logic (i.e. songs from the same album has to be organised in one folder, and in this folder a JPG covert art).

The covert art file is commonly named folder.jpg (and is case sensitive). This is an example of MPDroid displaying the cover art using this method:

Mpdroid showing coverart

MPDroid Example

To set this up in MPDroid, go to Settings → Cover art settings. Tick the option 'Download local cover art' to enable two options, 'Path to music' and 'Covert filename'.

Mpdroid cover art settings

Once the checkbox is set, tap 'Path to music' and set it like so, replace [ip_address] with the the IP address of your Snakeoil machine:

Mpdroid path to music

And in covert 'Cover filename', set it to 'folder.jpg'. Note this name is case sensitive. Also you are free to use another name if you prefer.

Mpdroid cover filename

Once you have make this settings, exit the settings and go back to MPDroid playback. Your cover art should start to appear.

You can use this same idea to configure other MPD clients to use the local cover art. There are more advanced MPD clients with the ability to query the Internet to download the cover art. Unfortunately querying the Internet can be hit and miss (false results). Were possible use a local cover art where possible.

MPD Tweaks

Dual outputs

MPD can be configured to output to 2 simultaneous devices. For example, using an external USB card with dual outputs to 2 DACs, one for the main speakers and the other for subs. Note that using standard USB ports on a computer for dual outputs may result in the signals drifting apart; ideally use USB ports driven by one master clock on an external USB card.


The process is simple to implement and can be used for both PCM and DSD output. The alternative of creating a new Alsa TwoCardsAsOne device will only allow PCM (and maybe DoP?). Conceptually, the process looks like this:


SSH into the SnakeOil instance and navigate to /var/www/players

cd /var/www/players


Change the folder read,write privileges, then change file read, write privileges

sudo chmod +rw mpd-v22
cd mpd-v22
sudo chmod +rw mpd.conf.template


Edit mpd.conf.template

nano mpd.conf.template

(or use WinSCP’s editor)
Scroll down to section with comments on “ALSA output”. Add the following audio outputs for DAC1 and DAC2:

# Audio Output ################################################################
#
# MPD supports various audio output types, as well as playing through multiple 
# audio outputs at the same time, through multiple audio_output settings 
# blocks. Setting this block is optional, though the server will only attempt
# autodetection for one sound card.
#
# An example of an ALSA output:
#
#audio_output {
#	type		"alsa"
#	name		"My ALSA Device"
##	device		"hw:0,0"	# optional
##	mixer_type      "hardware"	# optional
##	mixer_device	"default"	# optional
##	mixer_control	"PCM"		# optional
##	mixer_index	"0"		# optional
#}
#
audio_output {
type                    "alsa"
name                    "DAC1"
device                  "hw:0,0"
}
audio_output {
type                    "alsa"
name                    "DAC2"
device                  "hw:1,0"
}


Restart MPD









You should see that there are now 2 outputs. While the status says one in use, both outputs will work simultaneously. Note that in my setup, I need to ensure that the volume on both outputs are in synch.


The same method can be used to provide dual outputs for upmpdcli. Navigate to the upmpdcli folder and modify the mpd.conf.template file. By enabling the DLNA/UPnP Bridge and using upmpdcli as the client, it is possible to also do dual outputs in LMS (Logitech Media Server).


CAUTION: installing or re-installing MPD or upmpdcli may result in the mpd.conf.template file being over written. You may need to re-apply this tweak.

 Main   Music Players    Logitech Media Server & Squeezelite