Default Sound Device Issue in PsychoPy 2024.2.1

Description:
In PsychoPy version 2024.2.1, the default sound device selection is not working correctly. In the previous version, PsychoPy 2023.2.3, I could select a sound component, choose an audio file, and the device would automatically use the default sound device. If the default sound device on my computer was set to Bluetooth, PsychoPy would output sound through Bluetooth. However, in the current version, selecting “default” as the speaker does not produce any sound, even though my computer’s default sound device is Bluetooth.

OS win11
PsychoPy version StandalonePsychoPy-2024.2.1-win64-py3.8.exe
Standard Standalone? (y/n) y
What are you trying to achieve?:
The sound should be played through the default audio device set in the system, similar to the behavior in PsychoPy 2023.2.3.

What did you try to make it work?:
I’m sure it’s not because of the audio file or the Bluetooth device. I’ve changed multiple computers, multiple Bluetooth headsets, and multiple audio files, and I still encounter this problem.
All the problems disappeared after I designated the speaker as a Bluetooth device or speaker, and the playback volume was normal. However, if I selected the default, there was no sound at all.

1 Like

Someone has a similar problem to mine:

But I hope to keep the default options of the original version, because I am currently doing large-scale data collection, we have many programs, and there are dozens of computers and dozens of Bluetooth headsets. The workload of specifying the corresponding Bluetooth headset for each computer is very large.

Thank you very much for the work of the developers.

I would like to ask whether this problem will be solved in the subsequent versions?

Is this a bug or a design consideration?

1 Like

Hi @hasibagen8,

Thanks so much for reporting this issue! It is indeed a bug, fixable by manually selecting your desired audio device as you’ve kindly pointed out for other users here. It will hopefully be fixed in an upcoming bug release and isn’t intentional behaviour.

Thanks again,

Kim

1 Like

Hope this bug can be fixed soon.
Thanks to all the developers for their work.

This is a difficult one; the crux of the issue is that psychtoolbox, which we use for audio, doesn’t (as far as I know) allow you to get information on the system’s default speaker.

psychtoolbox does let you connect to the default speaker, so that’s what we used to do prior to 2024.2.0, but because we couldn’t get information about it before connecting (i.e. sample rate and number of audio channels) we had to connect with the default settings. This meant if your system speaker had a non-standard sample rate, it would raise an error when trying to play a sound.

We tried to fix the previous issue by choosing a default ourselves as just the first item in a list of all devices with their information included. The problem, as you’ve identified, is that the first device listed isn’t necessarily the system default. The order they’re listed is (I think) determined by the order which they connected to the motherboard when you last booted up, which isn’t particularly useful or reliable.

I have a halfway-house solution which should fix the problem in most cases by, essentially, trying the old way first, catching the error if it fails and trying the new way as a backup:

This isn’t ideal as failing to connect (even if the error is caught) produces a lot of spam messages in the Runner, and if your system default audio is non-standard you’d still have the same problem as in 2024.2.1, but this at least means that (from 2024.2.3) audio will play without error from the correct speaker in the vast majority of cases.

Thank you very much for the work of all the developers.

Through your explanation, I understand the difficulty of this work. I would like to ask if there is no good solution, whether it is possible to make the selection of the device to play audio part of the default options of psychopy, just like the audio priority, screen size, etc. can be selected in the default options. At present, it is necessary to select the playback device for each sound component, which is relatively more labor-intensive, and most of the time we actually use a certain playback device for an experiment. Personally, I rarely hear of selecting a playback device for a sound.