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.