Skip to content

Instantly share code, notes, and snippets.

@gavv
Created May 2, 2019 08:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gavv/e5834a8b0d30eb7ee48de30c88709660 to your computer and use it in GitHub Desktop.
Save gavv/e5834a8b0d30eb7ee48de30c88709660 to your computer and use it in GitHub Desktop.

Generate input

sox -r 44100 -n -b 16 -c 2 input.wav synth 1800 vol -1dB

Record output

parec -d <sink>.monitor | sox -t raw -b 16 -e signed -c 2 -r 44100 - output.wav

Render plot

./show_glitches.py ./output-roc.wav ./output-pulse-native.wav ./output-pulse-rtp.wav

Roc

On receiver:

roc-recv -vv -s :10003 -r :10004 --latency 250ms --nbsrc=17 --nbrpr=17

On sender:

roc-send -vv -s <receiver-ip>:10003 -r <receiver-ip>:10004 -i ./input.wav --nbsrc=17 --nbrpr=17

PulseAudio "native"

On receiver:

sudo /etc/init.d/avahi-daemon start
pactl load-module module-native-protocol-tcp listen=0.0.0.0 auth-anonymous=1
pactl load-module module-zeroconf-publish

On sender:

pactl load-module module-zeroconf-discover
./ffmpeg_decode ./input.wav | ./pa_play_async_poll 250 >/dev/null

Tools are available here and here.

PulseAudio RTP

On receiver:

pactl load-module module-rtp-recv sap_address=0.0.0.0 latency_msec=250

On sender:

pactl load-module module-null-sink sink_name=rtp
pactl load-module module-rtp-send source=rtp.monitor destination_ip=<receiver-ip>
play ./input.wav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment