Qemu-kvm cannot provide sound for Windows 7 guest by default. This article provides a solution for you.
Normally, we use this command to run kvm:
kvm -m 2048 -hda win7.img
In this way, sound is not working.
We have to use this command to run kvm:
kvm -m 2048 -hda winxp.img -soundhw ac97
However, this is still not enough. We have to install AC97 driver for our Windows 7 guest.
Visit this official website to download driver: Realtek official website for AC97 driver
Check mark to accept, and click "Next":
Click the first "Global" to download the driver:
After downloading, unzip it, and double click the "Setup" to install:
After every being done, reboot your Windows 7 guest.
Of course, you can try to use SPICE for a better resolution and more functions:
To do that, we have to install a software named: spice-gtk-tools
Then we use following command:
kvm -m 2048 -hda win7.img -soundhw ac97 -vga qxl -spice port=5900,addr=127.0.0.1,disable-ticketing -device virtio-serial-pci -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 -chardev spicevmc,id=spicechannel0,name=vdagent
After typing above command, we still cannot see anything, because we have to use spicy to open a graphical window:
Run the command spicy
and enter 5900, then, click "Connect".
Have fun. Be free.