Moode Audio Player for Raspberry Pi

Tim, tell us more about the new rotary encoder driver? Is it for physical knobs to controll the volume? Is it a 'generic driver' that could be hooked to whatever component (like the current time position?).

Sounds great,
Rafa.

Yes its for physical volume knob. Connect a typical 3-pin rotary encoder to Raspberry Pi GPIO 23, 24 and GND then turn on the Rotary encoder in Audio config. This loads the driver.

GPIO 23, 24 and GND correspond to pins 16, 18 and 20 on the 40-pin header.

The existing driver in Moode 3.1 is already greatly enhanced from the original driver written by IQaudIO. One major enhancement was to enable it to update Moode volume knob.

The new driver is fresh c-code and has many under-the-hood improvements that I've been planning for some time. Goal is smoother updating of Moode knob.

-Tim
 
Hi Igor,

As far as volume issue goes, I see that the audio device has two volume controls in alsamixer. What is each one used for?

Moode uses command below to fetch the mixer name for USB device.
awk -F"'" '/Simple mixer control/{print $2;}' <(amixer -c 1)

I've run across a few USB audio devices that don't use the standard ALSA mixer name 'PCM' or have several volume controls and have not been able to revolve the volume issues.

-Tim

Thanks for that! Well, other volume control (from alsamixer) is controlling the volume in same fashion (and scale) as first one. Here is the output from amixer:

Simple mixer control 'Mini-i Series',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 127
Mono:
Front Left: Playback 127 [100%] [0.00dB] [on]
Front Right: Playback 127 [100%] [0.00dB] [on]
Simple mixer control 'Mini-i Series',1
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback 0 - 127
Mono: Playback 127 [100%] [0.00dB] [on]

It looks like one is controlling the L/R channels and one is the "master" volume ... it's default practice with XMOS based DAC chipsets as far as I could remember.

So, in practical terms ... your script is giving two matches

Mini-i Series
Mini-i Series

As Rafa pointed out, maybe dbrange is out of sync (as erratically it's going way forward in one direction only). It seems that driver is presenting 0-127. Would have to dig deeper ...
 
Thanks for that! Well, other volume control (from alsamixer) is controlling the volume in same fashion (and scale) as first one. Here is the output from amixer:

Simple mixer control 'Mini-i Series',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 127
Mono:
Front Left: Playback 127 [100%] [0.00dB] [on]
Front Right: Playback 127 [100%] [0.00dB] [on]
Simple mixer control 'Mini-i Series',1
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback 0 - 127
Mono: Playback 127 [100%] [0.00dB] [on]

It looks like one is controlling the L/R channels and one is the "master" volume ... it's default practice with XMOS based DAC chipsets as far as I could remember.

So, in practical terms ... your script is giving two matches

Mini-i Series
Mini-i Series

As Rafa pointed out, maybe dbrange is out of sync (as erratically it's going way forward in one direction only). It seems that driver is presenting 0-127. Would have to dig deeper ...

Hi,

When there are multiple mixer controls with same name then they are differentiated by an index.

Something to try:

Config MPD volume control to Hardware and then edit mpd.conf and change mixer_index to 1 or 2.

https://www.musicpd.org/doc/user/output_plugins.html

-Tim
 
Hi,

How many items in Playlist?

If u are using big playlist for random play, instead turn on Auto-shuffle.

-Tim

Some thousands :)

I tried that, it never worked on my system before now that I found out I need to have random enabled in the playback window as well. :b
Thanks !
But how do I specify which parts of my music library to use with the Auto-shuffle?

Two other questions:

I have an ancient wolfson WM8740 usb dac that I want to try, how do I set that up? I can't find it when I select output. Right now it is the ES9023 i2s DAC.

When browsing from a mobile device how do I browse the library through artists instead of albums?
 
Hi Tim,

Did some further investigation. Both mixer end-points (0,1) are behaving the same way. By the way, is moOde using percentage base volume control or manipulating with directly returned mixer range (values)?

Here is the more detailed output from the USB audio device mixer on my end:

pi@moode:~/src/spotify-connect-web $ amixer cget numid=4

numid=4,iface=MIXER,name='Mini-i Series Playback Volume'
; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0
: values=127,127
| dBminmax-min=-127.00dB,max=0.00dB
pi@moode:~/src/spotify-connect-web $

For a test, when setting manually mixer value to, say, 115:

amixer sset "Mini-i Series" 115

Simple mixer control 'Mini-i Series',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 127
Mono:
Front Left: Playback 115 [91%] [-12.00dB] [on]
Front Right: Playback 115 [91%] [-12.00dB] [on]Simple mixer control 'Mini-i Series',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 127
Mono:
Front Left: Playback 115 [91%] [-12.00dB] [on]
Front Right: Playback 115 [91%] [-12.00dB] [on]

Actual alsamixer is reporting 63. Quite a jump! It seems to me that dB raw values translation process within the ALSA mixer (and returned back to the USB driver itself) is not exactly linear, hence quite jumpy control even with quite modest adjustments.
 
Some thousands :)

