Issue with audio: 'PsychPortAudio-WARNING'

Hi,

I am trying to play a sound at the end of a resting state period (5 seconds in this example so that I can test it) and I want there to be a beep sound at the end of the resting state period. It’s supposed to be a small delicate beep but when it plays it’s horrendously loud and long. I’ve tried changing the sample rate but this doesn’t seem to affect it at all. Does anyone know how to fix this? I haven’t fiddled with anything else… Thanks!

resting_state_tone = sound.Sound((self.__path + '/resting_state/end_tone.wav'))

self.__clock.reset()
trigger_sent = False
while self.__clock.getTime() < (5):
     self.__blank.draw()
     self.__win.flip()

resting_state_tone.play()

Whilst the tone plays, it gives the following warning:

PsychPortAudio-WARNING: 'Start' method on audiodevice 1 called, although playback on device not yet completely stopped.
Will forcefully restart with possible audible artifacts or timing glitches.
Check your playback timing or use the 'Stop' function properly!

If it’s actually just a tone you might be better off not using a wav file at all.

resting_state_tone = sound.Sound(value='C', secs=0.1)

That should play a 100ms tone. You can move it up or down by changing the letter or using the ‘octave’ argument.

You may also want to change your audio library. In PsychoPy’s settings, under hardware, there’s an audio library option, and whatever is first is the one that is used. It seems like it’s probably using PTB right now, you might want to change it so sounddevice is first, which might work better on your specific system.