Audio Issue. WASAPI can't initialize audio client

Ask for help with ScummVM problems

Moderator: ScummVM Team

Maverick_Hunter1900X
Posts: 14
Joined: Mon Oct 23, 2023 7:36 am

Audio Issue. WASAPI can't initialize audio client

Post by Maverick_Hunter1900X »

Hey all fellow ScummVM users.
I'm having a problem with the audio in ScummVM.

The message which ScummVM is giving me is:

WARNING: Could not open audio device: WASAPI can't initialize audio client: 蠠澉ǝ!

My PC specs are:
Windows 10 Pro 64Bit
Gigabyte Designare EX
Threadripper 1920X
Nvidia 2080 RTX
Realtek ALC1220

Drivers:
Nvidia - 545.84
Realtek - 6.0.9517.1
UI (Realtek) - 1.41.294.0

The problem come and go. But mostly (80% of the time) it pops up with the warning message, when I start ScummVM.
Needless to say, there is no sound in any of the games that I have installed, which is:
Monkey Island 1-3
The Dig
Sam & Max
Full Throttle
Indiana Jones and the Fate of Atlantis
Day of The Tentacle

- I've tried several different versions of ScummVM
- I've deleted the ScummVM folder in the Roam folder, resetting ScummVM
- I've tried other programs/games which uses WASAPI and there are no problems to be found
- I've tried deleting the audio drivers with DDU and installing different driver versions
- I've tried different settings in Audio, Midi and MT32
- I've tried changing the audio settings in the sound control panel (Changing between 16 - 24bit, changing herz, changing exclusive program mode to non-exclusive, changing audio enhancement on/off etc.

All the things I've tried, have not been able to fix the problem.
I have also tried to search for answers in this forum and google, but I can't seem to find any, and figure out what is causing the problem.
I am uncertain if it is ScummVM or it has something to do with Windows/Realtek Audio card or if it is some settings, that needs to be changed.
I did however read an old post, which said, that I should be able to change ScummVM sound settings from WASAPI to DirectSound or Waveout with some commands. I tried typing in those commands in command prompt, but either I'm typing them incorrectly, or ScummVM isn't using them anymore, because it didn't seem to do or change anything.

So my questions are:
Can I change the ScummVM sound settings, so that it uses something else than WASAPI?
If so, where do I need to write these commands, and how are they written?
Does anyone else have any suggestions as to how to fix this problem? If so, please answer my post. :D


If anyone else has any ideas, if this is a ScummVM or Windows/Audio card problem, please let me know.

Thanks
fibs
Posts: 29
Joined: Mon Sep 26, 2022 10:38 pm

Re: Audio Issue. WASAPI can't initialize audio client

Post by fibs »

1-2. To achieve what was described in the post, you can open Command Prompt anywhere and enter the following commands:

Code: Select all

cd "C:\Program Files\ScummVM"
set SDL_AUDIODRIVER=directsound
scummvm.exe -d1
replace "C:\Program Files\ScummVM" with your actual ScummVM installation folder if needed, keep it between "".

I tried it and it switched to DirectSound, or at least the debugging info said so.

If this works, best report back. You can also save these lines in Notepad as a .bat script, and create a shortcut to the .bat file for easier access to this workaround until the WASAPI issue is identified and fixed.

3. Does anything change if you just do this?

a. Close ScummVM.
b. Press Win + R to open the Run dialog (or have Command Prompt open).
c. Type "services.msc" and hit Enter.
d. In the Services Manager, find "Windows Audio."
e. Right-click on "Windows Audio" and then on "Restart the service."
f. Open ScummVM normally and try playing.
Last edited by fibs on Sat Oct 28, 2023 6:23 pm, edited 1 time in total.
Maverick_Hunter1900X
Posts: 14
Joined: Mon Oct 23, 2023 7:36 am

Re: Audio Issue. WASAPI can't initialize audio client

Post by Maverick_Hunter1900X »

Thanks, I will definitely try that.
I think that I actually wrote that directsound command, like that. But I could be wrong.
I'll get back to you if it works or not :D
User avatar
Praetorian
ScummVM Developer
Posts: 882
Joined: Tue May 08, 2007 8:54 am
Location: Greece
Contact:

Re: Audio Issue. WASAPI can't initialize audio client

Post by Praetorian »

Maverick_Hunter1900X wrote: Mon Oct 23, 2023 3:50 pm Hey all fellow ScummVM users.
I'm having a problem with the audio in ScummVM.

