Peppy player

-----------------------------
Reboot and Shutdown
-----------------------------
"sudo reboot" works over SSH.
"sudo poweroff" works but has the ~1 minute delay (normal in Debian).
Does Raspbian not have this delay?

I normally always use "shutdown -h now" and "shutdown -r now" in Debian.

I wonder if it has to do with X.
If i connect with Putty it is a new session or something like that?
Not the same as doing it directly on the Peppy machine?
 
Hi MrGlasspoole,

Thank you for the very detailed info!

Regarding switching a display on/off, in the latest release I implemented a backlight functionality for DSI displays:
Display Backlight * project-owner/Peppy.doc Wiki * GitHub
Using that functionality you can switch a display on/off but only if your display was connected through DSI interface. As far as I know there is no universal way for that in SPI displays. I don't know how to do that for HDMI. If you have such info please let me know.
For all player disk images I use Raspberry Pi OS Lite. It doesn't have X-Windows. At the moment I don't plan to implement anything related to X. But if you know how to easily do that for X please let me know.

For the volume control try to set the type to 'player' just to make sure that you have the ALSA output at all:
Peppy/config.txt at 87daa889969de9b0215731785318e903b136219e * project-owner/Peppy * GitHub
You can also try to play any audio file from the terminal using either 'aplay' or 'vlc' or 'mpv' and see if you can change the volume in another terminal using 'alsamixer'. That should help to identify the problem.

Regarding shutdown, Pi doesn't have so long delay after poweroff command. You can try to change 'poweroff' to the 'shutdown' command on the line #2279 in the peppy.py file and see if that helps:
Peppy/peppy.py at 87daa889969de9b0215731785318e903b136219e * project-owner/Peppy * GitHub
If it works for you I can change the code in the next release. It should be checked that the shutdown also brings the pin GPIO#4 to Low. That can be used to shutdown a power supply if you add the line to /boot/config.txt:
dtoverlay=gpio-poweroff,active_low,gpiopin=4

I believe the players which you mentioned for bitrate use 'mpd' as audio player. In case of Peppy player I'll need to implement that functionality for each supported audio player: mpd, vlc, mpv. That should be doable I just always consider that as a low priority task :)

Best regards
 
Regarding switching a display on/off, in the latest release I implemented a backlight functionality for DSI displays:
I don't know how to do that for HDMI. If you have such info please let me know.
At the moment I don't plan to implement anything related to X. But if you know how to easily do that for X please let me know.
As i wrote. All you have to do in Linux is "xset dpms force off" in the CMD.

If i do that power consumption goes from 13.2 to 11.3.
1.9 watt saving...

I only use X because it seems like the display needs it because touch function works over USB.

How i did that is in the "Buster Peppy Installation" attachment:
https://www.diyaudio.com/forums/att...93-peppy-player-buster-peppy-installation-txt

------------------------
Volume Control
------------------------
If i play music in Peppy, open AlsaMixer in Putty on my workstation an move "Master" it works.

But i realized
Code:
amixer sset Master 50%
does not work and i get: "amixer: Unable to find simple control 'Master',0"

I found out i have do to
Code:
amixer -c 1 -- sset Master playback 50%"
Then i realized that
Code:
sudo alsactl store
does store the settings but they are not loaded at boot.
It also seems like it does only save AlsaMixer setting but not the default sound card.

The equalizer is working with:
Code:
pcm.!default {
  type plug
  slave.pcm plugequal;
}
ctl.!default {
  type hw card 0
}
ctl.equal {
  type equal;
}
pcm.plugequal {
  type equal;
  slave.pcm "plughw:1,0";
}
pcm.equal {
  type plug;
  slave.pcm plugequal;
}
and i guess i have to change some stuff there.

I tried:
Code:
pcm.!default {
  type hw
  card 1
  device 0
  slave.pcm plugequal;
}
ctl.!default {
  type hw
  card 1
  device 0
}
ctl.equal {
  type equal;
}
pcm.plugequal {
  type equal;
  slave.pcm "plughw:1,0";
}
pcm.equal {
  type plug;
  slave.pcm plugequal;
}
but it does not work.
That Linux sound stuff is killing me...

----------------------------
Shutdown / Reboot
----------------------------
I tried "sudo shutdown -h now" at line #2279.
It does not work. And since "sudo reboot" works from the command line but not in the web interface, i guess the problem is somewhere else.

