bastibe/SoundCard

multiple output support

Opened this issue · 1 comments

If more than one output is initialized, no sound is heard from either output.

This works:

speakers = sc.all_speakers()
mics = sc.all_microphones()

front_speaker = speakers[0]
input = mics[0]

with input.recorder(samplerate=48000) as mic, \
      front_speaker.player(samplerate=48000) as f_sp:
    for _ in range(100):
        data = input.record(numframes=1024)
        f_sp.play(data)

Neither speaker plays audio in this case:

speakers = sc.all_speakers()
mics = sc.all_microphones()

front_speaker = speakers[0]
rear_speaker = speakers[1]
input = mics[0]

with input.recorder(samplerate=48000) as mic, \
      front_speaker.player(samplerate=48000) as f_sp, \
      rear_speaker.player(samplerate=48000) as r_sp:
    for _ in range(100):
        data = input.record(numframes=1024)
        f_sp.play(data)
        r_sp.play(data)

Is this a limitation of pulseaudio? I'm aware of module-combine-sink but the goal will be to process (control volume, frequency) front/rear speakers separately.

Since there is no error message, I'm not sure where to start to debug. Guidance appreciated.

Usually, a "speaker" in SoundCard's terms refers to a sound card. Each sound card has several channels, corresponding to individual physical loudspeakers.

So you'd need to address individual channels of your main "speaker" in order to control front/rear speakers separately.