MD2001
March 24, 2023, 6:56pm
1
Hello everyone
for my experiment I need to use sounds as stimuli. So, I made an Excel csv sheet with all my stimuli, but Psychopy doesn’t want to recognise it. I’ve tried multiple times, also with an other computer, but it doesn’t work. Can someone help me? The file-names are all correct.
This is the error code:
Chen
March 25, 2023, 8:44pm
2
Hello,
Did you read the following topic?
Thanks, the error message helps us get started!
From this, we can inspect the code in PsychoPy itself (backend_sounddevice.py”, line 452) and sure enough, we can see that the PsychoPy code here is assuming the sound to be mono or stereo, so we will certainly need to update this to support more flexible sounds specs.
As a starter, you could change this:
self.sndArr.shape = [len(thisArray), 2]
to this:
self.sndArr.shape = [len(thisArray), self.channels]
and …
I finally got it to work (with yours and a colleague’s help). Given that the sounddevice library you recommended was able to detect instances of the device with 4-channel outputs, I used that same library to specify and play the 4-channel device as follows:
import sounddevice as sd
import soundfile as sf
data, fs = sf.read(filename, dtype='float32')
sd.play(data, fs, device=10)
status = sd.wait()
The PsychoPy sound library also calls the same sounddevice library so I assume this can also b…