I'm looking to make a loop system (inspired by Marc Rebillet, check him out) and am struggling with getting 2 sounds to play over themselves.
I've started out using sounddevice, as it's the first audio module that I found, but I'm not sure if there's a different once that would work better.
import time
def record(duration): # records a few seconds of audio
print('recording in:')
print('3')
time.sleep(1)
print('2')
time.sleep(1)
print('1')
time.sleep(1)
print('recording')
record = sd.rec(int(duration * fs), samplerate=48000, channels=2)
sd.wait()
print('done\n\n')
return record
duration = 3.5 # seconds
recordOne = record(duration)
recordTwo = record(duration)
while True: # repeats both pieces of audio
sd.play(recordOne, fs)
sd.play(recordTwo, fs)
sd.wait()
This code ended up only playing the recordTwo, and doesn't layer them over eachother. Again, I'd like to be able to play multiple sounds at the same time. Thank you for any help!