Using PC Speaker in QEMU on Windows


Use the-audiodev and-machine options.


For example, if you specify an option and its value as follows, it becomes available in an environment emulated by PC Speaker.

- qemu-system-i386 -drive file=./os.img,format=raw,if=floppy
+ qemu-system-i386 -drive file=./os.img,format=raw,if=floppy -audiodev dsound,id=0 -machine pcspk-audiodev=0

The-audiodev option specifies the audio to be used in the emulated backend. The value specifies dsound (DirectSound) and an id to identify it. By the way, the value specified for id can be a character string.

-machine specifies the device and the ID assigned to it. The value is pcspk-audiodev= .

What to do if DirectSoundCapture initialization errors occur

Even if the option and its value are specified appropriately, the following error may occur.

dsound: Could not initialize DirectSoundCapture
dsound: Reason: No sound driver is available for use, or the given GUID is not a valid DirectSound device ID

This is likely not a problem on the QEMU side, but on the Windows side.

For example, in the Settings app, this error occurs if the value in the drop-down list for selecting an input device for System > Sound > Input is "Input device not found".

In this case, connect some kind of audio input device to the PC and enable the device listed in > Input Devices to Manage Sound Devices, and the error will disappear.


$ qemu-system-i386 --version
QEMU emulator version 6.1.0 (v6.1.0-11882-g7deea770bf-dirty)
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers


Author by


Updated on October 03, 2021