How to add sound to an Ubuntu LXD VM

No, QEMU doesn’t have support for virtio-sound, it only has support for the intel audio or realtek type virtual sound cards which LXD won’t use.

In general, LXD doesn’t use virtualized hardware like those, only paravirtualized hardware from virtio. So until QEMU grows support for virtio-sound, your only option is to use raw.qemu as you described above.