How can add audio to psychopy with excel sheet

If this template helps then use it. If not then just delete and start from scratch.

Win 10 (e.g. Win10):
PsychoPy 2023 1.2 (e.g. 1.84.x):
Standard Standalone? (y) If not then what?:
What are you trying to achieve?:
To add audio to my PsychoPy Experiment
What did you try to make it work?:
I used Excel sheets, directly added the audio
What specifically went wrong when you tried that?:
Generating PsychoPy script…

################## Running: D:\PsychoPy\Token Test_lastrun.py ##################
1854.6120 INFO Loaded monitor calibration from [‘2023_06_13 10:06’]
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Traceback (most recent call last):
File “D:\PsychoPy\Token Test_lastrun.py”, line 258, in
Part1_Audio = sound.Sound(‘Audio_Part1’, secs=-1, stereo=True, hamming=True,
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend_ptb.py”, line 332, in init
self.setSound(value, secs=self.secs, octave=self.octave,
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend_ptb.py”, line 433, in setSound
_SoundBase.setSound(self, value, secs, octave, hamming, log)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound_base.py”, line 201, in setSound
raise ValueError(msg + value)
ValueError: setSound: could not find a sound file named Audio_Part1
################ Experiment ended with exit code 1 [pid:11172] #################
1874.8699 INFO Loaded monitor calibration from [‘2023_06_13 10:06’]

Hello,
Can you please share the structure of your files and how you declared the audio files in your spreadsheet?

Did you put the file format at the end of the name?
For example, mySound.mp3

If your audio file is in a folder, don’t forget to put it in the path.
For example, audio/mySound.mp3

Chen

Stimulus CorAns
D:\PsychoPy\Audio\1.wav Circle
D:\PsychoPy\Audio\2.wav Square
D:\PsychoPy\Audio\3.wav Yellow

After looking at your audio files, your error may relate to this: Part1_Audio = sound.Sound(‘Audio_Part1’,
I thought that the first paramater of sound.Sound is supposed to be the name and location of the sound file. So, two things you can try, but the first is easiest for testing.
Could you try changing the code to be this:
Part1_Audio = sound.Sound(Audio_Part1, the rest the same.
notice the missing quotation marks.
If that doesn’t work, try these two changes:
Part1_Audio = sound.Sound(‘Audio/1.wav’, the rest the same.
print('value of Audio_Part1: ', Audio_Part1)
and then report back what that says.

Sure, thank you. I’ll get back on that

Also, please take a look at the following message from Jens:

Chen