I tried that, it never worked on my system before now that I found out I need to have random enabled in the playback window as well. :b
Thanks !
But how do I specify which parts of my music library to use with the Auto-shuffle?

Two other questions:

I have an ancient wolfson WM8740 usb dac that I want to try, how do I set that up? I can't find it when I select output. Right now it is the ES9023 i2s DAC.

When browsing from a mobile device how do I browse the library through artists instead of albums?

Hi,

1) Auto-shuffle uses the whole collection. If u want to random play through just a certain part of your collection then you would need to go back to using MPD random play and Playlists.

2) USB DAC's are automatically configured by Linux. Set I2S audio device to 'None', reboot then plug in USB DAC. In MPD config set Audio device to 'USB audio device' then APPLY.

3) On small screens the Library displays Albums. I have a TODO list item to provide a way to switch to Artists. Someday I'll get to it.

-Tim
 
Hi Tim,

Did some further investigation. Both mixer end-points (0,1) are behaving the same way. By the way, is moOde using percentage base volume control or manipulating with directly returned mixer range (values)?

Here is the more detailed output from the USB audio device mixer on my end:

pi@moode:~/src/spotify-connect-web $ amixer cget numid=4

numid=4,iface=MIXER,name='Mini-i Series Playback Volume'
; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0
: values=127,127
| dBminmax-min=-127.00dB,max=0.00dB
pi@moode:~/src/spotify-connect-web $

For a test, when setting manually mixer value to, say, 115:

amixer sset "Mini-i Series" 115

Simple mixer control 'Mini-i Series',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 127
Mono:
Front Left: Playback 115 [91%] [-12.00dB] [on]
Front Right: Playback 115 [91%] [-12.00dB] [on]Simple mixer control 'Mini-i Series',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 127
Mono:
Front Left: Playback 115 [91%] [-12.00dB] [on]
Front Right: Playback 115 [91%] [-12.00dB] [on]

Actual alsamixer is reporting 63. Quite a jump! It seems to me that dB raw values translation process within the ALSA mixer (and returned back to the USB driver itself) is not exactly linear, hence quite jumpy control even with quite modest adjustments.

Hi,

MPD Software volume control uses a logarithmic curve. MPD Hardware volume control uses a linear curve unless you use the Customize screen to enable Logarithmic curve for Hardware volume.

The alsamixer scale is neither linear nor logarithmic, its some sort of hybrid scale.

-Tim
 
Hi,

MPD Software volume control uses a logarithmic curve. MPD Hardware volume control uses a linear curve unless you use the Customize screen to enable Logarithmic curve for Hardware volume.

The alsamixer scale is neither linear nor logarithmic, its some sort of hybrid scale.

-Tim

Interesting.

MPD hardware volume control test was resulting with same effects as with mixer command line control. Pecularly enough, I've tried this:

amixer -M sset "Mini-i Series" 90%

Simple mixer control 'Mini-i Series',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 127
Mono:
Front Left: Playback 124 [89%] [-3.00dB] [on]
Front Right: Playback 124 [89%] [-3.00dB] [on]

It's *much* better/smoother now (with more adequate -3.00db) and volume scaling is now nicely mapped between the device 0-127dB scale and ALSA mixer 0-100%. From the amixer manual about the -M parameter: "Use the mapped volume for evaluating the percentage representation like alsamixer, to be more natural for human ear."
 
Interesting.

MPD hardware volume control test was resulting with same effects as with mixer command line control. Pecularly enough, I've tried this:

amixer -M sset "Mini-i Series" 90%

Simple mixer control 'Mini-i Series',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 127
Mono:
Front Left: Playback 124 [89%] [-3.00dB] [on]
Front Right: Playback 124 [89%] [-3.00dB] [on]

It's *much* better/smoother now (with more adequate -3.00db) and volume scaling is now nicely mapped between the device 0-127dB scale and ALSA mixer 0-100%. From the amixer manual about the -M parameter: "Use the mapped volume for evaluating the percentage representation like alsamixer, to be more natural for human ear."

