16bit WAV Network Audio Streamer (Server/Client)
For one of my course projects, I decided to make a network audio streaming server & client. Tired of low quality voice-chat, I decided to make something which delivers a lot better quality – i.e. 2ch 16bit wav. Obviously, this needs very high network bandwidth (~170KB/s per client).
For portability, I made it cross platform, and have tested it on Windows XP, Mac OSX, and Ubuntu 9.04. Some of the debugging text seems to be a bit buggy, but it otherwise works. It’s just a stand-alone commandline executable, so you’ll have to run it from the command prompt. (I can’t be bothered to build 3 different GUI front-ends for the different OSes, even though GTK is an option)
I’m not currently posting the source code, and I don’t currently have access to my Ubuntu installation & binary executable, so all I’m posting for now is the Win32 & Mac OSX binaries.
Download:
audiostreamer.zip [610KB, Win32]
audiostreamer.tar.gz [37KB, Mac OSX 10.5+]
Here is the commandline usage:
usage: audiostreamer.exe <type> <port> <hostname>
<type> specifies whether we are running as a server or client
Values: 's' (server) or 'c' (client)
<port> specifies the host/port to listen on (as server) or to
connect to (as client)
<hostname> specifies the host to connect to (as client). No effect
as server
I made use of portaudio, libpthread (win32) for this project.
Audiostreamer will use your default input (For win32 – I haven’t implemented ASIO support yet, so it uses your WAVE input. For Mac OS, it should take your default CoreAudio input – I haven’t actually tested audio input on Mac OS)
Audio is streamed through the TCP port of your choosing. You NEED a fast network connection for this, or you may experience buffer underruns. Make sure you forward your port if needed (through your firewall/router)
November 3rd, 2009 at 6:02 pm
Nice one mate, works perfectly, Are you still working on this project? I would love to be able to select sound cards.
November 3rd, 2009 at 7:19 pm
Actually no, its not prefect. Using the windows version the server crashes after an hour or so.
Using windows batch I wrap the RX side in this batch
@echo off
echo ///Streaming PCM 16 bit Audio.
set server_url=192.168.88.68
set port=12000
:start
title Receiving from %server_url%
echo.
echo -------------------------------------------------------------------------------
audiostreamer.exe c %port% %server_url%
echo -------------------------------------------------------------------------------
ping -n 1 %server_url% >nul
goto :start
and the TX side in this batch
@echo off
echo ///Streaming PCM Audio.
set port=12000
:start
title ///Streaming PCM Audio.
echo.
echo -------------------------------------------------------------------------------
audiostreamer.exe s %port%
echo -------------------------------------------------------------------------------
ping -n 3 %server_url% > nul
goto start
November 9th, 2009 at 1:47 pm
Hi Sam, I sent you an email. Repeated here:
I actually did this project in a rush, it was a final project for one of my classes, so indeed there may be bugs (I'm not even convinced myself whether it works that well). What version of Windows are you running? Does the server crash all the time you run it? i.e. - is the crash replicable? Just confirming, you're running 1 server and 1 client instance? Does it crash if you run it purely on localhost (127.0.0.1)? I'll run some tests on my side and see what I can do.
As for choosing multiple soundcards, I'll see what I can do. It's actually not that hard to implement. But I guess it's not that useful to have that option if it's crashing anyway, so I'll try to look at that first.
November 14th, 2009 at 4:46 pm
Dear Hoong,
Thank you for your reply. I have been running the app for a few hours today across my wireless network with out any problems, So I'm not sure what was the cause of the crashes as I'm using exactly the same configuration as before, Windows XP 64 → Wifi-> Windows XP 32.
Regards
Sam