I'm trying to play multiple sounds at the same time using this piece of code:
Code: Select all
import time
import board
import audiocore
import audiomixer
from audiopwmio import PWMAudioOut as AudioOut
num_voices = 2
audio = AudioOut(board.GP18, right_channel=board.GP19)
mixer = audiomixer.Mixer(voice_count=num_voices, sample_rate=22050, channel_count=1,
bits_per_sample=16, samples_signed=True)
audio.play(mixer)
mixer.voice[0].level = 1.0
mixer.voice[1].level = 1.0
wave0 = audiocore.WaveFile(open("/drumsacuff_22k_s16.wav","rb"))
mixer.voice[0].play( wave0, loop=True )
wave1 = audiocore.WaveFile(open("/snowpeaks_22k_s16.wav","rb"))
mixer.voice[1].play( wave1, loop=True )
Couldn't I just temporary store a .wav file from the sd card into a variable or someting like this, so that it is temporary stored on the raspberry pico ?
Or can I copy the some .wav files from sd card to the raspberry main directory in order to play them and then delete them when I'm finished with them ?
Thank you for your hekp ! :)