Friday, November 19, 2010

Codec2 across the network

Using a recent version of Ubuntu, we can use netcat to glue together some network transport of Codec2, preliminary to getting it on the airwaves. (Since Linux makes ax.25 <-> TCP/IP doable, we're theoretically half way there if we can get c2 within the network context.)

Here's a command to set up a quick and dirty listener on port 20000. Note that I've changed the source code for c2dec so that it inputs from stdin and outputs to stdout. 'pacat' is the pulseaudio cat command that pipes sound into the pulseaudio system.
ncat -l -k 20000 | /home/brucerob/Codec2/codec2/src/c2dec | pacat --channels=1 --rate  8000
ncat likes to die when it has dealt with a single transfer, so we use the -k command to 'keep' it alive.

What about the source side of our network? We just pipe c2-encoded data into a netcat command, like this:
pacat -r --rate=8000 --format=s16le --channels=1  | ./c2enc | netcat localhost 20000
Again, the c2enc command has been altered to do the right thing.

The result is pretty good, but with about 12 seconds of lag. Some buffers are taking their time getting filled, and I'll have to look into that.

No comments:

Post a Comment