I am working on my remote machine with datasets of audio files, and it becomes very uncomfortable to not be able to listen to the audio samples directly from the terminal.
Fortunately, PulseAudio allows us to do that very easily. My current setup is the following:
- Remote Machine: Linux Server (Ubuntu 18.04)
- Client: Macbook (OSX Catalina)
Follow these steps on your Client Machine:
1. On the Mac, install PulseAudio with brew :
brew install pulseaudio
2. Configure a listening daemon that will receive the audio from the remote machine. This daemon will not be persistent and will stop after you restart your computer or stop the process.
pulseaudio --load=module-native-protocol-tcp --exit-idle-time=-1 --daemon
3. Usually, PulseAudio will listen on port 4713, but double-check the listening channel with:
lsof -i -P | grep -i "listen"
4. Connect to your server by establishing a Reverse Port Tunnel. This will forward the audio from your remote machine, from the (arbitrarily chosen) port
24713 to our local port
ssh -R 24713:localhost:4713 server
Now follow these steps in your remote machine (inside your SSH session)
1. Install PulseAudio
apt-get install pulseaudio
2. Make the remote PulseAudio server send to the chosen port
3. You can check that your computer appears as the listening device when you call
Server String: tcp:localhost:24713
Library Protocol Version: 32
Server Protocol Version: 33
Is Local: no
Client Index: 12
Tile Size: 65472
User Name: xxxxxxxx
Host Name: xxxxxxxx-MacBook-Pro.local
Server Name: pulseaudio
Server Version: 13.0
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: Channel_1__Channel_2.2
Default Source: Channel_1__Channel_2
4. You can test that the audio is working either with
speaker-test or just play your file with
If the Pulse Audio Player is not working, you can also install another player, play the file and you will still be able to hear. I recommend trying SoX.
Originally published at HELLO, I AM CRISTIAN DUGUET.