Streamer - pirate radio for the digital age
 
Update - set your bandwidth to no more than 50kbps please people. I't failing if it tries to relay too many feeds. And 24kbps is the max bitrate that seems to work properly. Cheers.

 
I'm publishing this in response to the closing of Audiogalaxy and the imminent closure of many net radio stations. This can't be closed. I never did like bullies.
 
 
Streamer is an internet radio program that allows anyone to broadcast streaming mp3 music, to an unlimited number of listeners, from an internet connection as humble as a 56k modem, and with the broadcasting pc being fairly untraceable.
 
It works by relaying the mp3 data stream from one listener to the next, forming a branching tree with the broadcasting pc at the base. This is different to the normal method where all the listeners connect to a central server, and it means you don't need lots of server bandwidth. There is also no limit to the number of listeners, since each new one provides more relay bandwidth to the network.
 
It's also fairly untraceable because each streamer 'host' doesn't reveal any information about whether it is actually the transmitter or not, or where it is getting it's signal from. And I plan to make it completely untraceable for broadcasters who wish.
 
This is a beta version, work in progress. There's no clever network optimisation yet, or stuff to handle when listeners leave without disconnecting other downstream listeners. You are likely to get disconnections for large audiences. It definitely works ok for half a dozen or so people though, all using 56k modems. Enough to play your tunes to your mates :-)
 
 
Download streamer.zip
Check for updates regularly please, it doesn't happen automatically yet.

Download the source code

It's been GPL'd now, (mostly for my own personal safety). But please people, don't all do your own versions of it until I've had time to add some of the refinements I want to put in. Volunteer coders wanted please :-).

To install it:
Unzip streamer.zip into a new folder somewhere. It doesn't actually need 'installing'.
 
