heyy,
I’m using Win10 with the 2023.1.2 builder Standard Standalone.
I have created an experiment with sound components in a loop, i want to create a pause key [‘p’] so that the sound component (and by that the current routine) will stop, and then when pressing on ‘p’ again, the routine and sound component will continue from the same place.
for now, I made it by creating a ‘pause_key’ keyboard component, with a duration of None, force end of routine == False, and a code component in each frame:
if pause_key.keys:
if chap_audio.status == STARTED:
chap_audio.pause()
if chap_audio.status == PAUSED:
chap_audio.play()
I tried using the the pause of the PTB but the experiment crushed when I pressed ‘p’ and the following error occurred:
File “S:\Lab-Shared\Experiments\audiobook_MW\pilot\stimuli\GalChenLab\groundPilot\audiobook_MW_pilot_lastrun.py”, line 636, in
chap_audio.pause()
File “C:\Users\user\AppData\Roaming\psychopy3\versions\psychopy\sound\backend_ptb.py”, line 539, in pause
self.track.stop(reset=False)
TypeError: stop() got an unexpected keyword argument ‘reset’