PiSupply / JustBoom

Resources for JustBoom range
https://JustBoom.co
15 stars 5 forks source link

Rotary doesn't work with Volumio 2.246 #7

Open nullgat opened 7 years ago

nullgat commented 7 years ago

Looking at jb-rotary.py I think the issue is that volumio recently changed the internal names of the justboom cards.

shawaj commented 7 years ago

Is it just the rotary encoder script that doesn't work?

francesco-vannini commented 7 years ago

Yes @nullgat see this https://github.com/volumio/Volumio2/issues/1307 too. I'll check what happened although the script should have handled the new name too. If you have it handy what does aplay -l return with?

francesco-vannini commented 7 years ago

aplay -l outputs List of PLAYBACK Hardware Devices card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: sndrpijustboomd [snd_rpi_justboom_dac], device 0: JustBoom DAC HiFi pcm512x-hifi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0

AFAICT the script should still be working. What's the error you get?

francesco-vannini commented 7 years ago

@nullgat could you also provide the output of sudo systemctl status jb-rotary.service

nullgat commented 7 years ago

fixed config.txt and got the aplay output to look identical, but still receive this

● jb-rotary.service - Starts JustBoom Rotary Volume Control
   Loaded: loaded (/etc/systemd/system/jb-rotary.service; enabled)
   Active: failed (Result: exit-code) since Sat 2017-08-26 21:20:59 UTC; 4min 59s ago
  Process: 488 ExecStart=/opt/justboom/jb-rotary.py (code=exited, status=1/FAILURE)
 Main PID: 488 (code=exited, status=1/FAILURE)

Aug 26 21:20:50 volumio systemd[1]: Starting Starts JustBoom Rotary Volume Control...
Aug 26 21:20:50 volumio systemd[1]: Started Starts JustBoom Rotary Volume Control.
Aug 26 21:20:59 volumio jb-rotary.py[488]: Traceback (most recent call last):
Aug 26 21:20:59 volumio jb-rotary.py[488]: File "/opt/justboom/jb-rotary.py", line 5, in <module>
Aug 26 21:20:59 volumio jb-rotary.py[488]: import alsaaudio
Aug 26 21:20:59 volumio jb-rotary.py[488]: ImportError: No module named alsaaudio
Aug 26 21:20:59 volumio systemd[1]: jb-rotary.service: main process exited, code=exited, status=1/FAILURE
Aug 26 21:20:59 volumio systemd[1]: Unit jb-rotary.service entered failed state.

on a zero w and using amp zero

tvoverbeek commented 7 years ago

Looks like you do not have the package python-alsaaudio installed. Try to install it: 'sudo apt-get install python-alsaaudio' and see if you get a bit further.

nullgat commented 6 years ago

Solved, I had to manually install some dependencies, python, alsaaudio, and RPI.GPIO. Not sure why these weren't already on my pi, or not being fixed by the install script?

shawaj commented 6 years ago

I guess Volumio just don't have that stuff installed by default to keep it lightweight

francesco-vannini commented 6 years ago

@nullgat the install already takes care of installing those two libraries so I am not really sure what happened with your particular installation. Glad you fixed things in the end.

shawaj commented 6 years ago

@francesco-vannini will ALSA itself already be installed on all systems? Not just the python add on?

francesco-vannini commented 6 years ago

Indeed the problem for this issue was the lack of -y in the install script. We'll fix that

fabianbrunke commented 6 years ago

Cannot get this to work on Volumio (v. 2.368). Don't want to open a new issue though..

During install I got this error:

volumio@volumio:~$ curl -sSL https://pisupp.ly/jb-rotarycode | sudo bash
Reading package lists... Done
Building dependency tree
Reading state information... Done
whiptail is already the newest version.
git is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-alsaaudio
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-rpi.gpio
E: Couldn't find any package by regex 'python-rpi.gpio'
Cloning into 'JustBoom'...
remote: Counting objects: 99, done.
remote: Total 99 (delta 0), reused 0 (delta 0), pack-reused 99
Unpacking objects: 100% (99/99), done.
Checking connectivity... done.
Created symlink from /etc/systemd/system/multi-user.target.wants/jb-rotary.service to /etc/systemd/system/jb-rotary.service.
volumio@volumio:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: sndrpijustboomd [snd_rpi_justboom_dac], device 0: JustBoom DAC HiFi pcm512x-hifi-0 []
Subdevices: 0/1
Subdevice #0: subdevice #0
volumio@volumio:~$ sudo systemctl status jb-rotary.service
● jb-rotary.service - Starts JustBoom Rotary Volume Control
   Loaded: loaded (/etc/systemd/system/jb-rotary.service; enabled)
   Active: failed (Result: exit-code) since Sun 2018-02-25 20:11:37 UTC; 9min ago
 Main PID: 478 (code=exited, status=1/FAILURE)