To use it: (quick guide)
Run 'streamer.exe'. You will see a DOS-type window, (this will be changed, but it's a beta for now). Your web browser should open, showing 'Streamer p2p relay radio', and a menu. If this doesn't happen, click on the file 'web', or 'web.url'. 
 
Click 'configure'.
Set your internet connection speeds for upload and download, in kilobits (not bytes) per second. Examples: 512 & 128 for cable, or 56 and 33 for a 56k modem. Setting these too high will make streamer unreliable, too low will inhibit growth of the distribution network, and limit the choice of streams available. You can leave the default settings for now if you wish, it will still work.

Click 'Stations'.
If anyone on the network is broadcasting, their station name should show up in this list. Refresh the page if nothing shows up at first.

Click on a station name to tune in.
The mp3 player installed on your pc should then open and connect to streamer. Winamp works fine, windows media player doesn't. If that opens, close it, start winamp, and drop the 'sound.pls' or 'sound' file onto it.
Streamer will ask the streamers on other pc's that it knows about for the audio stream, and eventually you should hear sound. It can take a couple of mins for the sound to start playing though, because of a bug. Be patient please. When Streamer is receiving data, rows of numbers scroll up in it's display. These show the state of blocks of data in the receiving buffer, are so I can see what's happening inside.
And that's it, music should flow within a couple of minutes. Let's start a broadcasting revolution.
 

How it works
 
Streamer forms a decentralised network, making short lived connections with many other hosts to ask them individual questions. This is different to p2p systems like gnutella which makes semi-permanent connections to a few other hosts. Some questions streamer asks are 'tell me some other hosts you know about', 'tell me some broadcasting stations you know about'. If there is no reply, that host's 'not answering' count is incremented, and eventually it gets removed from the list. If an answer does arrive, the returned data is either added to the 'known hosts' list, or the 'known stations' list. There is a background flux of network messages, about 0.1k/sec or so, much less than gnutella.
You can add the IP of a host from the 'hosts' screen. The IP of my home PC is automatically added to the list each time you run streamer, and it remembers hosts from last time you ran it. Refersh the page to see hosts gradually appearing. All the extra numbers in the display are for debugging, you can ignore them. 'nr=' is the number of times that host has not replied. After a while Streamer stops asking dead hosts questions, and removes them from it's list.
 
Streamer keeps a list of stations it has learned about during each run. This list is cleared each time you run streamer, in order to prevent 'dead' stations hanging around forever. (which they can still do though, the station cache system needs improving). When you click on a station name to tune into it, streamer starts asking hosts that are also tuned the same station to send it the data stream. It also tries to collect more hosts who are also listening to that station.
 
Click 'tuning' to see the progress of seeking for a data feed. This page shows the name of the station you are seeking, and if you have a signal yet.
 
Streamer currently uses Winamp (or any other icy-200 mp3 streaming receiver) to actually listen to the mp3 data that it's receiving. No point re-inventing the wheel. Streamer is really just a method of shovelling the data around the network. It doesn't actually process or interpret the data at all.
 
If you are not actually listening to a station, running streamer on your pc will still help with network stability. It only uses a small amount of background bandwidth.
 
It uses three ports. 8462 to connect to winamp for output, or the plugin for input. 8464 for the web interface, and 8466 for all the main network traffic, which is all UDP to avoid that annoying TCP 'ack bottleneck' traffic jam.
'8466' is 2112 in hex, which I thought was an appropriate number. An audiogalaxy user posted a message on the AG site after the RIAA shutdown, saying the words 'We have assumed control, we have assumed control' where going round in their head. I prefer the words 'And the meek shall inherit the earth'.
 
 
To be a broadcaster.
It's quite simple. First you need something to create the mp3 data stream. I'm currently using the shoutcast dsp plugin for winamp. It's another wheel, although for copyright reasons I should probably create my own plugin to do the same thing. Get it from www.shoutcast.com. You have to sign their licensing stuff I think to download it. I've just been told about a replacement plugin here: http://www.oddsock.org/tools/dsp_oddcast/

Install the plugin, configure it to output to port 8461 (or maybe 8460, or 8462). Choose your mp3 format.
Remember that for the relaying system to work properly, each relaying pc needs to be able to upload 2 copies of the data stream, so don't go mad with the bitrate. My cable modem can do 128k up, so the max bitrate should really be just less than 64k if you are aiming for cable users. You need to allow some overhead for data resends, and general network traffic. Currently though it jaffs if you use even 48kbps, 24k seems to be ok though. PLEASE use 24kbps or less for now, else it doesn't seem to work.

For 56k modem users, the best you can really do is 3kbps or so. My 56k modem can't even manage that, although they should do 33kbps up. Even this bitrate can only be relayed by a modem to one other pc, so you really need some helpful high bandwidth listeners to distribute the signal. I use an old version of the plugin for modem use, because the current one doesn't offer a low enough bitrate.

Next, edit the 'sblurb.dat' file. It's just a text file for your station's blurb, and shows up on the 'text' page in the browser view. Keep it less than 450 characters or so.

Run streamer, goto the 'configure' page. Edit your stations name and stream id, and substream 1's bitrate to match what you set in the plugin. Any number except 0 is ok for stream id. It's what streamer actually searches for when attempting to tune in. Set the data type to 'mp3'. This should happen automatically, but doesn't actually seem to.

Click the connect button on the plugin, and it should connect to streamer and start sending data. The 'tuning' page should then show your station's name, and 'on air' at the bottom. The song name stuff doesn't work yet.

Whenever other hosts ask for more stations, your streamer will now always send your stations name & info, so it should spread around the network. This isn't a very good method though, and low listener stations may be hard to find. To assist in station info propagation, all listeners also always send their current tuned station's info, so popular stations should be easier to find. Doing this compremises the anonimity slightly, so I'll probably take it out for stealth broadcasters.
 
You can 'stack' several streamers on one pc. Make a separate folder for each, and run them with command line 'streamer.exe 1' to add 10 to each port number, or 'streamer.exe 2' for 20, etc. Stacking is useful for testing your radio station. To tell one local streamer about another local one, enter 127.0.0.1:8466 on the 'hosts' page. Change the '8466' to '8476', or whatever is appropriate. If you enter no port number, it defaults to 8466. (There seems to be a daft bug with the port numbers sometimes though).
 
There's no listener count yet. To be added soon, along with stats to give some idea about the 'shape' of the data tree.
I also plan to add the ability to switch broadcasting pc's, so one dj can take over from another.

And I know it falls over, and is well susceptible to the skript kiddies, and to 'clone' stations. It is 'work in progress', released in a hurry. I intend to add public key encryption so streams can be verified, and other stuff. And a proper GUI too. Who wants to help ?
 

So what do you think? email iain@chaotica.u-net.com or icq 32952155

Or alternatively - try my psychedelic arcade game 'Spheres of Chaos' (PLEASE!, I sold 1 copy in the last 2 weeks, and I'm trying to make my living writing games.)
(pps - someone look at the 'raid' crack for Spheres of Chaos please - I'm sure it's a dual-payload job, with a trojan in it. The first time I debugged it, it decrypted itself and the string 'zonealarm' appeared inside it, and it was in the process of dropping a funny named file too. I couldn't duplicate this behaviour though)