MuseScore icon indicating copy to clipboard operation
MuseScore copied to clipboard

[MU4 Issue] Switching PC audio devices does not affect MuseScore's output audio device

Open GabeS573 opened this issue 3 years ago • 10 comments

Describe the bug If the output audio device is changed after MuseScore is launched, MuseScore does not honor the change and continues playing out of the device that was selected when MuseScore was launched.

To Reproduce Steps to reproduce the behavior:

  1. Set your PC's audio output to the default internal speakers
  2. Launch MuseScore
  3. Open a score and play something, then stop playback.
  4. Switch audio devices. For example, connect to a Bluetooth speaker, connect to an HDMI display with a speaker, or plug in a pair of wired headphones (the latter may not work on some laptops)
  5. Play the score again and the audio plays from the speakers that were active when MuseScore was launched, or doesn't play at all (freezes until play is pressed again). MuseScore must be closed then reopened for the new device to take effect.

Expected behavior Changing the audio device should cause MuseScore to play out of the new device just like other programs do.

Platform information

  • OS: Windows 11

Additional context This issue was also present in MuseScore 3; however, it could be fixed without closing and reopening the program by going to Edit>Preferences, then selecting the I/O tab and clicking "Restart Audio Engine." However, this option is not present in MuseScore 4's preferences.

Also, note that in some laptops, the internal speakers are treated as the same device as the headphone jack, in which case this issue may not be apparent when plugging in/unplugging wired headphones.

GabeS573 avatar Mar 30 '22 18:03 GabeS573

Works fine on Mac, but not on Windows (Win10). Would be nice to bring back Audio preferences with Restart Audio Engine option (if switching between audio outputs doesn't work in real time)

Thanks for logging!

DmitryArefiev avatar Apr 01 '22 15:04 DmitryArefiev

@DmitryArefiev - is this issue still a problem on Windows? I'm wondering if it can be closed.

Tantacrul avatar Aug 29 '22 17:08 Tantacrul

@Tantacrul Yes, still occurs in master

DmitryArefiev avatar Sep 01 '22 16:09 DmitryArefiev

And I guess this is hard to fix because we are using WASAPI and not Direct Sound.. but I'm not 100% sure.

DmitryArefiev avatar Sep 01 '22 16:09 DmitryArefiev

I think this probably has to be reprioritised as a P1 if it's not possible to get MuseScore to recognise a new audio-out device.

Even if it could detect it after a restart, it would be something. If not, we'd need a 'detect new audio output' button or something that does the same thing as MS3. Definitely not ideal but better than nothing.

Tantacrul avatar Sep 01 '22 17:09 Tantacrul

Although one question: can a user at least select the new audio device in Preferences and then it would work?

Or is this simply about automatic updating?

Tantacrul avatar Sep 01 '22 17:09 Tantacrul

FWIW, the situation in MU3 was never good either.

MU3 pretty much always detects your current default device upon startup and uses that. But if you change devices while MU3 is running, it's a bit of a crapshoot as to whether it would take effect. On my own Linux systems, it works more or less always, instantly, no manual intervention. On Windows systems, it happens automatically "sometimes", but not other times, with no obvious rhyme or reason that anyone has been able to identify. On macOS, what I understand from forum postings over the years is that physically connected devices often work automatically (I think?), but Bluetooth or "virtual" devices (eg, the Zoom audio driver) tend not to.

In any of these cases where it doesn't work automatically, it almost always works to go to Edit / Preferences / I/O and hit the "Restart Audio and MIDI Devices" button. Sometimes you need to explicitly select the desired device in the dropdown, but that varies.

Eventually, sometimes discovered that toggling the "Enable MIDI Input" button on the main toolbar off and then back on had the side effect of forcing a restart of the audio drivers too, and that's now the go-to recommendation any time someone says their system isn't recognizing a new audio device.

MarcSabatella avatar Sep 01 '22 17:09 MarcSabatella

Although one question: can a user at least select the new audio device in Preferences and then it would work?

Or is this simply about automatic updating?

@Tantacrul @vpereverzev 1. Yes, user can select new audio device in Preferences and it works (tried on Windows10 with BT Headphones and Audient sound card)

  1. At the time when bug was created we didn't have an option to select an output audio device in MU (so priority can be changed I guess) Capture Capture2

DmitryArefiev avatar Nov 18 '22 09:11 DmitryArefiev

Even after restarting musescore, the audio output device does not change to the system default on my system. I have to select the device in musescore preferences for anything to change. Does musescore store the device it thinks is default between restarts instead of re-reading the system setting?

3dWrecker avatar Dec 27 '22 23:12 3dWrecker

No, it reads whatever the system reports every time it starts. But as mentioned, some systems do a better job of reporting changes than others. Some only report it for "dumb" programs that use only minimal audio features, others do a more complete job of it, also reporting in a way that "pro" audio applications expect.

MarcSabatella avatar Dec 27 '22 23:12 MarcSabatella

@GabeS573 Could you please retest this in 4.0.2? I think it has been fixed by https://github.com/musescore/MuseScore/pull/16438.

cbjeukendrup avatar Mar 13 '23 22:03 cbjeukendrup

I just had a crash connecting Bluetooth Headphones during a session Added a separate issue https://github.com/musescore/MuseScore/issues/17836

OS: Windows 11, Arch.: x86_64, MuseScore version (64-bit): 4.1.0-231510309, revision: github-musescore-musescore-cf13ccc

BluetoothCrash.zip

zacjansheski avatar Jun 02 '23 19:06 zacjansheski

Closing as stale / possibly fixed by https://github.com/musescore/MuseScore/pull/16438

zacjansheski avatar Aug 24 '23 20:08 zacjansheski