The message which ScummVM is giving me is:

WARNING: Could not open audio device: WASAPI can't initialize audio client: 蠠澉ǝ!
This question came up in the ScummVM Discord some days ago.

The solution (then) was to use the advice from this StackOverflow post (up to step 6), which indeed explains how to set the SDL_AUDIODRIVER environment variable on Windows to directsound or winmm. This is a more "permanent" solution than setting it from command line, because it will apply globally to other apps potentially using SDL and it will persist across restarts -- so choose according to your needs (either the command line way posted above or the system environment variable add/edit suggested in the following link):
https://stackoverflow.com/a/57036216
Maverick_Hunter1900X
Posts: 14
Joined: Mon Oct 23, 2023 7:36 am

Re: Audio Issue. WASAPI can't initialize audio client

Post by Maverick_Hunter1900X »

That's great that you mention, it being a permanent solution, as I don't think all my programs/games uses Directsound. So thanks for that advice :D

It does, however, seem to have worked, because now I have sound in ScummVM :D

I will report back if the sound disappears again, or I get the same Warning message :D If I don't, well, then it's because the problem is solved 8) :wink:

Lastly, I just want to say thank you for your hard work on ScummVM. It's a pleasure, being able to play the games from when I was a kid and still having that nostalgic feeling. Thank you for giving me that opportunity :D
Maverick_Hunter1900X
Posts: 14
Joined: Mon Oct 23, 2023 7:36 am

Re: Audio Issue. WASAPI can't initialize audio client

Post by Maverick_Hunter1900X »

Unfortunately, I'm back guys...

So it seems that when it worked, it were only because I got lucky. Tried all of your sugestions, but it still doesn't seem to work.

But when I tried to use the scummvm.exe -d1 command, I got this message instead:

Debuglevel (from command line): 1
Using SDL Video Driver "windows"
Using SDL Audio Driver "wasapi"
SDL mixer sound format: 33056 differs from desired: 32784
WARNING: Could not open audio device: WASAPI can't initialize audio client: 驇ȶ!
Using game controller: Controller (Xbox One For Windows)
User picked target 'monkey2' (engine ID 'scumm', game ID 'monkey2')...
Looking for a plugin supporting this target... SCUMM [all games]
Using gameid monkey2, variant , extra
SCUMM version 5, HE version 0
Using MD5 '3686cf8f89e102ececf4366e1d2c8126'
WARNING: Sound initialization failed. This may cause severe problems in some games!
WARNING: Sound mixer initialization failed!
WARNING: MIDI driver depends on sound mixer, switching to null MIDI driver!
Adding object 76 from room 9 into inventory
Replaced the duplicated plugin: 'scumm'

Does this give some clues, as to what is wrong? :)

EDIT: So this is weird. If I use my music player (Aimp), which uses WASAPI and start ScummVM while Aimp is playing some music, ScummVM doesn't come with the warning and the sound works.
But if I exit ScummVM , close Aimp and start ScummVM up again, the warning message is shown again and there is no sound.
Don't know what is going on, but I still can't figure out if it is ScummVM or it's some driver or windows related.
But what I can't figure out is why Aimp uses Wasapi with no problems and ScummVM is struggeling.

Any ideas?
User avatar
criezy
ScummVM Developer
Posts: 955
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: Audio Issue. WASAPI can't initialize audio client

Post by criezy »

There was a similar issue fixed in SDL 2.28: https://github.com/libsdl-org/SDL/issues/7478
I am not sure which SDL version is shipped with the Windows release of ScummVM, but since 2.28 is only a few months old, I suspect we are using an older version. So it's possible that using SDL 2.28 will fix that issue.
fibs
Posts: 29
Joined: Mon Sep 26, 2022 10:38 pm

Re: Audio Issue. WASAPI can't initialize audio client

Post by fibs »

Then one can try dropping in a new SDL2.dll - e.g. from https://github.com/libsdl-org/SDL/relea ... 32-x64.zip - as a replacement in the ScummVM installation folder? Of course, this could cause other unforeseen issues... :twisted:
Maverick_Hunter1900X
Posts: 14
Joined: Mon Oct 23, 2023 7:36 am

Re: Audio Issue. WASAPI can't initialize audio client

Post by Maverick_Hunter1900X »

