With recent Ubuntu systems (17.10 in this case), it is necessary to run
pulseaudio at system start or manually to get audio via ssh.
pulseaudio is started on a per-user basis as default, so if nobody is logged in, you only get the null sink for your SSH login, where all audio vanishes quietly.
For a permanent solution, a systemd service could be created:
cat <<EOF >/etc/systemd/system/pulseaudio.service
ExecStart=/usr/bin/pulseaudio --system --disallow-exit --disable-shm --exit-idle-time=-1
which makes sure that the pulseaudio daemon is started as the user pulse at startup. Since this is highly discouraged by the developers, the preferred solution for temporary use should be to issue
sudo pulseaudio --system -D via SSH.
If a pulseaudio instance is already running, it should be killed to allow the new instance to discover the hardware. This impacts the audio for all logged-in users and should be handled on a case-by-case basis.
In any case, the logged-in user needs to be part of the pulse-access group:
sudo usermod -a -G pulse-access userName
Now it is possible to play sounds via SSH on the remote system (
mpv or others). Success can be checked by
pactl list short sinks for proper audio sink detection.