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)

Here are pre-compiled binaries for AudioStreamer (Win32, Darwin). You can compile the program yourself by downloading the source code. AudioStreamer is licensed under the GNU GPLv3 license.

audiostreamer.zip, [610KB, Win32]
audiostreamer.tar.gz [37KB, Mac OSX 10.5+]

(SOURCE CODE [1513KB])

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)

7 Comments

  1. Sam says:

    Nice one mate, works perfectly, Are you still working on this project? I would love to be able to select sound cards.

  2. Sam says:

    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

  3. Hoong Ern says:

    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.

  4. Sam says:

    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

  5. Sam says:

    Hi Hoong,

    I have been using this software regulatory over the last few years now, it has been performing very well. Would you ever consider releasing the Win32 source code? I would love to ad the ability to select sound cards and maybe ad options to change sample rates etc..

    Sam

    • Hoong Ern says:

      Hi Sam,

      Glad that the program has been working for you. I quickly threw everything together (source code etc.) into a package, which you can download from the link above (or here). You'll need 7zip to unzip it. I didn't test anything, and no longer have Visual Studio, so I can't ensure that the Visual Studio project file will be working, but all the source code is there. I also don't see why it wouldn't compile on mingw32.

      Soundcard selection / sample rate options would be done via portaudio, unless you have something else in mind.

      I'd love to continue this project but I just don't have time right now - so hopefully releasing the code helps! (Not that it's pretty or well implemented - I did it in a hurry)

Leave a Reply

Spam, shameless advertising and comments which do not contibute to the value of the post may be deleted!