By default you can not pass sound through to your host Windows system’s audio devices from a Linux virtual machine. I struggled finding reliable instructions for getting this to work and ended up using a third party solution called PulseAudio.
Attention: If you are using a newer edition of Ubuntu these instructions will not work. The more modern versions do not include XRDP in the base image. There is an updated version of these instructions that will get sound working at https://techbloggingfool.com/2020/12/26/deploy-a-linux-vm-on-hyper-v-with-sound-20-04-edition/
To get started, you’ll need an Ubuntu VM to work with and we’ll need to install Hyper-V if you haven’t already. Open PowerShell as an Administrator and install the Hyper-V components. Run: Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

Hyper-V can also be installed using the GUI. Go to the Control Panel -> Programs and Features > Turn Windows Features on or off and choose it from the menu (both boxes).

Once you have the Hyper-V tools installed, launch the Hyper-V Manager and use the Quick Create feature to automatically install and configure and Ubuntu Linux VM.

After the creation of your new VM has finished, right click on it in the Hyper-V Manager and start the virtual machine. Right click on it again to connect to the console.

After you get logged on to your new Linux machine, the first thing we need to do is to configured the repos so that you can download the PulseAudio software we will be using to enable your VM’s sound. In the show Applications menu, open Software and Updates. Go to the Ubuntu Software tab and select all of the boxes.

Now, open a terminal from the Show Applications menu and run the following lines to install and configure PulseAudio. Reboot the Linux VM when you are finished.
cd /tmp
sudo apt source pulseaudio
cd /tmp/pulseaudio*
sudo ./configure
cd /usr/src/xrdp-pulseaudio-installer
sudo make PULSE_DIR="/tmp/pulseaudio-11.1"
sudo install -t "/var/lib/xrdp-pulseaudio-installer" -D -m 644 *.so
When the system comes back on line, connect again and use the Show Applications menu to open Settings. Go to the sound section and set the Output device to xrdp sink. Set the Input Device to xrdp source. That’s it. If everything went according to plan, your Ubuntu VM should be able to pass sound through to your Windows Host.

Getting an error after sudo ./configure
checking for gm4… no
checking for m4… no
configure: error: m4 missing
and can’t continue
LikeLike
Ok solved it by doing:
sudo apt-get install m4
but then also needed the following before ./configure would complete:
sudo apt-get install libtool
sudo apt-get install libsndfile-dev
sudo apt-get install libcap-dev
LikeLike
After installing required dependencies to get ./configure to work, now the next step i get this…
michael@UbuntuVM:/tmp/pulseaudio-13.99.1$ cd /usr/src/xrdp-pulseaudio-installer
bash: cd: /usr/src/xrdp-pulseaudio-installer: No such file or directory
Not sure what to do next, your guide appears to be missing a lot of steps…
LikeLiked by 1 person
According to the developer’s github documentation:
https://github.com/neutrinolabs/pulseaudio-module-xrdp/wiki/README
Ubuntu 18.04 with xrdp 0.9.5 will not have xrdp-sink device appear unless /etc/xrdp/pulse/default.pa is replaced with the following content:
.nofail
.fail
load-module module-augment-properties
load-module module-always-sink
.ifexists /usr/lib/pulse-11.1/modules/module-xrdp-sink.so
load-module /usr/lib/pulse-11.1/modules/module-xrdp-sink.so
.endif
.ifexists /usr/lib/pulse-11.1/modules/module-xrdp-source.so
load-module /usr/lib/pulse-11.1/modules/module-xrdp-source.so
.endif
load-module module-native-protocol-unix
LikeLike
bad directions. this doesn’t work
LikeLike
Apologies, I missed your comment somehow. Try these instructions: https://techbloggingfool.com/2020/12/26/deploy-a-linux-vm-on-hyper-v-with-sound-20-04-edition/
LikeLike
An alternative could be to use VLC. See https://mclark.wordpress.com/2020/07/23/how-to-stream-audio-from-pc-to-another-pc-phone-or-tablet-with-vlc-media-player-a-step-by-step-guide/
I don’t know what I will try yet.
LikeLike
Your instructions worked for me for Ubuntu 18.04 with minor changes. I also needed to do the following prior to your instructions:
sudo apt install xrdp-pulseaudio-installer
sudo apt-get build-dep pulseaudio
LikeLike