Virtual WorkStation: QEMU audio

Audio support in the QEMU has two dimensions:

  1. Emulated audio devices in the virtual machine
  2. Connecting QEMU audio with outer world

Emulated audio devices

List of audio devices is controlled via QEMU commandline option -soundhw. It should also have equivalent in the QEMU config, but as of version 2.1 hardware support in the config is incomplete and we do not use configs.

You can list possible emulated devices via

qemu-system-i386 -soundhw help

You can add to virtual machine multiple devices at once, separating them by comma

qemu-system-i386 -soundhw sb16,adlib

Adds sound blaster 16 and adlib cards to the virtual machine.

Most of QEMU-emulated sound card are very-very outdated, from XX century. For relatively new operation systems I recommend always use hda.

Connecting QEMU with real sound device

It is not enough to add virtual sound card to virtual machine. If you want to really hear sounds, you'll have also tell QEMU how to connect, and probably some other options.

These options are set via environment variables, which are not documented in the QEMU user guide. You have to start

qemu-system-i386 -audio-help

To get brief list of those variables.

Main variable is QEMU_AUDIO_DRV, which allows to specify driver, which would be used to input/output sound from QEMU.

Useful drivers are:

Less useful drivers:

Recording sound from QEMU

QEMU provides ability to record sound into file. There is wavcapture command in the monitor which start recording into specified file and stopcapture respectively. You can start several captures into different files and stop them by their ids, found via info capture.

You need to specify full path to the capture file, otherwise it would be written into some strange place, if you got enough rights to write there.