oreilly.comSafari Books Online.Conferences.
Articles Radar Books  

Internet Radio the P2P Way

by Howard Wen
09/24/2002

First there was AM. Then FM. Now, the next evolution in radio broadcast technology could very well be "P2P."

What could be even more controversial than Internet radio/audio broadcasting--which has made headlines this year over the issue of royalty payments--and P2P file sharing? Probably the merging together of these banes of the music industry. Two P2P clients, PeerCast and Streamer, are exactly that. Without the need to have your own dedicated server, these programs let you stream audio files to other users on a P2P network. Essentially, you can run your own Internet radio station whenever you start up your computer and get online.

PeerCast runs on both Linux and Windows and, while the code is not under open source presently (there are plans to put it under open source soon), it is free for anyone to download and use. Streamer, though not as technically sophisticated as PeerCast, is open source and, for now, available only for Windows. Both stream MP3 files, and PeerCast can also broadcast audio files encoded in the Ogg Vorbis format.

Related Reading

Peer-to-Peer
Harnessing the Power of Disruptive Technologies
By Nelson Minar, Marc Hedlund, Clay Shirky, Tim O'Reilly, Dan Bricklin, David Anderson, Jeremie Miller, Adam Langley, Gene Kan, Alan Brown, Marc Waldman, Lorrie Faith Cranor, Aviel Rubin, Roger Dingledine, Michael Freedman, David Molnar, Rael Dornfest, Dan Brickley, Theodore Hong, Richard Lethin, Jon Udell, Nimisha Asthagiri, Walter Tuvell, Brandon Wiley

PeerCast is being developed by a small group, led by Giles Goddard. Goddard, originally from the U.K., resides in Kyoto, Japan where he does contract game-programming work for Nintendo. As for the two people who work with him on PeerCast: "It's a little tricky to elaborate on who the others are because they work for companies that wouldn't support this project. One of them is involved with the music industry," says the 31-year-old Goddard. "So I'm usually the scapegoat for all of this."

There's only one man to blame for Streamer: Iain McLeod of Warrington, U.K., who describes himself as a "self-employed computer game creator." Lately, however, the 39-year-old has been finding himself working more on Streamer, a program which he unabashedly describes as "pirate radio for the digital age" and admits that he created it in response to the music industry's recent efforts to shut down Internet radio stations over royalty payments.

But the two men both feel that their programs can help music artists get their work heard outside of traditional radio broadcasting. "I think it's important for developers to work on constructive projects that help artists and listeners at the same time, rather than just allowing people to rip off their work," says Goddard.

Building a (Virtual) Radio Network

PeerCast was devised about a year ago when Goddard experimented with using Gnutella for uses other than file sharing. The initial incarnation of PeerCast was as an application that looked at query packets to compile a top 1,000 list of the musical acts whose music were shared the most on the Gnutella network. "The idea was to give artists a gauge of how popular their music was, down to the individual tracks," says Goddard. "Demographics like that can be very useful for artists and labels to get a feel for what their listeners like."


PeerCast

Shortly after creating this program, Goddard re-used its code base for PeerCast. What began as a list-compiler application quickly evolved into a totally different one which could stream static media files, like MP3s, on a peer-to-peer network. It wasn't an easy evolution. The toughest challenge for Goddard and his two anonymous partners was coding the servants that talk Gnutella.

"P2P is very hard to do right because packets have to be checked and routed correctly. Connections have to be maintained and dropped appropriately. Network overhead has to be minimal," explains Goddard. "The client also has to work multi-threaded, of course, and it can't use too much CPU or memory because people will be running it in the background while doing other things."

Streamer, on the other hand, was not as difficult to create partly because its underlying workings are not as sophisticated as PeerCast's. Streamer uses the standard C networking functions to open ports, and to send and receive blocks of data. McLeod started developing Streamer in early 2001, and the original version of it took him just a week to put together. He released the program to the public in an unfinished state, but public demand for it suddenly took off. Since then, he has been working to improve it.


Streamer

"The biggest technical challenge was actually in designing the system so it does what is wanted and works properly. All that happens in my head and lots of bits of paper," says McLeod. "The actual implementation of it is not so difficult once I have thought of a way to do something."

While Goddard says that he and his team have ironed out most of the bugs from PeerCast, issues remain with firewalled users not being able to connect to listeners who are behind other firewalls. Thus, it definitely helps to have lots of bandwidth to serve more than just one listener directly.

Goddard describes what they plan to do to correct this: "We're looking into setting up nodes on the networks to function like Gnet super-nodes and to also provide 'boosts' to the network for users who are on slow connections or behind firewalls."

For Streamer, its significant bug is that it doesn't perform too well when set to broadcast at a high bitrate. 24Kbps is the maximum advised for dial-up modem listeners at the moment. Since the program is still in beta, it sometimes does odd things unexpectedly: A station might send audio data with no sound, or broadcasts that are sped-up making a singer sound like a "chipmunk." The program has not been heavily tested with several users listening to a broadcast, and McLeod admits that additional problems will probably crop up when it is.


O'Reilly Emerging Technologies Conference

Download presentations from the 2002 O'Reilly Emerging Technologies Conference which explored how P2P and Web services are coming together in a new Internet operating system.


McLeod has been working on fixes to improve the streaming performance of his program. A forthcoming version of Streamer will upgrade its streaming protocol from a "tree" system to something more like a "mesh" (the technique that PeerCast and the latest P2P clients use). This means there will be alternate broadcast signal paths available when one path fails. This mesh will be able to shift its links around dynamically in order to optimize the network and to gradually migrate high-bandwidth hosts to the center. Fractional signal feeds,where only a percentage of the stream is sent by some hosts, will also be added to take advantage of the low upload bandwidth of dial-up modems and to allow these modems to receive higher bitrate streams.

Goddard and his associates will add several new features to upcoming versions of PeerCast. The most notable include: A "tip jar" payment scheme so that listeners can give artists money; a Winamp plug-in which will let users put up a PeerCast channel on Winamp; a screensaver which can be set to share bandwidth with other PeerCast users; a Mac version of PeerCast; and, what's sure to give Hollywood studio and TV network executives concern, the streaming of video.

Most importantly, the PeerCast developers are researching the feasibility of using multiple audio streams which would broadcast simultaneously in order to increase sound quality. "For instance, having four 32K streams combined to make one 128K stream, but still allowing the four streams to be listen-able by themselves, maybe by encoding every other frequency," explains Goddard.

For future versions of Streamer, McLeod plans to add Ogg Vorbis support; public key encryption for the purpose of broadcaster authentication; the ability to broadcast streams anonymously; and support for including non-audio content mixed into the broadcast stream, such as a station ID logo, an ad banner, or a Web page.

The Next Advancement in Music Distribution Technology--or Radio Piracy?

Thanks to the work that McLeod and Goddard are doing, the path has been paved for a new Internet broadcast medium. A decline in financial means for Internet radio to operate could spur further technological advances and interest in P2P streaming audio and, inevitably, video. The result could be numerous pirate radio and TV stations on P2P networks in the near future.

Of course, McLeod and Goddard are well aware of this scenario, yet neither is daunted by the potential wrath of the music industry, particularly by the major U.S. labels. Asked what he thinks about the looming controversies surrounding online music distribution, McLeod feels he is fighting against what he fears could lead to worse things. "Is the U.S. going to end up with a filtered Internet at the request of the media conglomerates, with 'police-ware' installed on all PCs by law, filtering not unlike the great firewall of China, 'police-ware' like a Big Brother Commie state would use?"

For the PeerCast team, they see their goal as advancing the technology of online music distribution, in lieu of the music industry's reluctance to do so. "We're based in Japan. The Japanese tend to embrace new technology rather than hiding from it like the music and movie conglomerates have done in the West," says Goddard. "We have to find a better way to publish music. At the moment the people who control that appear to have no incentive to move forward. So if they can't, then the rest of us are going to have to do it for them."

Howard Wen is a freelance writer who has contributed frequently to O'Reilly Network and written for Salon.com, Playboy.com, and Wired, among others.


Return to OpenP2P.com.



P2P Weblogs

Richard Koman Richard Koman's Weblog
Supreme Court Decides Unanimously Against Grokster
Updating as we go. Supremes have ruled 9-0 in favor of the studios in MGM v Grokster. But does the decision have wider import? Is it a death knell for tech? It's starting to look like the answer is no. (Jun 27, 2005)

> More from O'Reilly Developer Weblogs


More Weblogs
FolderShare remote computer search: better privacy than Google Desktop? [Sid Steward]

Data Condoms: Solutions for Private, Remote Search Indexes [Sid Steward]

Behold! Google the darknet/p2p search engine! [Sid Steward]

Open Source & The Fallacy Of Composition [Spencer Critchley]