Feb 25 20:11:28 volumio systemd[1]: Started Starts JustBoom Rotary Volume Control.
Feb 25 20:11:36 volumio jb-rotary.py[478]: Traceback (most recent call last):
Feb 25 20:11:36 volumio jb-rotary.py[478]: File "/opt/justboom/jb-rotary.py", line 5, in <module>
Feb 25 20:11:36 volumio jb-rotary.py[478]: import alsaaudio
Feb 25 20:11:36 volumio jb-rotary.py[478]: ImportError: No module named alsaaudio
Feb 25 20:11:37 volumio systemd[1]: jb-rotary.service: main process exited, code=exited, status=1/FAILURE
Feb 25 20:11:37 volumio systemd[1]: Unit jb-rotary.service entered failed state.

After manually installing python-alsaaudio and python.rpi-gpio following error occurs:

volumio@volumio:~$ systemctl status jb-rotary.service
● jb-rotary.service - Starts JustBoom Rotary Volume Control
   Loaded: loaded (/etc/systemd/system/jb-rotary.service; enabled)
   Active: inactive (dead) since Sun 2018-02-25 20:23:48 UTC; 6s ago
  Process: 5871 ExecStart=/opt/justboom/jb-rotary.py (code=exited, status=0/SUCCESS)
 Main PID: 5871 (code=exited, status=0/SUCCESS)

Feb 25 20:23:47 volumio systemd[1]: Started Starts JustBoom Rotary Volume Control.
Feb 25 20:23:48 volumio jb-rotary.py[5871]: ('Configuring rotary encoder as ', 'standard')
Feb 25 20:23:48 volumio jb-rotary.py[5871]: There are no suitable cards
francesco-vannini commented 6 years ago

Volumio seems to have changed something for which the Digital mixer is no longer available

>>> print alsaaudio.cards()
[u'ALSA', u'sndrpijustboomd']
>>> print alsaaudio.mixers()
[u'PCM']

I don't know how to sort this at the moment, let's keep an eye at there next version. @tvoverbeek do you have any ideas?

francesco-vannini commented 6 years ago

aplay and amixer of course reports the same

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sndrpijustboomd [snd_rpi_justboom_dac], device 0: JustBoom DAC HiFi pcm512x-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

amixer
Simple mixer control 'PCM',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback -10239 - 400
  Mono: Playback -925 [88%] [-9.25dB] [on]

amixer finally finds the Digital mixer when issuing:

amixer -c 1
Simple mixer control 'DSP Program',0
  Capabilities: enum
  Items: 'FIR interpolation with de-emphasis' 'Low latency IIR with de-emphasis' 'High attenuation with de-emphasis' 'Fixed process flow' 'Ringing-less low latency FIR'
  Item0: 'FIR interpolation with de-emphasis'
Simple mixer control 'Analogue',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 1
  Mono:
  Front Left: Playback 1 [100%] [0.00dB]
  Front Right: Playback 1 [100%] [0.00dB]
Simple mixer control 'Analogue Playback Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 1
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
Simple mixer control 'Auto Mute',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]
Simple mixer control 'Auto Mute Mono',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Auto Mute Time Left',0
  Capabilities: enum
  Items: '21ms' '106ms' '213ms' '533ms' '1.07s' '2.13s' '5.33s' '10.66s'
  Item0: '21ms'
Simple mixer control 'Auto Mute Time Right',0
  Capabilities: enum
  Items: '21ms' '106ms' '213ms' '533ms' '1.07s' '2.13s' '5.33s' '10.66s'
  Item0: '21ms'
Simple mixer control 'Clock Missing Period',0
  Capabilities: enum
  Items: '1s' '2s' '3s' '4s' '5s' '6s' '7s' '8s'
  Item0: '1s'
Simple mixer control 'Deemphasis',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Digital',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 207
  Mono:
  Front Left: Playback 180 [87%] [-13.50dB] [on]
  Front Right: Playback 180 [87%] [-13.50dB] [on]
Simple mixer control 'Max Overclock DAC',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 40
  Mono: 0 [0%]
Simple mixer control 'Max Overclock DSP',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 40
  Mono: 0 [0%]
Simple mixer control 'Max Overclock PLL',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 20
  Mono: 0 [0%]
Simple mixer control 'SoftMaster',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 99
  Front Left: 59 [60%]
  Front Right: 59 [60%]
Simple mixer control 'Volume Ramp Down Emergency Rate',0
  Capabilities: enum
  Items: '1 sample/update' '2 samples/update' '4 samples/update' 'Immediate'
  Item0: '1 sample/update'
