xref: /qemu/docs/system/devices/virtio-snd.rst (revision ec6f3fc3)
1virtio sound
2============
3
4This document explains the setup and usage of the Virtio sound device.
5The Virtio sound device is a paravirtualized sound card device.
6
7Linux kernel support
8--------------------
9
10Virtio sound requires a guest Linux kernel built with the
11``CONFIG_SND_VIRTIO`` option.
12
13Description
14-----------
15
16Virtio sound implements capture and playback from inside a guest using the
17configured audio backend of the host machine.
18
19Device properties
20-----------------
21
22The Virtio sound device can be configured with the following properties:
23
24 * ``jacks`` number of physical jacks (Unimplemented).
25 * ``streams`` number of PCM streams. At the moment, no stream configuration is supported: the first one will always be a playback stream, an optional second will always be a capture stream. Adding more will cycle stream directions from playback to capture.
26 * ``chmaps`` number of channel maps (Unimplemented).
27
28All streams are stereo and have the default channel positions ``Front left, right``.
29
30Examples
31--------
32
33Add an audio device and an audio backend at once with ``-audio`` and ``model=virtio``:
34
35 * pulseaudio: ``-audio driver=pa,model=virtio``
36   or ``-audio driver=pa,model=virtio,server=/run/user/1000/pulse/native``
37 * sdl: ``-audio driver=sdl,model=virtio``
38 * coreaudio: ``-audio driver=coreaudio,model=virtio``
39
40etc.
41
42To specifically add virtualized sound devices, you have to specify a PCI device
43and an audio backend listed with ``-audio driver=help`` that works on your host
44machine, e.g.:
45
46::
47
48  -device virtio-sound-pci,audiodev=my_audiodev \
49  -audiodev alsa,id=my_audiodev
50