The problem with the Debian derivates like Raspbian is that they change stuff.
In Debian 'poweroff' and 'shutdown' are different things.

But i did try 'poweroff' again in the command line and this time it was without schedule :ill:

----------------------------
NAS
----------------------------
I would not use a RPi for that because of USB. I don't know about the RPi4 USB and LAN performance but a RPi3 is not a good idea.

There is better stuff out there.
ODROID-HC1/HC2 or if you want 2x SATA and 2x 2.5G LAN then ODROID-H2+
Or maybe a Rock64...

YouTube

I don't like OpenMediaVault. The one i liked the most was XigmaNAS.
But they are all to complicated and have to much stuff i don't need.
So i go with a minimal Debian installation i do my stuff just with SAMBA.

By portable i mean battery powered.
I have this Supermicro X10SBA and the reason i bought a touch screen (that brought me to the idea to also install Peppy on it) is that i need a way to switch between different functions and see the IP.

1. Connect to LAN and show IP on display
> Normal mode. Just plug in to a switch somewhere and see the IP on the screen it gets from DHCP server from that LAN where it is connected.

2. Connect to WLAN and show IP on display
> Like 1. but this time connect to WLAN. I need a way to select the WLAN and enter the password on that touchscreen.

3. LAN with DHCP Server
> This time the NAS is the DHCP server so i can connect it to a switch and can also connect Laptop, Tablet, Phone, other PCs via cable.

4. WLAN Access Point with DHCP Server
> Same as 3. but the NAS is a Access Point and i can connect other devices via WLAN

The idea is i can take that box and just but it on my backseat in the car and have all my music, eBooks and other stuff with me.
I'm sick copying stuff around to phones, tablets and what not.

Oh and almost forgot it.
I will install TVheadend and use a DVB-T2 stick and a DVBSKy S960 USB sat tuner. That way i can use one of this:
https://www.amazon.de/PremiumX-Camp...r-Dichtring-Camping-Sat-Anlage/dp/B003DBNT92/

I'm already using some DVBSKy S960 connected to a Intel D2700MUD.
It works great and I'm using dream Player for TVHeadend on a Amazon stick and on my Nvidia Shield Tablet:
dream Player for TVHeadend - Apps on Google Play

Sure if you have an Android TV you can also install dream Player there.
On Laptops or PCs i just use MPC-HC.
Satellite TV in the whole house via LAN and WLAN ;)
 
Hi MrGlasspoole,

If it will be really helpful I can try to implement 'xset dpms force off' and 'on'.

I should probably add another configuration parameters to the volume control: card and device. Meanwhile you can change the command in the amixerutil.py file:
Peppy/amixerutil.py at 87daa889969de9b0215731785318e903b136219e * project-owner/Peppy * GitHub

It's hard to say why equalizer doesn't work in your case. I see that you installed the ALSA plugin: sudo apt install libasound2-plugin-equal

Did you try to check the content of the log file when you are trying to Reboot or Shutdown from the Web UI?

Pi 4 has much better specs regarding USB and Network over Pi 3 and very similar to Odroid boards. I believe you mean that NAS will be powered by the car battery as this kind of motherboards consume too much for the regular batteries.
I think you know that you can see a LAN and WLAN IPs in the Peppy player:
Network * project-owner/Peppy.doc Wiki * GitHub
But as you use a regular Debian I'm not sure already that it will work as expected in your case :) Hopefully it will.

Best regards
 
------------------------
Volume Control
------------------------
With "amixer -c 1 sset {ctrl} {vol}% -M" in the amixerutil.py the volume slider works if i have "--alsa-audio-device=hw:1,0" (no equalizer) in the player settings.

The equalizer by its own is working (--alsa-audio-device=equal).
But then the volume control stops working.
That's why i think i need change something in .asoundrc.

----------------------------
Shutdown / Reboot
----------------------------
The log file is just empty...

----------------------------
NAS
----------------------------
Wow i did not look at network yet.
But now i love Peppy even more because there is already a touch keyboard for WLAN connection. To figure out how to build such a keyboard in Python was my greatest fear.

Only downside is that if i go to Network that its loading forever and i have no control over Peppy anymore.
I will get a Intel Wi-Fi 6 AX200 tomorrow. Lets see what happens after installing it.

