New audio device preference

On Linux (and Mac) the pyo sound backend uses the default audio device (specifically the device ID returned by pyo.pa_get_default_output). This causes problems on systems with multiple soundcards where the default soundcard should not be used by PsychoPy. I propose that a global user preference should be added to allow the user to specify which sound device be used.

I think the change would be along the lines of creating a new preference new preference prefs.general[‘audioOutputDevice’], changing occurrences of pyo.pa_get_default_output() to outputID, and initializing outputID as either prefs.general[‘audioOutputDevice’] or pyo.pa_get_default_output().

So we’d need these 3?

  • audio lib: (pyo, pygame, …)
  • audio driver (portaudio, alsa)
  • audio device (default, intel, soundblaster…)

Currently I think users are already confused that there’s a “lib” as well as a “driver” and on some systems the driver effective is the device.

Basically, I’m wondering if we can rationalise this a bit?

The issue is that the three things are different (and non-overlapping). Right now there is no way to choose which sound card is used. In terms of user experience, it is equivalent of having to change the primary monitor to control where graphics are displayed.

My issue right now is that the device ID of the sound card depends on the computer I am using. If adding another preference makes the user interface too confusing, then I would be happy with a preference that cannot be set from any menu. The big issue is that both pyo and pysoundcard both offer the ability to choose a device (I think pygame only can use the default device), but PsychoPy drops that part of the interface.

OK. I guess I was wondering whether the intermediate one (‘driver’) might be ditched or subsumed by the device one.