Re: [Dorset] Cannot Set the Volume Using amixer under bullseye

2022-01-02 Thread Terry Coles
On Sunday, 2 January 2022 13:59:11 GMT Hamish McIntyre-Bhatty wrote:
> Has Raspbian perhaps switched to using PipeWire for audio I wonder?
> Pipewire is meant to overcome the many issues with Pulseaudio so I
> wonder if they might have done that, and that is the cause of the old
> commands not working.

I haven't been able to find many references to pipewire WRT the Raspberry Pi 
OS.  Interestingly in one Forum post, a user asking a query about the Pi 400, 
says 'I see that pulse audio and pipewire is running'. 

I see pipewire running on my desktop machine if I search for it in htop, but 
not on any of the three Pis I have running here (VPN, Music and Bells).  
However, they are all running Raspberry Pi OS Lite; the full version may have 
it or will get it soon.

> Definitely makes me think twice about upgrading the river system pis.

I only did it with these Pis because there's a fair time before they're needed 
in anger and it's easy to go back to buster using the SD Card backups.

I think that trying to bring all of the River System Pis up to bullseye at the 
same time would be a bit of a nightmare just at the moment.

-- 



Terry Coles



-- 
  Next meeting: Online, Jitsi, Tuesday, 2022-01-04 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Cannot Set the Volume Using amixer under bullseye

2022-01-02 Thread Hamish McIntyre-Bhatty

On 02/01/2022 10:54, Terry Coles wrote:

On Sunday, 2 January 2022 09:53:48 GMT Terry Coles wrote:

Initially it didn't work, but then I realised that pulseaudio probably
wasn't installed by default in Raspberry PI OS Lite. After installation I
got a permission error, but it worked after a reboot.

This is weird.  Installing pulseaudio allowed me to set the volume using the
'-D pulse' switch, but  I could get nothing from the speakers.  So I purged
pulseaudio and my speakers burst into life again.

The weird thing is that the command:

amixer -D pulse set Master 50%

still works.

How can that be?


Has Raspbian perhaps switched to using PipeWire for audio I wonder? 
Pipewire is meant to overcome the many issues with Pulseaudio so I 
wonder if they might have done that, and that is the cause of the old 
commands not working.


Definitely makes me think twice about upgrading the river system pis.

Hamish



--
 Next meeting: Online, Jitsi, Tuesday, 2022-01-04 20:00
 Check to whom you are replying
 Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
 New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Cannot Set the Volume Using amixer under bullseye

2022-01-02 Thread Terry Coles
On Sunday, 2 January 2022 09:53:48 GMT Terry Coles wrote:
> Initially it didn't work, but then I realised that pulseaudio probably
> wasn't installed by default in Raspberry PI OS Lite. After installation I
> got a permission error, but it worked after a reboot.

This is weird.  Installing pulseaudio allowed me to set the volume using the 
'-D pulse' switch, but  I could get nothing from the speakers.  So I purged 
pulseaudio and my speakers burst into life again.

The weird thing is that the command:

amixer -D pulse set Master 50%

still works.

How can that be?

-- 



Terry Coles



-- 
  Next meeting: Online, Jitsi, Tuesday, 2022-01-04 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Cannot Set the Volume Using amixer under bullseye

2022-01-02 Thread Terry Coles
On Saturday, 1 January 2022 10:23:26 GMT Terry Coles wrote:
> Things have moved on.  I have two Pis configured to use these speaker
> bonnets; a Pi 3 to play the music in the Nave and a Pi Zero to play the
> bells and chimes in the tower.  It turns out that amixer works fine on the
> Pi 3 but as described on the Zero.

I have no idea why this command works on a Pi 3, but not on a Zero (I'd love 
to know). However, a respondent on the Raspberry Pi Forums suggested using 
pulseaudio, eg:

amixer -D pulse set Master 50%

Initially it didn't work, but then I realised that pulseaudio probably wasn't 
installed by default in Raspberry PI OS Lite. After installation I got a 
permission error, but it worked after a reboot.

-- 



Terry Coles



-- 
  Next meeting: Online, Jitsi, Tuesday, 2022-01-04 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Cannot Set the Volume Using amixer under bullseye

2022-01-01 Thread Terry Coles
On Friday, 31 December 2021 17:40:58 GMT Patrick Wigmore wrote:
> This looks like it should be a valid command, based on the
> configuration you listed and according to the amixer man page that's
> in the Debian bullseye alsa-utils package.

Things have moved on.  I have two Pis configured to use these speaker bonnets; 
a Pi 3 to play the music in the Nave and a Pi Zero to play the bells and 
chimes in the tower.  It turns out that amixer works fine on the Pi 3 but as 
described on the Zero.

I've tried re-running the Adafruit installation script on the Zero and I've 
checked all the dependencies of alsa-utils; everything seems fine, except for 
the volume setting.

I've just posted a query on the Adafruit Forums, but if no-one can shed any 
light on this, I'll have to start again with a clean bullseye installation.  
If that doesn't work, I'll have to go back to buster, but only on the Zero

-- 



Terry Coles



-- 
  Next meeting: Online, Jitsi, Tuesday, 2022-01-04 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Cannot Set the Volume Using amixer under bullseye