Simple mixer control 'Volume Ramp Down Emergency Step',0
  Capabilities: enum
  Items: '4dB/step' '2dB/step' '1dB/step' '0.5dB/step'
  Item0: '4dB/step'
Simple mixer control 'Volume Ramp Down Rate',0
  Capabilities: enum
  Items: '1 sample/update' '2 samples/update' '4 samples/update' 'Immediate'
  Item0: '1 sample/update'
Simple mixer control 'Volume Ramp Down Step',0
  Capabilities: enum
  Items: '4dB/step' '2dB/step' '1dB/step' '0.5dB/step'
  Item0: '1dB/step'
Simple mixer control 'Volume Ramp Up Rate',0
  Capabilities: enum
  Items: '1 sample/update' '2 samples/update' '4 samples/update' 'Immediate'
  Item0: '1 sample/update'
Simple mixer control 'Volume Ramp Up Step',0
  Capabilities: enum
  Items: '4dB/step' '2dB/step' '1dB/step' '0.5dB/step'
  Item0: '1dB/step'
shawaj commented 6 years ago

Put an issue on volumio github?

On Mon, Feb 26, 2018 at 11:18 AM, Ciccio notifications@github.com wrote:

Reopened #7 https://github.com/PiSupply/JustBoom/issues/7.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PiSupply/JustBoom/issues/7#event-1491771427, or mute the thread https://github.com/notifications/unsubscribe-auth/ADNCuvAJ_0P8p_KcO0_rv7_vNeaCZkyjks5tYpLpgaJpZM4O8PXp .

tvoverbeek commented 6 years ago

Noticed on the Volumio github that the justboom cards are specified as I2S without any mixer definition. Could that have something to do with it? I am no audio expert ...

shawaj commented 6 years ago

@francesco-vannini has that changed from before?

On 2 Mar 2018 12:49, "Ton van Overbeek" notifications@github.com wrote:

Noticed on the Volumio github that the justboom cards are specified as I2S without any mixer definition. Could that have something to do with it? I am no audio expert ...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PiSupply/JustBoom/issues/7#issuecomment-369912400, or mute the thread https://github.com/notifications/unsubscribe-auth/ADNCupGhwkzxraRKs9kfvMoJjMe6pe3Yks5taT_PgaJpZM4O8PXp .

shawaj commented 6 years ago

I think they used to have hardware mixer for the amp/DAC driver.

Same as hifiberry and iqaudio

@tvoverbeek where are you seeing that?

On 2 Mar 2018 14:01, shawaj@gmail.com wrote:

@francesco-vannini has that changed from before?

On 2 Mar 2018 12:49, "Ton van Overbeek" notifications@github.com wrote:

Noticed on the Volumio github that the justboom cards are specified as I2S without any mixer definition. Could that have something to do with it? I am no audio expert ...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PiSupply/JustBoom/issues/7#issuecomment-369912400, or mute the thread https://github.com/notifications/unsubscribe-auth/ADNCupGhwkzxraRKs9kfvMoJjMe6pe3Yks5taT_PgaJpZM4O8PXp .

tvoverbeek commented 6 years ago

From https://github.com/volumio/Volumio2/blob/master/app/plugins/system_controller/i2s_dacs/dacs.json the justboom definitions:

{"id":"justboom-amp","name":"JustBoom Amp Boards","overlay":"justboom-dac","alsanum":"1","mixer":"Digital","modules":"","script":"","eeprom_name":["JustBoom DAC HAT","JustBoom DAC HAT v1.1"],"needsreboot":"yes"},
{"id":"justboom-dac","name":"JustBoom DAC Boards","overlay":"justboom-dac","alsanum":"1","mixer":"Digital","modules":"","script":"","eeprom_name":["JustBoom DAC HAT","JustBoom DAC HAT v1.1"],"needsreboot":"yes"},
{"id":"justboom-digi","name":"JustBoom Digi Boards","overlay":"justboom-digi","alsanum":"1","mixer":"","modules":"","script":"","eeprom_name":["JustBoom Digi HAT","JustBoom Digi HAT v1.1"],"needsreboot":"yes"},

justboom-digi has an empty mixer definition.

shawaj commented 6 years ago

Ah yes that's correct, it should do. You can't change volume with the Digi. It has not got a hardware volume control

On 2 Mar 2018 17:03, "Ton van Overbeek" notifications@github.com wrote:

From https://github.com/volumio/Volumio2/blob/master/app/ plugins/system_controller/i2s_dacs/dacs.json the justboom definitions:

{"id":"justboom-amp","name":"JustBoom Amp Boards","overlay":"justboom-dac","alsanum":"1","mixer":"Digital","modules":"","script":"","eeprom_name":["JustBoom DAC HAT","JustBoom DAC HAT v1.1"],"needsreboot":"yes"}, {"id":"justboom-dac","name":"JustBoom DAC Boards","overlay":"justboom-dac","alsanum":"1","mixer":"Digital","modules":"","script":"","eeprom_name":["JustBoom DAC HAT","JustBoom DAC HAT v1.1"],"needsreboot":"yes"}, {"id":"justboom-digi","name":"JustBoom Digi Boards","overlay":"justboom-digi","alsanum":"1","mixer":"","modules":"","script":"","eeprom_name":["JustBoom Digi HAT","JustBoom Digi HAT v1.1"],"needsreboot":"yes"},

justboom-digi has an empty mixer definition.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PiSupply/JustBoom/issues/7#issuecomment-369984004, or mute the thread https://github.com/notifications/unsubscribe-auth/ADNCuuzRSlJkJT6r53_bV7HKRzQIx8REks5taXtegaJpZM4O8PXp .

francesco-vannini commented 6 years ago

The interesting/annoying bit is that alsamixer shows instead the mixer with the various controls. I really don't understand what happened and how it should be fixed in Volumio.

shawaj commented 6 years ago

What did it show before?

I thought we never had volume control with the Digi?

Or we did but just only in software?

On 5 Mar 2018 08:42, "Ciccio" notifications@github.com wrote:

The interesting/annoying bit is that alsamixer shows instead the mixer with the various controls. I really don't understand what happened and how it should be fixed in Volumio.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PiSupply/JustBoom/issues/7#issuecomment-370347065, or mute the thread https://github.com/notifications/unsubscribe-auth/ADNCuu1_e_k42vMBN2Ha8n24qAwpGNvRks5tbPpfgaJpZM4O8PXp .

francesco-vannini commented 6 years ago

For the Digi is a different story and in fact we have a virtual control for that in the script. @fabbaf is however using a DAC so the "Digital" control should be listed when issuing: In Python

print alsaaudio.mixers()

or on the shell

amixer -c 1

In previous versions of Volumio we had no problems with this.

tvoverbeek commented 6 years ago

Found out what the problem is. Nothing to do with Volumio, but a logic error in jb-rotary.py. If you follow the justboom install instructions for Raspbian, the internal alsa soundcard is disabled and the justboom card is the only one available. Then the code works.

If the internal sound card is also present, then justboom is card 1 and the internal one card 0. The for loop starting at line 84 of jb-rotary.py first tests card 0. There is no 'Digital' in the alsaaudio.mixers() output -> so you go to the else clause on line 93 and the program exits. By the way alsaaudio.mixers() on lines 87 and 90 should be alsaaudio.mixers(i) Will test a mod with my justboom zero-dac and then submit a pull request later.

francesco-vannini commented 6 years ago

Well spotted @tvoverbeek on both accounts. Something must have changed in Volumio though because as wrong as the code was it used to work before so maybe the onboard audio card maybe used to get disabled and now isn't anymore. Good that getting rid of those bugs will make the code more robust, you are a star ... as usual

tvoverbeek commented 6 years ago

Just submitted PR #10. Please review and test.

FedorMil commented 6 years ago

Good day! I have the system RPi Zero + Justboom Amp Zero + Volumio v2.368. Installed the plug-in on the encoder and still it does not work. When the script is manually started, the signal from the encoder goes, but there are no changes in the volumio mixer.

When run systemctl status jb-rotary.service ● jb-rotary.service - Starts JustBoom Rotary Volume Control Loaded: loaded (/usr/lib/systemd/system/jb-rotary.service; static) Active: active (running) since Wed 2018-04-11 03:16:19 UTC; 2min 33s ago Main PID: 616 (python) CGroup: /system.slice/jb-rotary.service └─616 python /opt/justboom/jb-rotary.py

Apr 11 03:16:19 luckymen systemd[1]: Started Starts JustBoom Rotary Volume ...l. Hint: Some lines were ellipsized, use -l to show in full.

What could be the problem???

FedorMil commented 6 years ago

https://github.com/francesco-vannini Today, the plugin has been reinstalled, but nothing has changed

volumio@luckymen:~$ systemctl -l status jb-rotary.service ● jb-rotary.service - Starts JustBoom Rotary Volume Control Loaded: loaded (/usr/lib/systemd/system/jb-rotary.service; static) Active: active (running) since Thu 2018-04-12 03:51:23 UTC; 2min 26s ago Main PID: 579 (python) CGroup: /system.slice/jb-rotary.service └─579 python /opt/justboom/jb-rotary.py

Apr 12 03:51:23 luckymen systemd[1]: Started Starts JustBoom Rotary Volume Control.