criezy wrote: Wed Oct 25, 2023 10:10 am There was a similar issue fixed in SDL 2.28: https://github.com/libsdl-org/SDL/issues/7478
I am not sure which SDL version is shipped with the Windows release of ScummVM, but since 2.28 is only a few months old, I suspect we are using an older version. So it's possible that using SDL 2.28 will fix that issue.
So I tried to download the latest version of SDL2 (Version 2.28.4) and copying it into the ScummVM game folder, overwriting the old SDL2.dll. But it didn't correct the problem. So my only workaround is to open my music player (Aimp) or opening YouTube in my browser and play anything for 2 seconds, stop playback, and then open ScummVM. It fixes the problem everytime :D

Could this be a ScummVM problem, not recognizing the new version of SDL2.dll?

But then again, when downgrading to an older version of ScummVM version it does the same exact thing, even if I delete the ScummVM folder in the roam folder and start ScummvM from a fresh install.

Oh well, I can get it to work, just not like before, so I'll wait and see if there is a fix of any sort in the furture, either from ScummVM or Windows etc. :D
Maverick_Hunter1900X
Posts: 14
Joined: Mon Oct 23, 2023 7:36 am

Re: Audio Issue. WASAPI can't initialize audio client

Post by Maverick_Hunter1900X »

fibs wrote: Wed Oct 25, 2023 11:47 am Then one can try dropping in a new SDL2.dll - e.g. from https://github.com/libsdl-org/SDL/relea ... 32-x64.zip - as a replacement in the ScummVM installation folder? Of course, this could cause other unforeseen issues... :twisted:
Unfortunately, that didn't work either. And it didn't break anything, so at least that's something :P
fibs
Posts: 29
Joined: Mon Sep 26, 2022 10:38 pm

Re: Audio Issue. WASAPI can't initialize audio client

Post by fibs »

Maverick_Hunter1900X wrote: Sat Oct 28, 2023 3:17 pmUnfortunately, that didn't work either. And it didn't break anything, so at least that's something :P
Interesting, but what I first gave you should work and it's strange that it doesn't. What happens with your sound issue if you just open Command Prompt, type each line and press Enter?

Code: Select all

C:
cd "C:\Program Files\ScummVM\"
set SDL_AUDIODRIVER=directsound
scummvm.exe -d1
I used the default installation path for ScummVM in the 2nd line, but change that as needed.
Maverick_Hunter1900X
Posts: 14
Joined: Mon Oct 23, 2023 7:36 am

Re: Audio Issue. WASAPI can't initialize audio client

Post by Maverick_Hunter1900X »

fibs wrote: Sat Oct 28, 2023 6:30 pm
Maverick_Hunter1900X wrote: Sat Oct 28, 2023 3:17 pmUnfortunately, that didn't work either. And it didn't break anything, so at least that's something :P
Interesting, but what I first gave you should work and it's strange that it doesn't. What happens with your sound issue if you just open Command Prompt, type each line and press Enter?

Code: Select all

C:
cd "C:\Program Files\ScummVM\"
set SDL_AUDIODRIVER=directsound
scummvm.exe -d1
I used the default installation path for ScummVM in the 2nd line, but change that as needed.
Yeah I would have thought that it would work too, but even though I followed your instructions correctly, It didn't seem to make any difference. I'm maybe beginning to think that it might be a faulty sound processor on the motherboard. But I can't say for certain :)
I'll try your method one more time and let you know what I find out :D
Maverick_Hunter1900X
Posts: 14
Joined: Mon Oct 23, 2023 7:36 am

Re: Audio Issue. WASAPI can't initialize audio client

Post by Maverick_Hunter1900X »

fibs wrote: Sat Oct 28, 2023 6:30 pm
Maverick_Hunter1900X wrote: Sat Oct 28, 2023 3:17 pmUnfortunately, that didn't work either. And it didn't break anything, so at least that's something :P
Interesting, but what I first gave you should work and it's strange that it doesn't. What happens with your sound issue if you just open Command Prompt, type each line and press Enter?

Code: Select all

C:
cd "C:\Program Files\ScummVM\"
set SDL_AUDIODRIVER=directsound
scummvm.exe -d1
I used the default installation path for ScummVM in the 2nd line, but change that as needed.
Oh, and by the way, if I want to revert to wasapi at some point in time, what is the correct command line for that? :D
fibs
Posts: 29
Joined: Mon Sep 26, 2022 10:38 pm

Re: Audio Issue. WASAPI can't initialize audio client

Post by fibs »