Yes the Pi4 is better. But i don't like the USB<>SATA way/overhead.
Since years even on Laptops i use eSATA.

And there is the Odroid-C4 that can do:
HEVC (H.265) 10 bit @ 60Hz and VP9 Profile2 @ 60Hz

I'm thinking about switching to a ASRock J4105-ITX or ODROID-H2+
That way I can play all videos if I directly connect the NAS to a TV.

But there are some downsides.
For the ASRock i need an extra NIC because it has only one.
The ODROID-H2+ has just 2x SATA and i need the M.2 for WLAN/BT.
And what i really do not like is that i need a HDMI cable from outside to the touchscreen. My Supermicro has an embedded DisplayPort.

Power consumption with the screen off is 11.3W. Even 1W lower if i pull the USB sound card. That is measured on the wall socket with a picoPSU and mains adapter. Without the conversion i guess it will be even lower.

If the machine would pull 20W a 20.000mAh battery should last at least 6 hours (if I'm right).

But yes i will also make it that you can plug it to the cigarette lighter socket for charging :)
 
I have now:
Code:
pcm.!default {
  type plug
  slave.pcm plugequal;
}
ctl.!default {
  type hw
  card 0
}
ctl.equal {
  type hw
  card 1
}
pcm.plugequal {
  type equal;
  slave.pcm "plughw:1,0";
}
pcm.equal {
  type plug;
  slave.pcm plugequal;
}
and "amixer -c 1 sset" in the amixerutil.py
Volume is working and equalizer.
Well i only here a difference if i move th 4k slider in the equalizer.

I also realized that if i play a file, go to the equalizer and then back to the file browser that volume goes up...

I guess if the asoundrc is right that i don't need the set the card (-c 1) in the amixerutil.py?

I tried:
Code:
ctl.!default {
  type hw
  card 1
}
and removed the '-c 1' in amixerutil.py, but then volume stops working again.

Is there a way to reload the asoundrc without rebooting?
Since there a 1 million combinations its a pain to reboot after every change...
Maybe stooping and starting Peppy again also?
 
Hi,

Thanks to phofman for pointing out the issue. I think he is the best ALSA expert here ;)

Regarding equalizer, you can also test it by running the following command in the terminal: alsamixer -D equal

Some equalizer settings in the player increase the overall volume level, for example the settings for the Classical music do that. Maybe that's what you experienced.

It looks like you still need to specify the card number for amixer.

To use the modified .asoundrc file you can just restart the player. No need to reboot the system. Well, at least that is the case in Raspberry OS.

Best regards
 
Alsa-lib config chain is read every time a device is opened by the player. But you may be hitting a different issue. I do not know about equal, but the softvol ctrl element is added to the underlying alsa device on first opening the device with the softvol config. Since then the ctrl element is part of the device controls, even if you remove it from the config, until the device is dropped by removing its driver module (rmmod).

