Does qemu/KVM allow sound through Spice?

6,634

Turns out Spice certainly DOES allow sound passthrough. My issue was that I had put -soundhw hda without putting a \ after it. So now it finally works with the audio passthrough with Spice and here is my run shell script:

#!/bin/bash

#-monitor stdio \

SPICE_PORT=5924

qemu-system-x86_64 \
    -daemonize \
    -enable-kvm \
        -cpu host \
        -drive file=/home/mike/underling.img,if=virtio \
        -net nic,model=virtio -net user,hostname=underling \
        -m 4G \
    -soundhw hda \
        -name Underling \
    -usbdevice tablet \
    -device virtio-serial \
    -chardev spicevmc,id=vdagent,name=vdagent \
    -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
    -vga qxl \
    -spice port=${SPICE_PORT},disable-ticketing \
        "$@"
exec spicec --title Underling -h 127.0.0.1 -p ${SPICE_PORT}
Share:
6,634
Mikey A. Leonetti
Author by

Mikey A. Leonetti

I do things like baking, practising the guitar, apologetics, and hanging around with my family and other people. I code for a living.

Updated on September 18, 2022

Comments

  • Mikey A. Leonetti
    Mikey A. Leonetti over 1 year

    I'm setting up a Windows 7 virtual machine to try and eliminate my physical partition. I have it installed and working with Spice and the drivers from the fedora site:

    https://fedoraproject.org/wiki/Windows_Virtio_Drivers#Direct_download

    When I connect via Spice, I can connect and see the video pretty quickly. However, I don't hear any sound. If I put in the soundhw option, it no longer runs as a daemon where I can connect to Spice.

    Does Spice not pass through sound or am I doing something wrong?

    My command line for the emulation:

    #!/bin/bash
    
    #-monitor stdio \
    
    SPICE_PORT=5924
    
    qemu-system-x86_64 \
        -daemonize \
        -enable-kvm \
            -cpu host \
            -drive file=/home/mike/underling.img,if=virtio \
            -net nic,model=virtio -net user,hostname=underling \
            -m 4G \
            -name Underling \
        -usbdevice tablet \
        -device virtio-serial \
        -chardev spicevmc,id=vdagent,name=vdagent \
        -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
        -vga qxl \
        -spice port=${SPICE_PORT},disable-ticketing \
            "$@"
    exec spicec --title Underling -h 127.0.0.1 -p ${SPICE_PORT}