So I’m trying to play an audio file that has a sampling rate of 16kHz. I use the following code to set up the audio:
from psychopy import prefs
prefs.general['audioLib'] = ['PTB']
from psychopy import sound
sound_names = ['01_16kHz.wav']
audio = sound.Sound()
When I want to play the audio I use the following code:
current_sound = sound_names.pop()
audio.setSound(current_sound)
audio.play()
I get the following error:
File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\sound\backend_sounddevice.py", line 365, in setSound
blockSize=self.blockSize)
File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\sound\backend_sounddevice.py", line 96, in getStream
blockSize=blockSize)
File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\sound\backend_sounddevice.py", line 135, in _getStream
.format(label, list(self.keys())[0], sys.platform)
psychopy.exceptions.SoundFormatError: Tried to create audio stream 16000_1_128 but 44100_1_128 already exists and win32 doesn't support multiple portaudio streams
I don’t have any other audio files in the directory, just the 16kHz one. How can I change the stream to be 16kHz instead of 44.1kHz?