Keypress during sound stimuli error linux

hi all,
I have a task where a sound is played (psychopy.sound.Sound) and participants need to respond by using the keyboard whether the sound is a match or not. This task works fine on multiple Macs. However, on my linux machine when participants press a key while the sound is still playing, a ‘bad’ noise is produced on top of the sound (sounds like an error noise, although I don’t know exactly how to describe it). I have tried using different sound backends (pyo + ptb) but the sound remains.

The error printed to the terminal is ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred and it prints this many many times (while key is held down). I have searched this on it’s own with no discernible solutions.
I’ve read a bit here but didn’t seem to find the answer. I assume it has something to do with the threading/refresh rate as I don’t get this error on other OS’s. Code below reproduces the error on my linux machine (but not my mac) if you press a key while the sound is still playing.
Thanks for any insight!

from psychopy import visual, monitors
from psychopy.visual import Window
from psychopy import core, event
from psychopy.sound import Sound


win = visual.Window([600,400], color='black', fullscr=0)
no_response = True
s = Sound(value=300, secs=2.0, volume=.03)
win.flip()
s.play()
timer = core.CountdownTimer(2)
while timee > 0 and no_response:
	timee = timer.getTime()
	for key in event.getKeys():
		if key in ['1', '2']:
			no_response = False
win.flip()
win.close()
core.quit()

What sound library have you set PsychoPy to use (in prefs)?

right now it returns [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’], the audioDriver is [‘portaudio’], and the latency mode is 3.

changing the backend to ‘PTB’ fixed the problem and stopped the error messages. I had previously done Sound.backend_ptb.SoundPTB() which I thought would have the same result, but apparently not. Thank you so much for pointing to the right place!