'_MasterStream' object has no attribute 'handle' for audio only experiment

Similar questions have arisen in the forum, but I have seen most have to do with a microphone and for those that haven’t I have seen no resolution.

OS (e.g. Win10): Windows 11
PsychoPy version : 2023.2.2
What are you trying to achieve?:

Play sound files on routine start for several routines.

What did you try to make it work?:

I have tried using the sound component as well as a code component. For both, I received the following error message:

File “C:\Program Files\PsychoPy\lib\site-packages\psychtoolbox\audio.py”, line 236, in del
self.close()
File “C:\Program Files\PsychoPy\lib\site-packages\psychtoolbox\audio.py”, line 146, in close
raise err
File “C:\Program Files\PsychoPy\lib\site-packages\psychtoolbox\audio.py”, line 139, in close
PsychPortAudio(‘Close’, self.handle)
AttributeError: ‘_MasterStream’ object has no attribute ‘handle’
################ Experiment ended with exit code 1 [pid:25552] #################
19643.9896 INFO Loaded monitor calibration from [‘2023_09_18 10:43’]

Some fixes I have tried are changing my audio library, which has resulted in the same error. What is strange is, I had the code component for playing an audio file work for one file, but when I added more to it, the error arose again. Now, even when I go to that one file again, it still comes up with an error.

I attached a bare-bones experiment file that produces the error with two of the audio files I am using. Any help would be much appreciated!

Audio Issue Test.zip (3.2 MB)

Check whether you have audio files with different bit rates.

Thanks for the suggestion.

I checked all audio files, equal bitrate at 705 kbps.

The error goes away with use of Settings → Audio → Audio Latency Priority → 0: Latency Not Important. So I assume this issue is one of sampling rate. Strange given audio not recording, but at least I know the cause now.