Does it mean that you can use only card 0? If you specify anything else you loose the equalizer functionality.
Well, equal plugin works differently than e.g. softvol.
Softvol adds its control to controls list of the underlying hw:X card:
alsa-lib/pcm_softvol.c at master * alsa-project/alsa-lib * GitHub
alsa-lib/pcm_softvol.c at master * alsa-project/alsa-lib * GitHub
alsa-lib/pcm_softvol.c at master * alsa-project/alsa-lib * GitHub
That means upon opening the PCM device which has the softvol plugin in its configured chain, the softvol CTL element is added to the list of hw:X device controls, permanently.
However the equal plugin does not do that, it uses the ctl API for creating its control elements. If the CTL config for the "equal" PCM device defines a different CTL config (e.g. by using the control of the actual card by configuring ctl.equal = type hw, card X), the controls of the equal plugin are not used at all.
Actually configuring ctl.equal type=equal is supported, the config is used for fine-tuning the equalizer params alsaequal/README at master * raedwulf/alsaequal * GitHub .
Source code is the best documentation 🙂
Softvol adds its control to controls list of the underlying hw:X card:
alsa-lib/pcm_softvol.c at master * alsa-project/alsa-lib * GitHub
alsa-lib/pcm_softvol.c at master * alsa-project/alsa-lib * GitHub
alsa-lib/pcm_softvol.c at master * alsa-project/alsa-lib * GitHub
That means upon opening the PCM device which has the softvol plugin in its configured chain, the softvol CTL element is added to the list of hw:X device controls, permanently.
However the equal plugin does not do that, it uses the ctl API for creating its control elements. If the CTL config for the "equal" PCM device defines a different CTL config (e.g. by using the control of the actual card by configuring ctl.equal = type hw, card X), the controls of the equal plugin are not used at all.
Actually configuring ctl.equal type=equal is supported, the config is used for fine-tuning the equalizer params alsaequal/README at master * raedwulf/alsaequal * GitHub .
Source code is the best documentation 🙂
Thank you phofman! Though I'm still not sure how I can handle in the player both controls - volume and equalizer in case of card 1 ?
MrGlasspole,
when player starts it logs the following messages:
Did you see that? If not, please make sure that you set file.logging = True
and specified a valid file name in the property log.filename. Here is the example:
The player mostly logs messages in case of errors. When player starts it overrides the previous log file.
Best regards
when player starts it logs the following messages:
Code:
[2020-07-09 17:49:59,571] {webserver.py:106} DEBUG - Web Server Started
[2020-07-09 17:50:00,057] {peppy.py:313} DEBUG - Audio Server Started
and specified a valid file name in the property log.filename. Here is the example:
Code:
[logging]
file.logging = True
log.filename = /home/pi/Peppy/peppy.log
console.logging = False
enable.stdout = True
show.mouse.events = False
The player mostly logs messages in case of errors. When player starts it overrides the previous log file.
Best regards
Thank you phofman! Though I'm still not sure how I can handle in the player both controls - volume and equalizer in case of card 1 ?
IMO access to equalizer controls would be amixer -D equal (provided ctl.equal is not redirected to the hw card), and access to the soundcard controls would be amixer -c CARD_NAME.
As far as I remember some posts ago MrGlasspoole mentioned that this combination didn't work:
Peppy player
Peppy player
Code:
pcm.equal {
type equal
slave.pcm "hw:1"
}
Code:
pavel@x220 ~ $ amixer -D equal contents
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
Code:
pavel@x220 ~ $ amixer -c 1
Simple mixer control 'Master',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback 0 - 74
Mono: Playback 74 [100%] [0.00dB] [off]
Simple mixer control 'Headphone',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 74
Mono:
Front Left: Playback 0 [0%] [-74.00dB] [off]
Front Right: Playback 0 [0%] [-74.00dB] [off]
............
............
Did you see that? If not, please make sure that you set file.logging = TrueCode:[2020-07-09 17:49:59,571] {webserver.py:106} DEBUG - Web Server Started [2020-07-09 17:50:00,057] {peppy.py:313} DEBUG - Audio Server Started
The file is just empty and my settings are:
Code:
[logging]
file.logging = True
log.filename = /home/haegarthehorrible/opt/Peppy/peppy.log
console.logging = False
enable.stdout = True
show.mouse.events = False
Then i get a new empty peppy.log. So path is correct...
Last edited:
Hmm, I'm not sure what else can go wrong. Here is the place where the logging initialization happens:
Peppy/config.py at 87daa889969de9b0215731785318e903b136219e * project-owner/Peppy * GitHub
I hope that 'pi' user has a write permission for that folder/file assuming that you are starting the player as 'pi' user.
Peppy/config.py at 87daa889969de9b0215731785318e903b136219e * project-owner/Peppy * GitHub
I hope that 'pi' user has a write permission for that folder/file assuming that you are starting the player as 'pi' user.
phofman, unfortunately at the moment I cannot test that myself (I don't have any card 1). So I need to ask MrGlasspoole if that works or not with the player. Thank you!
User is "haegarthehorrible"I hope that 'pi' user has a write permission for that folder/file assuming that you are starting the player as 'pi' user.
Owner and group of the peppy.log is "haegarthehorrible"
Permissions are 644
I can write and save text with nano in peppy.log
And since Peppy is creating that log by itself if it does not exist...
I will look at the alsa stuff later step by step.
I need to write down what works with what configuration.
Took a whole day to figure out that WLAN/Bluetooth command line stuff do get the Intel AX200 working.
Later i will get a JBL GO 2 speaker and then i can also test BT sound.
MrGlasspoole, if you are not tired yet debugging this logging issue 🙂 you can try to replace two lines of code here:
Peppy/config.py at 87daa889969de9b0215731785318e903b136219e * project-owner/Peppy * GitHub
by these two lines:
then start the player from the terminal: python3 peppy.py. I hope it will show the error message (if any) related to the file logging in the console.
Thanks a lot for your help!
Peppy/config.py at 87daa889969de9b0215731785318e903b136219e * project-owner/Peppy * GitHub
by these two lines:
Code:
except Exception as e:
print(e)
Thanks a lot for your help!
I guess i have to set "console.logging = True"
If i do that i see:
and its also in the peppy.log.
If i reboot the log is empty again.
If i do that i see:
Code:
$ python3 peppy.py
pygame 1.9.6
Hello from the pygame community. [url=https://www.pygame.org/contribute.html]Contribute - pygame wiki[/url]
[2020-07-10 02:30:37,599] {peppy.py:313} DEBUG - Audio Server Started
If i reboot the log is empty again.
The console logging is helpful when you start the player in the terminal. It's not required for the file logging. I think if you disable the console logging then the file logging will be still working. Maybe the problem is in the current working directory when you start the player. Where did you install the player? Is it /home/haegarthehorrible/opt/Peppy/ ? Adding those two lines could help to identify the problem.
Last edited:
Yes that's the location.
Since Network does nothing - just showing "Loading..." the whole time, i thought lets see if the terminal now says something.
Yes it does:
And its also in the peppy.log put the "rfkill: not found" part is not there:
rfkill is there because i did install it when installing the Intel AX200.
But i need to run it with sudo:
Since Network does nothing - just showing "Loading..." the whole time, i thought lets see if the terminal now says something.
Yes it does:
Code:
[2020-07-10 02:46:45,081] {bluetoothutil.py:89} DEBUG - Starting bluetoothctl utility...
/bin/sh: 1: rfkill: not found
[2020-07-10 02:46:45,094] {bluetoothutil.py:94} DEBUG - Cannot start bluetoothctl utility: Command 'rfkill unblock bluetooth' returned non-zero exit status 127.
[2020-07-10 02:46:45,095] {bluetoothutil.py:96} DEBUG - bluetoothctl utility started
Code:
[2020-07-10 02:46:45,081] {bluetoothutil.py:89} DEBUG - Starting bluetoothctl utility...
[2020-07-10 02:46:45,094] {bluetoothutil.py:94} DEBUG - Cannot start bluetoothctl utility: Command 'rfkill unblock bluetooth' returned non-zero exit status 127.
[2020-07-10 02:46:45,095] {bluetoothutil.py:96} DEBUG - bluetoothctl utility started
But i need to run it with sudo:
Code:
$ sudo rfkill
ID TYPE DEVICE SOFT HARD
0 bluetooth hci0 unblocked unblocked
1 wlan phy0 unblocked unblocked
Code:
$ find / -name rfkill 2> /dev/null
/dev/rfkill
/sys/class/misc/rfkill
/sys/class/rfkill
/sys/devices/virtual/misc/rfkill
/sys/module/rfkill
/var/lib/systemd/rfkill
/usr/sbin/rfkill
/usr/lib/modules/5.4.0-0.bpo.4-amd64/kernel/net/rfkill
/usr/src/linux-headers-5.4.0-0.bpo.4-amd64/include/config/rfkill
/usr/share/doc/rfkill
/usr/share/bash-completion/completions/rfkill
You mean replacing:
by
I already did that.
EDIT
Thats funny.
I made config.py its original code.
If i boot the machine the peppy.log is empty.
But if i do:
i have:
in the peppy.log.
EDIT #2
I did look at bluetoothutil.py and see:
Isn't that hardcoding and bad practice?
So if somebody is using another username than "pi" that will give problems?
Code:
except:
pass
Code:
except Exception as e:
print(e)
EDIT
Thats funny.
I made config.py its original code.
If i boot the machine the peppy.log is empty.
But if i do:
Code:
$ ps aux | grep python
haegart+ 636 6.5 1.6 617580 63316 tty1 Sl 03:11 0:03 python3 peppy.py
haegart+ 716 0.0 0.0 6072 884 pts/0 S+ 03:12 0:00 grep python
haegarthehorrible@Cherry:~$ kill 636
haegarthehorrible@Cherry:~$ cd /home/haegarthehorrible/opt/Peppy
haegarthehorrible@Cherry:~/opt/Peppy$ export DISPLAY=:0.0
haegarthehorrible@Cherry:~/opt/Peppy$ python3 peppy.py
Code:
[2020-07-10 03:12:57,384] {peppy.py:313} DEBUG - Audio Server Started
EDIT #2
I did look at bluetoothutil.py and see:
Code:
ASOUNDRC_FILENAME = "/home/pi/.asoundrc"
So if somebody is using another username than "pi" that will give problems?
Last edited:
I found this: Bluetoothctl wrapper in Python * GitHub
And changing the line 91 in bluetoothutil.py to:
makes that error go away
And changing the line 91 in bluetoothutil.py to:
Code:
subprocess.check_output("PATH=/usr/sbin:$PATH; rfkill unblock bluetooth", shell = True)
'rfkill' doesn't need 'sudo' on Raspberry OS. Probably changing that command to 'sudo rfkill unblock bluetooth' can also solve the problem (?) /usr/sbin is usually in the PATH.
How do you start the player after reboot? Do you start it as a service as a user 'haegarthehorrible'? I'm still trying to understand why file logging doesn't work after reboot.
Yes, hard coding is a bad practice, I'll change that constant to '~/.asoundrc'. So far the code and all docs assumed that the player will be installed by the 'pi' user. There were not so many adventurous guys who tried to install the player on the OS other than Raspberry OS or under another name 🙂
Thank you for your help and patience! Your findings will help to improve the player and save time for the others.
How do you start the player after reboot? Do you start it as a service as a user 'haegarthehorrible'? I'm still trying to understand why file logging doesn't work after reboot.
Yes, hard coding is a bad practice, I'll change that constant to '~/.asoundrc'. So far the code and all docs assumed that the player will be installed by the 'pi' user. There were not so many adventurous guys who tried to install the player on the OS other than Raspberry OS or under another name 🙂
Thank you for your help and patience! Your findings will help to improve the player and save time for the others.
Even on Pi's i change the username 🙂
I auto login as haegarthehorrible:
For starting Peppy I use Xinitrc: Xinitrc - Debian Wiki
If Peppy will work on standard Debian it will run on every device 🙂
I will make a fresh install with user pi and see how that goes.
I auto login as haegarthehorrible:
Code:
~$ sudo usermod -a -G tty haegarthehorrible
~$ sudo nano /lib/udev/rules.d/50-udev-default.rules
>> CHANGE <<
SUBSYSTEM=="tty", KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620"
>> TO <<
SUBSYSTEM=="tty", KERNEL=="tty[0-9]*", GROUP="tty", MODE="0660"
~$ sudo mkdir -p /etc/systemd/system/getty@tty1.service.d
~$ sudo nano /etc/systemd/system/getty@tty1.service.d/override.conf
>> ADD <<
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin haegarthehorrible --noclear %I 38400 linux
~$ sudo systemctl enable [EMAIL="getty@tty1.service"]getty@tty1.service[/EMAIL]
Code:
~$ nano ~/.profile
#Startx Automatically
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
. startx
logout
fi
Code:
~$ nano ~/.xinitrc
#!/bin/sh
cd /home/haegarthehorrible/opt/Peppy
exec python3 peppy.py
I will make a fresh install with user pi and see how that goes.
Last edited:
- Home
- Source & Line
- PC Based
- Peppy player