User Tools

Site Tools


wifiaudio:start

This is an old revision of the document!


Sending Microphone Input to another device over TCP

How it Works

  • Essentially we are using NETCAT to pipe audio from a mic input on one computer to the audio output of another computer.
  • It appears that ssh adds a lot of latency around 1-2 secs which is not acceptable more most instances
  • Netcat on the receiver need to starts before the transmitter starts to send otherwise the transmitter script will exit with a connection refused.

Requirements

  • Alsa needs to be working on both computers and alsa-utils should be installed to save mixer settings
  • aplay/arecord also need to be installed along with netcat. In most distributions they are installed as base packages
  • Obviously some sort of tcp/ip must be running to for the netcat communication to work.

Receiver

wifi_audio_recv.sh
#!/bin/sh
 
PORT="8080"
RATE="5"
BUFFER="50"
FORMAT="cd"
 
while [ true ]
do
        netcat -l -p ${PORT} | aplay -B ${BUFFER} -r ${RATE} -f ${FORMAT}
done

Transmitter

wifi_audo_send.sh
#!/bin/sh
 
PORT="8080"
RATE="5"
BUFFER="50"
FORMAT="cd"
 
RECV_ADDR="<IP>"
RECV_PORT="8080"
 
arecord -B ${BUFFER} -r ${RATE} -f ${FORMAT} | netcat ${RECV_ADDR} ${RECV_PORT}
wifiaudio/start.1450900832.txt.gz · Last modified: 2015/12/23 14:00 by tschulz