1

I use OutputStream in sounddevice to control the music stream and set the volume level of the different streams in its callback function. It is normal for each channel to have a volume of 0, but if I want to make one channel have sound alone, and all the other channels are set to 0, I find that the other channels still have a relatively small sound.

def process(outdata, frames, time, status):
    global frameNums
    start_index=frameNums*frames
    end_index=(frameNums+1)*frames

    frame_data=data[start_index:end_index,:]

    #Here I set the data of one channel to 0, it doesn't work, there is still litter sound
    frame_data=frame_data*[1,0]
    outdata[:]=frame_data

    frameNums+=1

stream = sd.OutputStream(samplerate=fs, channels=2, dtype='float32', callback=process)
stream.start()

When I set all the volume to 0, there is no sound, as long as one channel is greater than 0, both of my headphones will have sound.

keptupp
  • 11
  • 1

1 Answers1

0

Finally, the reason was found, and the audio enhancement in the Windows 11 system was turned off and it worked normally enter image description here

keptupp
  • 11
  • 1
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 13 '23 at 09:52