Perhaps the same principle applies to equalizer controls. If so, you could just try removing and reloading the respective kernel module. For the module removal to succeed, the device must not be opened by any process (see sudo lsof /dev/snd/*).
 
Aha, after the change in asoundrc the command 'alsamixer -D equal' does not open the alsa equalizer in the terminal anymore.
It just opens the AlsaMixer. If i then move the 4k slider on the touchscreen i can see Master moving in the terminal.
Then if i go back to the playing song then Master jumps to where it was...

Strange and funny behavior :)
Is finding the right asoundrc entries some kind of puzzle game :(
 
IMO the problem is this:

Code:
pcm.equal {
  type equal
  slave.pcm "hw:3"
}

Code:
amixer contents -D equal
numid=1,iface=MIXER,name='00. 31 Hz Playback Volume'
  ; type=INTEGER,access=rw------,values=2,min=0,max=100,step=1
  : values=66,66
numid=2,iface=MIXER,name='01. 63 Hz Playback Volume',device=1
  ; type=INTEGER,access=rw------,values=2,min=0,max=100,step=1
  : values=66,66
numid=3,iface=MIXER,name='02. 125 Hz Playback Volume',device=2
  ; type=INTEGER,access=rw------,values=2,min=0,max=100,step=1
  : values=66,66
numid=4,iface=MIXER,name='03. 250 Hz Playback Volume',device=3
  ; type=INTEGER,access=rw------,values=2,min=0,max=100,step=1
  : values=66,66
numid=5,iface=MIXER,name='04. 500 Hz Playback Volume',device=4
  ; type=INTEGER,access=rw------,values=2,min=0,max=100,step=1
  : values=66,66
numid=6,iface=MIXER,name='05. 1 kHz Playback Volume',device=5
  ; type=INTEGER,access=rw------,values=2,min=0,max=100,step=1
  : values=66,66
numid=7,iface=MIXER,name='06. 2 kHz Playback Volume',device=6
  ; type=INTEGER,access=rw------,values=2,min=0,max=100,step=1
  : values=66,66
numid=8,iface=MIXER,name='07. 4 kHz Playback Volume',device=7
  ; type=INTEGER,access=rw------,values=2,min=0,max=100,step=1
  : values=66,66
numid=9,iface=MIXER,name='08. 8 kHz Playback Volume',device=8
  ; type=INTEGER,access=rw------,values=2,min=0,max=100,step=1
  : values=66,66
numid=10,iface=MIXER,name='09. 16 kHz Playback Volume',device=9
  ; type=INTEGER,access=rw------,values=2,min=0,max=100,step=1
  : values=66,66

Now with the ctl definition added:

Code:
pcm.equal {
  type equal
  slave.pcm "hw:3"
}

ctl.equal {
 type hw
 card 3
}

Code:
amixer contents -D equal
numid=1,iface=CARD,name='ICE1724 EEPROM'
  ; type=BYTES,access=r-------,values=52
  : values=0x49,0x53,0x30,0x30,0x13,0x02,0x28,0x80,0x78,0xc3,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0x7d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x7d,0x00,0x00,0x00,0xff,0x00,0x00
numid=18,iface=MIXER,name='Master Playback Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
numid=31,iface=MIXER,name='Master Playback Volume'
  ; type=INTEGER,access=rw---R--,values=1,min=0,max=255,step=0
  : values=255
  | dBscale-min=-63.50dB,step=0.50dB,mute=1
numid=16,iface=MIXER,name='PCM 1/2 Capture Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=164,step=0
  : values=41,41
  | dBscale-min=-63.50dB,step=0.50dB,mute=1
numid=14,iface=MIXER,name='PCM 1/2 Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=255,step=0
  : values=255,255
  | dBlinear-min=-99999.99dB,max=0.00dB
numid=17,iface=MIXER,name='PCM 3/4 Capture Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=164,step=0
  : values=126,126
  | dBscale-min=-63.50dB,step=0.50dB,mute=1
numid=15,iface=MIXER,name='PCM 3/4 Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=255,step=0
  : values=0,0
  | dBlinear-min=-99999.99dB,max=0.00dB
numid=22,iface=MIXER,name='PCM In 1/2 Capture Switch'
  ; type=ENUMERATED,access=rw------,values=1,items=2
  ; Item #0 'An In 1/2'
  ; Item #1 'An In 3/4'
  : values=1
numid=23,iface=MIXER,name='PCM In 3/4 Capture Switch'
  ; type=ENUMERATED,access=rw------,values=1,items=2
  ; Item #0 'An In 3/4'
  ; Item #1 'IEC958 In'
  : values=1
numid=8,iface=MIXER,name='IEC958 Playback Route'
  ; type=ENUMERATED,access=rw------,values=1,items=5
  ; Item #0 'PCM Out'
  ; Item #1 'H/W In 0'
  ; Item #2 'H/W In 1'
  ; Item #3 'IEC958 In L'
  ; Item #4 'IEC958 In R'
  : values=0
numid=9,iface=MIXER,name='IEC958 Playback Route',index=1
  ; type=ENUMERATED,access=rw------,values=1,items=5
  ; Item #0 'PCM Out'
  ; Item #1 'H/W In 0'
  ; Item #2 'H/W In 1'
  ; Item #3 'IEC958 In L'
  ; Item #4 'IEC958 In R'
  : values=0
.....

The ctl definition overrides the control elements added by the equal plugin to control elements of my card hw:3. And suddenly the element at ID 8 is not the 4k slider, but something completely else - Master Playback Volume in MrGlasspoole's setup.

IMO amixer command called from peppy should identify the control elements by their name, not just their ID. In the aforementioned setup amixer would not find the 4k element, return an error code which could be handled somehow.