Closed RuABraun closed 4 years ago
SoundCard Speaker
s report the number of channels configured in pulseaudio. This can't be changed. You can change the number of channels you want to use in play
or player
, but only up to the number of channels reported by the Speaker
.
But SoundCard is really only a thin wrapper around pulseaudio. Most likely, your pulseaudio is configured wrongly or you are using the wrong soundcard.
Thank you for the response!
I know this is out of scope... but I'd really appreciate if you could give me a hint: Based on this I changed /etc/pulse/default.pa
by commenting
if foo
load-module module-udev-detect
else
load-module module-detect
endif
And added a line
load-module module-alsa-sink device=default:CARD=Headphones channels=2 rate=44100 channel_map=left,right
Based on the output of aplay -L
But this results in an error
...pulseaudio.py" line 72
assert self._pa_context_get_state(self.context) == _pa.PA_CONTEXT_READY
Any idea?
edit: Not getting the error anymore, no sound playing. Guess I need to figure out how write the load-module
line correctly.
edit2: Got it to work!! had to use the hw syntax and no default:
I'm glad you were able to figure out a solution. Could you post the solution here, so as to help me and other people who might experience a similar issue in the future?
I already mentioned the important details. To be more explicit, what worked was
load-module module-alsa-sink device=hw:1,0 channels=2 rate=44100 channel_map=left,right
restart pulse audio with pulseaudio --kill
and pulseaudio --start
. One should already be able to see if things are working correctly by calling pacmd list-sinks
(if it's not there'll be a "dummy" sink instead of the correct one, for me headphones).
Let me also use the opportunity to say I love this library! :)
Thank you very much for your kind words, and for documenting this solution.
I'm trying to use soundcard on raspberry pi. I can play a stereo wavfile using
aplay
and hear that it's really using stereo. But when I want to use soundcard thechannels
of thespeaker
is set to 1 and I can't change that, and I guess that is also why when I play the corresponding numpy array it mixes the two channels together and I can hear output in both of my earphones (even though I've set one channel to 0.).Is there something I can do to get around this constraint?