2

I did try the both the solutions given here, however it fails with the following error.

    m = alsaaudio.Mixer('PCM')
alsaaudio.ALSAAudioError: Unable to find mixer control 'PCM',0

I'm assuming that my mixer control is not PCM. When I change the volume on my laptop, I use alsamixer, and where I select the sound card to be HDA Intel PCH. I'm using the Realtek ALC3235.

Here is the result from my amixer

Simple mixer control 'IEC958',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'IEC958',1
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'IEC958',2
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]

How should I fix this?

After the change from CL.

This is what my amixer looks like.. maybe this is of any help

Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 87
  Mono: Playback 75 [86%] [-9.00dB] [on]
Simple mixer control 'Headphone',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [off]
  Front Right: Playback [off]
Simple mixer control 'Headphone+LO',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 0 [0%] [-65.25dB]
  Front Right: Playback 0 [0%] [-65.25dB]
Simple mixer control 'Speaker',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 87 [100%] [0.00dB] [on]
  Front Right: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'PCM',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 255 [100%] [0.00dB]
  Front Right: Playback 255 [100%] [0.00dB]
Simple mixer control 'Line Out',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 63
  Front Left: Capture 52 [83%] [21.75dB] [on]
  Front Right: Capture 52 [83%] [21.75dB] [on]
Simple mixer control 'Auto-Mute Mode',0
  Capabilities: enum
  Items: 'Disabled' 'Speaker Only' 'Line Out+Speaker'
  Item0: 'Line Out+Speaker'
Simple mixer control 'Dock Mic',0
  Capabilities: cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Capture channels: Mono
  Mono: Capture [off]
Simple mixer control 'Dock Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
Simple mixer control 'Headset Mic',0
  Capabilities: cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Capture channels: Mono
  Mono: Capture [off]
Simple mixer control 'Headset Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
Simple mixer control 'Internal Mic',0
  Capabilities: cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Capture channels: Mono
  Mono: Capture [on]
Simple mixer control 'Internal Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
  • Setting the Mixer to IEC958 did the job, but that does not help setting the volume :-).. neither is it the correct card. – tandem Oct 8 '16 at 16:39
  • Do you have an update on this? I am not sure how to get this working.. – tandem Oct 11 '16 at 12:28
0

alsaaudio goes to the default sound card. By default, this is the first card, which in your case appears to be the HDMI output.

To make the second card the default, add the following to /etc/asound.conf or your ~/.asoundrc:

defaults.ctl.card 1
defaults.pcm.card 1
  • It still gives 0 with getvolume() when it is set to 80 – tandem Oct 8 '16 at 16:57
0

From your amixer result, this could work:

m = alsaaudio.Mixer(1,'PCM')

The "1" is for the 2nd sound device (HDA Intel).

  • No, because PCM does not exist.. IEC958 is the only option. and it exits with the following errorTypeError: argument 1 must be string, not int – tandem Oct 9 '16 at 13:04
  • 1
    Eitherway, it should be alsaaudio.Mixer(control='IE958', id=x) where x is a positive integer. Even this does not help. wonder what is missing – tandem Oct 9 '16 at 13:07
  • Does this works (1 is the index for 2nd device , try also 0 if not ok ) amixer -c 1 set PCM 50 – laugeo Oct 9 '16 at 14:06
  • Yes, sure. the PCM volume is controlled. but that is not effecting the output of m.getvolume() – tandem Oct 9 '16 at 14:55
  • The issue is, if the parameter for control is passed as anything other than IEC958.. it fails with an error – tandem Oct 9 '16 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.