Sound

A virtio sound card, played through your code or recorded to a WAV file.

The guest gets a virtio sound card (ALSA calls it VirtIO SoundCard) with one playback and one capture stream: 16-bit, mono or stereo, at 8, 16, 44.1 or 48 kHz.

wemu-system-aarch64 ... -audiodev default,id=snd -device virtio-sound-pci,audiodev=snd
# or, in one option
wemu-system-aarch64 ... -audio default,model=virtio

-device intel-hda (with hda-duplex or hda-output) and -audio ...,model=hda are accepted too, and give the guest the same virtio sound card.

Where the sound goes

-audiodev driverSound goes to
noneNowhere.
wav[,path=FILE]A WAV file, written when the machine ends (default wemu.wav).
Anything else (default, coreaudio, pa, alsa…)The host's audio.

The stock Node and browser hosts have no sound output: Warm64 warns and drops the sound. Give the host an audio to play it:

const ctx = new AudioContext();
const host = {
  ...browserWEMUHost(),
  audio: {
    play(samples, rate, channels) {
      // samples: interleaved 16-bit; convert and queue them on ctx
    },
  },
};

record(), if the host has it, supplies what the guest's microphone captures.

Recording from the monitor

(wemu) wavcapture session.wav
(wemu) stopcapture

See also