Using Audio

QEMU supports some sound cards and some methods to play audio.

For more information,

1. Configuring audio support

1.1 Configure options

Configure QEMU with the options below.

./configure --enable-dsound --enable-adlib
--enable-dsound option adds DirectSound support. It is necessary to use DirectX headers to compile. MinGW doesn't have DirectX headers. Use this headers.

When you want to support FMOD library, type:
./configure --enable-dsound --enable-adlib --enable-fmod --fmod-inc="/usr/local/fmodapi375win/api/inc"
--fmod-lib sets to fmod library directly.

1.2 FMOD library

FMOD is an audio library which can be used freely in non-commercial use. You can use it as follows.
Now FMOD 3 library can be used. FMOD Ex can not be used. from here.

Unzip a zipped file and copy it to /usr/local. Copy fmod.dll to /usr/local/bin.

$ cp -a fmodapi375win /usr/local
$ cp /usr/local/fmodapi375win/api/fmod.dll /usr/local/bin

Configure like this. Set the library name directly.

$ cd qemu
$ ./configure --enable-fmod --fmod-inc="/usr/local/fmodapi375win/api/inc" --fmod-lib="/usr/local/fmodapi375win/api/lib/libfmod.a"
$ make

Set QEMU_AUDIO_DRV to fmod and start QEMU with -soundhw sb16,es1370.

$ ./qemu -L ./pc-bios -hda redhat.img -soundhw sb16,es1370

Then use it as usual.

[Linux guest]# modprobe sb io=0x220 irq=5 dma=1 dma16=5
[Linux guest]$ play test.wav

2. Starting the program

Start QEMU with -soundhw sb16,es1370,adlib

[Command Prompt] qemu.exe -L ./pc-bios -hda linux.img -soundhw sb16,es1370,adlib

When sb16, es1370 and adlib are used simultaneously, this option provides three sound cards to the guest OS.
Windows can use them simultaneously. The default sound card can be selected by Control Panel.

sb16 is a Sound Blaster 16 sound card. It is de facto standard for PC compatible system.

es1370 is a Ensoniq AudioPCI card.

adlib is a AdLib sound card. It is de facto starndard before Sound Blaster. AdLib uses YAMAHA YM3812 sound chip.

3. Selecting sound library

QEMU uses several sound libraries to play audio.
You can select it by setting command line environment QEMU_AUDIO_DRV.

[Command Prompt] SET QEMU_AUDIO_DRV=dsound
[Command Prompt] qemu.exe -L ./pc-bios -hda linux.img -soundhw sb16,es1370,adlib

Selectable items are:
dsound is DirectSound.
fmod is FMOD library.
sdl is SDL library.
none is no library.
wav is wave renderer.

If FMOD library is not used to build the program, you cannnot select it.

You can also set various conditions for those library. For more information,
[Command Prompt] qemu -audio-help

4. Finding a driver for Windows 95/98

Windows comes with drivers for Sound Blaster 16 and AdLib card. But Windows 95/98 doesn't have a driver for ES1370.

You can use this driver of Windows 95/98 for ES1370 from here.

Windows 2000 detects and installs a driver for ES1370 automatically.

5. Installing a driver

5.1 Windows 98 guest

Sound Blaster 16 emulated in QEMU is a ISA card. It is not Plug and Play. When you use Windows as a guestOS, please install driver by the Add New Hardware Wizard.

Go to Control panel -> Add Hardware.

ES1370 is a PCI card. It is detected by Windows 98 automatically.

AdLib is a ISA card. It is necessary to install a driver manually. Go to Control Panel -> Add Hardware.

5.2 Windows 2000 guest

ES1370 is a PCI card. It is detected by Windows 2000 automatically at startup.

5.3 Linux guest

When you use Linux as guest a OS, please type in guest OS like this.

[Linux guest]# modprobe sb io=0x220 irq=5 dma=1 dma16=5
If you installed sox package, .wav file is played.
[Linux guest]$ play test.wav

ES1370 card will be detected automatically by Fedora Core and installed a driver.
If you want to install the driver manually, type:
[Linux guest]# modprobe es1370
AdLib card can be used by this.
[Linux guest]# modprobe adlib_card io=0x388

6. Microphone support

When DirectSound library and es1370 are used to start the program, a microphone is supported.

[Command Prompt] SET QEMU_AUDIO_DRV=dsound
[Command Prompt] qemu.exe -L ./pc-bios -hda linux.img -soundhw es1370

7. AdLib support for old DOS games

If you want to use old DOS games, use AdLib sound card.

It is necessary to configure with --enable-adlib option to make the program and start the program with -soundhw sb16,adlib.

DOS games doesn't need any drivers.

8. Messages

Q: What does this message mean?
audio: Failed to create voice 'es1370.adc'

A: SDL has no support for capturing sound, hence es1370 can not create voice for capture. Using DirectSound for sound library will solve this.

9. Abbreviations

ADC - Analog to Digital Converter
DAC - Digital to Analog Converter

PCM - Pulse-code modulation. a digital representation of an analog signal.

FMOPL - Name of the OPL2 (particulary YAMAHA chip) emulation