Hi,

On Customize screen turn on Logarithmic curve and set Max volume % to 90. This will be same as -M + capping ALSA volume at 90%.

If u are not getting same results then there is some other issue thats preventing Moode from correctly controlling volume with this particular audio device.

-Tim
 
Thanks for the tip! Much appreciated.

As I'm using I2S moOde configuration (USB DAC is configured as parallel audio_output manually in mpd.conf) ... so can't select USB DAC from the GUI, could you kindly suggest if such configuration (logarithmic volume + cap) is possible by directly editing mpd.conf? and I will test things further.

Speaking of spotify-connect-web ... it seems that volume is controlled in linear fashion (same as MPD linear + hardware mixer), so it's not directly the problem with the code but possible feature request and maybe needs to be addressed over there. I've tried to play with dbrange parameter but without much luck.

Few comments about the spotify-connect-web systemd integration. Rafa already did quite a good job specifying this, but just to add that it's useful to run the service as pi user and define working directory, just in case, and standard output/errors directed to console and syslog just in case so that they are picked up by journalctl. As far as I could see, journalctl is picking up the console log from the service itself. Lastly, it's maybe better that shell script is called from the systemd (as service) as it's easier to change things then to reload systemd configuration each time.

So, in effect (my ongoing systemd service file):

Description=Spotify Connect Web
After=network.target

[Service]
ExecStart=/home/pi/src/spotify-connect-web/spotify-connect-web.run
WorkingDirectory=/home/pi/src/spotify-connect-web
User=pi
StandardOutput=syslog+console
StandardError=syslog+console
Restart=always
RestartSec=10
StartLimitInterval=30
StartLimitBurst=20

[Install]
WantedBy=multi-user.target


Regards,
Igor
 
Last edited:
Thanks for the tip! Much appreciated.

As I'm using I2S moOde configuration (USB DAC is configured as parallel audio_output manually in mpd.conf) ... so can't select USB DAC from the GUI, could you kindly suggest if such configuration (logarithmic volume + cap) is possible by directly editing mpd.conf? and I will test things further.

Speaking of spotify-connect-web ... it seems that volume is controlled in linear fashion (same as MPD linear + hardware mixer), so it's not directly the problem with the code but possible feature request and maybe needs to be addressed over there. I've tried to play with dbrange parameter but without much luck.

Few comments about the spotify-connect-web systemd integration. Rafa already did quite a good job specifying this, but just to add that it's useful to run the service as pi user and define working directory, just in case, and standard output/errors directed to console and syslog just in case so that they are picked up by journalctl. As far as I could see, journalctl is picking up the console log from the service itself. So, in effect (my ongoing systemd service file):
Description=Spotify Connect Web
After=network.target

[Service]
ExecStart=/home/pi/src/spotify-connect-web/spotify-connect-web.run
WorkingDirectory=/home/pi/src/spotify-connect-web
User=pi
StandardOutput=syslog+console
StandardError=syslog+console
Restart=always
RestartSec=10
StartLimitInterval=30
StartLimitBurst=20

[Install]
WantedBy=multi-user.target


Regards,
Igor

Hi Igor,

Logarithmic curve and capping for MPD Hardware volume is something done in Moode code outside of MPD because up to and including the 0.19 series of MPD, there was no support for Hardware logarithmic volume, only linear. This has changed btw in the 0.20 series of MPD :)

There are no mpd.conf settings for linear/log volume. It works for both USB and I2S DAC's that support hardware volume.

Yes, Spotify Connect-Web volume issues need to posted to the dev's Git repo.

-Tim
 
...but just to add that it's useful to run the service as pi user and define working directory, just in case, and standard output/errors directed to console and syslog just in case so that they are picked up by journalctl. As far as I could see, journalctl is picking up the console log from the service itself. Lastly, it's maybe better that shell script is called from the systemd (as service) as it's easier to change things then to reload systemd configuration each time.

So, in effect (my ongoing systemd service file):

Description=Spotify Connect Web
After=network.target

[Service]
ExecStart=/home/pi/src/spotify-connect-web/spotify-connect-web.run
WorkingDirectory=/home/pi/src/spotify-connect-web
User=pi
StandardOutput=syslog+console
StandardError=syslog+console
Restart=always
RestartSec=10
StartLimitInterval=30
StartLimitBurst=20

[Install]
WantedBy=multi-user.target


Regards,
Igor

Thanks for the extra info. System is not really my thing, I'm into WEB development, so much appreciated.

In this scenario, how do you pass parameters?

Regards,
Rafa.
 
Thanks for the extra info. System is not really my thing, I'm into WEB development, so much appreciated.

In this scenario, how do you pass parameters?

Regards,
Rafa.

Well ... in this scenario you just call the external shell script (spotify-connect-web.run in my case) and such script is starting the binary with all parameters and possible pre/post running tasks. In essence, it's easier to edit just one shell script then to edit systemd config files each time. Regarding pre/post scripts you could achieve the same with ExecStartPre=, ExecStartPost= systemd service directives, but I'm always in favour to start things from centralised startup script.
 
Hi,

On Customize screen turn on Logarithmic curve and set Max volume % to 90. This will be same as -M + capping ALSA volume at 90%.

If u are not getting same results then there is some other issue thats preventing Moode from correctly controlling volume with this particular audio device.

-Tim

OK ... not much luck that way either :confused:

An externally hosted image should be here but it was not working when we last tested it.


An externally hosted image should be here but it was not working when we last tested it.
An externally hosted image should be here but it was not working when we last tested it.

An externally hosted image should be here but it was not working when we last tested it.
 
OK ... progress! It seems that maximum value was causing the trouble. At 100% much better outcome:

An externally hosted image should be here but it was not working when we last tested it.



** I see that one can adjust the curve slope in moOde, so finer tunning is certainly possible, but as far as I could see pretty much acceptable USB device dB scale translation.
 
Last edited:
Help needed connecting to Vortexbox server

OK, well I had this working via nfs but I then updated Vortexbox to V2.4 and now I cannot connect at all.

My understanding is that Vortexbox makes the music folder available via both nfs and a samba share. I'm going to focus on the samba share...

In windows I can use windows explorer, browse network, see the vortexbox machine, and when clicking on it see the samba shares. The one I'm interested in is called music_readonly

I can click on that and browse the files. I can also map it to a drive letter on Windows just with a couple of clicks. No user, no password required.

In Moode no matter how I try to configure the source I cannot make a connection, and now after a few attempts if I try to access the configure source screen in Moode it just hangs... Even after restarting Moode I get this hanging..

BTW when upgrading Vortexbox to 2.4 it was reassigned a new IP address by the router and moved from 192.168.0.8 to 192.168.0.59. I can't see that this should make any difference though.

I have attached the relevant part of the smb.conf file from Vortexbox...
 

Attachments

  • vortexbox smb.JPG
    vortexbox smb.JPG
    69.4 KB · Views: 65
OK, well I fixed the hanging with this...

==========================================================================

"Here is fix for your particular issue where the mount point (/mnt/NAS/dir) was removed but the config record for the source was not deleted and is now orphaned and still appears in the list of sources.

(1) verify that /mnt/NAS/dir has been removed
(2) dump out the nas source sql table and note the ID of the record corresponding to the orphaned nas source. The ID is the first column and has values 1,2,...

sqlite3 /var/www/db/player.db "select * from cfg_source;"

(3) delete the orphaned nas source record. Replace 'N' with the actual number and include the single quotes.

sqlite3 /var/www/db/player.db "delete from cfg_source where id='N';"

(4) reboot"

==============================================================================================


But every attempt at configuring for a connection to the samba share results in an entry in the sql database that then causes the Moode configuration screen to hang when accessed.

I'm stuck...
 
OK, well I had this working via nfs but I then updated Vortexbox to V2.4 and now I cannot connect at all.

My understanding is that Vortexbox makes the music folder available via both nfs and a samba share. I'm going to focus on the samba share...

In windows I can use windows explorer, browse network, see the vortexbox machine, and when clicking on it see the samba shares. The one I'm interested in is called music_readonly

I can click on that and browse the files. I can also map it to a drive letter on Windows just with a couple of clicks. No user, no password required.

In Moode no matter how I try to configure the source I cannot make a connection, and now after a few attempts if I try to access the configure source screen in Moode it just hangs... Even after restarting Moode I get this hanging..

BTW when upgrading Vortexbox to 2.4 it was reassigned a new IP address by the router and moved from 192.168.0.8 to 192.168.0.59. I can't see that this should make any difference though.

I have attached the relevant part of the smb.conf file from Vortexbox...


And here are the Vortexbox shares as viewed in Windows Explorer.
 

Attachments

  • Windows shares.JPG
    Windows shares.JPG
    26.3 KB · Views: 82