Create pause condition

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:
    if chap_audio.status == PAUSED:

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\”, line 636, in
File “C:\Users\user\AppData\Roaming\psychopy3\versions\psychopy\sound\”, line 539, in pause
TypeError: stop() got an unexpected keyword argument ‘reset’

Does anyone has any suggestion? please