An error occurs in the code for presenting sound stimuli in Python

I am creating a program in vs code utilising python libraries.

I’m trying to present a sound stimulus, but I keep getting an error.

I’m not attaching the full code, I’m just attaching a small snippet of code because I get the same error when I try to present a sound stimulus.

Python is version 3.9 and psychoPy is version 24.0.1.

I’ve also tried setting the sampling rate to 44100, 24000, but I get the same error.

Let me know if there’s anything else I need to write. Thanks.

The error looks like this

I think 48000 is the best rate.

Try to use a single rate for everything.

I’ve also tried adjusting the value to 48000, but I still have the same problem.

My soundcard drivers are also up to date.

The current speaker output seems to be 48000.