Hi,I want to play several WAV files at the same time

If I use rtmixer to code, do I need to proportionally combine the contents of the WAV files into the buffer first, and then send this buffer to the stream?

I found a solution, referred to signal_processing.py code.

dsp_buffer2 = np.zeros((dsp_size, channels), dtype=‘float32’)

wri = True
f1 = sf.SoundFile(“test1.wav”)
def hypothetical_dsp_algorithm(buffer):
assert len(buffer) == dsp_size
#time.sleep(dsp_duration)
global wri
global dsp_buffer2
if wri == True:
written = f1.buffer_read_into(dsp_buffer2,dtype=‘float32’)
if written < dsp_size:
f1.seek(0)
np.divide(2.0,dsp_buffer2)
np.divide(2.0,buffer)
buffer += dsp_buffer2
else:
time.sleep(dsp_duration)
global dsp_calls
dsp_calls += 1

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.