2021-12-31 Thread Terry Coles
On Friday, 31 December 2021 17:40:58 GMT Patrick Wigmore wrote:
> This looks like it should be a valid command, based on the
> configuration you listed and according to the amixer man page that's
> in the Debian bullseye alsa-utils package.

It was certainly valid when I originally wrote it about 5 years ago!  It has 
worked throughout until this upgrade.

> Are you saying that the "amixer: Invalid command!" error is produced
> when you run that amixer command directly?
> 
> In other words, have you ruled out the possibility that the Python
> program has somehow begun to pass unexpected arguments to amixer?

Yes.  It fails from the shell and from the program.  In the Python program it 
is passed to the OS using:

subprocess.call(['amixer', '-c', '0', 'set', 'PCM', 'playback', tower_vol])

with tower_vol having been set previously.

As I say that line of code has worked for many years until now. 

(I dropped the 'playback in the command I gave in this thread because it was 
basically straight out of the man page.  It still fails if I add 'playback'.)

-- 



Terry Coles



-- 
  Next meeting: Online, Jitsi, Tuesday, 2022-01-04 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Cannot Set the Volume Using amixer under bullseye

2021-12-31 Thread Patrick Wigmore
On Fri, 31 Dec 2021 16:21:34 +, Terry Coles wrote:
> I need the volume to be controllable from my Python program, so I
> set it once at the beginning when the program is launched, eg:
> 
> amixer -c 0 set PCM 100

This looks like it should be a valid command, based on the 
configuration you listed and according to the amixer man page that's 
in the Debian bullseye alsa-utils package.

That form of command works fine with amixer 1.1.8 on my laptop.

Are you saying that the "amixer: Invalid command!" error is produced 
when you run that amixer command directly?

In other words, have you ruled out the possibility that the Python 
program has somehow begun to pass unexpected arguments to amixer?

Patrick



-- 
  Next meeting: Online, Jitsi, Tuesday, 2022-01-04 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Cannot Set the Volume Using amixer under bullseye

2021-12-31 Thread Terry Coles
On Friday, 31 December 2021 17:03:07 GMT PeterMerchant wrote:
> On my desktop  (Kubuntu 20.04)
> 
> Amixer gives:
> 
> peterm@peterm-MBB-34204H:~$ amixer
> Simple mixer control 'Master',0
>Capabilities: pvolume
>Playback channels: Front Left - Front Right
>Limits: Playback 0 - 31
>Mono:
>Front Left: Playback 31 [100%]
>Front Right: Playback 31 [100%]
> Simple mixer control '3D Control - Switch',0
>Capabilities: pswitch pswitch-joined
>Playback channels: Mono
>Mono: Playback [off]
> Simple mixer control 'PCM',0
>Capabilities: pvolume pswitch pswitch-joined cswitch
>Playback channels: Front Left - Front Right
>Capture channels: Front Left - Front Right
>Limits: Playback 0 - 31
>Front Left: Playback 24 [77%] [on] Capture [off]
>Front Right: Playback 24 [77%] [on] Capture [off]
> Simple mixer control 'Synth',0
> ..   and a whole bunch more
> 
> I notice that the setup is different.  Does it need to be 'pvolume' in
> yours?
 
The thing is Peter, command amixer without any parameters simply lists what 
devices the machine has and what the alsa capabilities are for each device.  
Your PCM sound device has the capability 'pvolume' and mine only has 'volume'.

AFAIK, I can't change those capabilities because they relate to the hardware 
installed.

Don't forget that this code worked before I upgraded to bullseye.

-- 



Terry Coles



-- 
  Next meeting: Online, Jitsi, Tuesday, 2022-01-04 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk


Re: [Dorset] Cannot Set the Volume Using amixer under bullseye

2021-12-31 Thread PeterMerchant

On 31/12/2021 16:21, Terry Coles wrote:

I'm beginning to think that upgrading the music and bells Pis to bullseye
might have been a bit premature.  I cannot get amixer to work properly. The
sound card is an Adafruit Speaker Bonnet. The code shown below worked under
buster.

Here is the configuration:

pi@minster-bells:~ $ amixer
Simple mixer control 'PCM',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 255
Front Left: 255 [100%]
Front Right: 255 [100%]

I need the volume to be controllable from my Python program, so I set it once
at the beginning when the program is launched, eg:

amixer -c 0 set PCM 100

(where the value is a variable in reality, but this doesn't work either.)

I get:

amixer: Invalid command!

Any thoughts on what could be wrong? speaker-test and playing an mp3 file works
fine using mpg123. I just can't set the volume.


On my desktop  (Kubuntu 20.04)

Amixer gives:

peterm@peterm-MBB-34204H:~$ amixer
Simple mixer control 'Master',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 31 [100%]
  Front Right: Playback 31 [100%]
Simple mixer control '3D Control - Switch',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'PCM',0
  Capabilities: pvolume pswitch pswitch-joined cswitch
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Front Left: Playback 24 [77%] [on] Capture [off]
  Front Right: Playback 24 [77%] [on] Capture [off]
Simple mixer control 'Synth',0
..   and a whole bunch more

I notice that the setup is different.  Does it need to be 'pvolume' in yours?

Peter


--
 Next meeting: Online, Jitsi, Tuesday, 2022-01-04 20:00
 Check to whom you are replying
 Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
 New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk