Pyaudio How to get sound on only one speaker

后端 未结 4 939
误落风尘
误落风尘 2020-12-21 13:13

I\'m using pyaudio in a school project and I\'m trying to get the sound to play on only one speaker at a time. My code is like this:

import pyaudio

p = pyau         


        
4条回答
  •  情深已故
    2020-12-21 13:30

    Instead of PyAudio, you could use http://python-sounddevice.rtfd.org/.

    The play() function accepts a mapping argument to select the channel(s) to play back on.

    You could try this to play a mono NumPy array on the right channel:

    import sounddevice as sd
    sd.play(signal, samplerate=44100, mapping=[2])
    

提交回复
热议问题