pedalboard
pedalboard copied to clipboard
Using Audiostream's read() and write() methods simultaneously can result in noise.
here is my code
with AudioStream(num_output_channels=2,
output_device_name=AudioStream.default_output_device_name,
buffer_size=20000) as out:
with AudioStream(
input_device_name=AudioStream.input_device_names[2],
buffer_size=20000,
sample_rate=TARGET_SAMPLE_RATE) as ins:
try:
while True:
print("reading...")
# 88-882
buffer= ins.read(1024)
buffer = board.process(buffer,sample_rate=SAMPLE_RATE)
out.write(buffer,sample_rate=TARGET_SAMPLE_RATE)
but if i only use one audiostream,it behaves well
def test2():
with AudioStream(
input_device_name=AudioStream.input_device_names[2], # Guitar interface
output_device_name=AudioStream.default_output_device_name
) as stream:
# Audio is now streaming through this pedalboard and out of your speakers!
stream.plugins = Pedalboard([
Reverb(room_size=0.25),
PitchShift(semitones=10)
])
input("Press enter to stop streaming...")
the reason why i use write() and read() is i need change pitch by code without interrupt voice output, board.append() and board.remove() will interrupt output