Maverick_Hunter1900X wrote: Sat Oct 28, 2023 6:43 pm Yeah I would have thought that it would work too, but even though I followed your instructions correctly, It didn't seem to make any difference. I'm maybe beginning to think that it might be a faulty sound processor on the motherboard. But I can't say for certain :)
I'll try your method one more time and let you know what I find out :D
I don't think it's just you for what it's worth. The issue is likely some unknown sound hardware/Windows/antivirus/browser update or issue that interferes with ScummVM in some way and it seems to have been happening lately to several people.

https://bugs.scummvm.org/ticket/14676
https://bugs.scummvm.org/ticket/14670

Anyhow, If you run ScummVM with -d1 and it shows

Code: Select all

Using SDL Audio Driver "directsound"
then WASAPI will no longer be used. You'll either get a new error (provide it, as it may contain a better clue as to the issue) or it'll work.
Maverick_Hunter1900X wrote: Sat Oct 28, 2023 6:46 pmOh, and by the way, if I want to revert to wasapi at some point in time, what is the correct command line for that? :D
It's "wasapi" instead of "directsound". Once you reliably get it working, I'll help with a shortcut so you won't have to type this every time. You may also want to remove the environment variable suggested by Praetorian if you implemented it.
Maverick_Hunter1900X
Posts: 14
Joined: Mon Oct 23, 2023 7:36 am

Re: Audio Issue. WASAPI can't initialize audio client

Post by Maverick_Hunter1900X »

fibs wrote: Sat Oct 28, 2023 6:59 pm
Maverick_Hunter1900X wrote: Sat Oct 28, 2023 6:43 pm Yeah I would have thought that it would work too, but even though I followed your instructions correctly, It didn't seem to make any difference. I'm maybe beginning to think that it might be a faulty sound processor on the motherboard. But I can't say for certain :)
I'll try your method one more time and let you know what I find out :D
I don't think it's just you for what it's worth. The issue is likely some unknown sound hardware/Windows/antivirus/browser update or issue that interferes with ScummVM in some way and it seems to have been happening lately to several people.

https://bugs.scummvm.org/ticket/14676
https://bugs.scummvm.org/ticket/14670

Anyhow, If you run ScummVM with -d1 and it shows

Code: Select all

Using SDL Audio Driver "directsound"
then WASAPI will no longer be used. You'll either get a new error (provide it, as it may contain a better clue as to the issue) or it'll work.
Maverick_Hunter1900X wrote: Sat Oct 28, 2023 6:46 pmOh, and by the way, if I want to revert to wasapi at some point in time, what is the correct command line for that? :D
It's "wasapi" instead of "directsound". Once you reliably get it working, I'll help with a shortcut so you won't have to type this every time. You may also want to remove the environment variable suggested by Praetorian if you implemented it.
So I tried the exact same thing like the last time, and followed your instructions correctly, and this time it actually worked. :D
Firstly, when I tried to type in the "set SDL_AUDIODRIVER=directsound" it didn't give me a message about directsound being active or not. It just hopped a line down. So I typed in the "scummvm.exe -d1" command and low and behold it worked, or I think it did, since now it says the following:

scummvm.exe -d1
Debuglevel (from command line): 1
Using SDL Video Driver "windows"
Using game controller: Controller (Xbox One For Windows)
Using SDL Audio Driver "directsound"
Output sample rate: 44100 Hz
Output buffer size: 1024 samples
Output channels: 2

A couple of questions though...
Can I change the Output sample rate to something higher than 44100 Hz, if so how (If it's a command line, what is the exact command for it?
Can I change The Output buffer size, if so how?
Can I change The Output channels to for example, 5.1 and if so, how?

Oh and one last thing, I tried to load Monkey Island 2 and I have set it to Music Device: Adlib Emulator and Adlib Emulator: Dosbox OPL.
But then I saw this message when closing ScummVM:

User picked target 'monkey2' (engine ID 'scumm', game ID 'monkey2')...
Looking for a plugin supporting this target... SCUMM [all games]
Using gameid monkey2, variant , extra
SCUMM version 5, HE version 0
Using MD5 '3686cf8f89e102ececf4366e1d2c8126'
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Adding object 76 from room 9 into inventory
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
Trying to use non-existent global AdLib instrument 0
State loaded from 'monkey2.s10'
Replaced the duplicated plugin: 'scumm'

Is it supposed to say this?
Does it matter if the Savegame is made from a very old version of ScummVM?

Sorry for all the noob questions, but I really appreciate all of your responses :D
Post Reply