MacDevCenter    
 Published on MacDevCenter (http://www.macdevcenter.com/)
 See this if you're having trouble printing code examples


Homemade Dot Mac: Home Web Radio

by Alan Graham
12/13/2002

If you've been paying attention to what's happened with the deregulation of the airwaves, you may have noticed that most of the dial is owned by a few media conglomerates which control most of what you hear. Many of us turned to the internet to find a tasteful alternative to all of the FM noise. And while the future of webcasting is currently tied up in the muck of figuring out fair music licensing fees, there is no doubt in my mind that the internet is the last bastion for music.

If the idea of having your own radio webcast, for fun or profit, intrigues you, then you've come to the right place. Even if you don't plan on sharing your musical tastes with the world, you can have a lot of fun creating private playlists you can stream 24/7, to almost any web device in your home. Or maybe you just want to be able to tune into your music anywhere, anytime, on any machine. Well guess what? You've probably got most of what you'll need sitting on your home machine. Moreover, setting up your own station is easy to do and costs nothing to get running.

What You'll Need:

Step 1: Calculate Bandwidth

Related Reading

iMovie 2: The Missing Manual
By David Pogue

First thing you need to do is calculate the adequate server bandwidth for your station. If you figure to provide your stream at the same rate to all visitors, the basic calculation for this (via Apple's Knowledge Base) is to multiply the maximum number of users you expect by the bit rate you plan to stream. So, for your own private use, if you plan on serving up to three connections at 128Kbps over the Internet, you need an upload connection speed greater than 384Kbps to keep a "stutter free" connection. If you plan to run your station over a LAN connection (streaming playlists to multiple terminals in your home), you could probably sustain as many as 50 to 60 connections on a 10Mbps network (not taking network traffic into consideration). As you can see, if you plan on running a commercial or non-profit station for the public, you'll need a fat pipe.

A DSL or cable connection isn't fast enough to support a lot of visitors but is usually adequate for serving your personal use. Before you start streaming be sure that it doesn't violate the service agreement with your ISP.

Step 2: Install/Configure QuickTime Streaming Server

The next thing you need to do is download the QT Streaming Server from Apple's site and install it. Once the install is complete you'll find the installer placed an icon in your Applications folder that looks like this:

Screen shot.
Apple's QTSS Icon.

Since the server can be configured and controlled through a web browser, this icon will always take you there. Go ahead and configure the server for the first time with the defaults in place. You may need to make some adjustment based on your own network settings or personal preferences.

Screen shot.
Your admin username and password...

Screen shot.
Your MP3 password...

Screen shot.
For most people a SSL connection won't be necessary.

The QTSS requires that you use one folder as the main source of your media. Most people use iTunes and the music is located in the Music folder. You may wish to change the default location because moving all your media isn't practical. The path to your iTunes folder should resemble this: /Users/yourusername/Music/iTunes/iTunes Music

Screen shot.
This screen is for the location of your music files.

Screen shot.
Streaming on port 80 could interfere with Apache or other web servers running on your machine.


Step 3: Promotional Spot

Related articles:

Digital Killed the Video Star -- Alan Graham shows how to create videos with just a scanner or digital camera, a $10 shareware app, and an OS X Mac.

Homemade Dot-Mac with OS X, Part 2 -- In part one of this series, Alan Graham showed you how to make your OS X Mac a functional Web server, and essentially create your own .Mac site. Now he digs even deeper into firewalls, domain names, and FTP.

Homemade Dot-Mac with OS X -- So you don't want to pony up the $99 annual fee for .Mac? No problem if you've switched to Mac OS X, because everything is built-in for you to set up your own .Mac suite of services. Alan Graham shows you how.

Depending on the level of professional spit and polish you want on your station, you may want to put together a promo spot to let people know who you are. There is a really simple way to pull this off using some royalty free iMovie music, a microphone, and iMovie.

In a previous article I talked about using some of the free music Apple provides in your iDisk, but of course you have to have a .Mac subscription for that. If you don't belong to .Mac, all you really need is a short piece of music in MP3 format or you can skip the music portion of your spot completely.

Open iMovie and import your music clip, then head over to the audio tab of iMovie and record the vocals of your promo spot. Since I don't have any call letters, I settled for, "You're listening to O'Reilly Radio."


Screen shot.
You'll find the "record" button in the audio tab.

Take the music clip and drag it into one of the music tracks down below. You're vocal spot should already be waiting for you. Then just move the two tracks so that they fit together in a manner that sounds good to you.

Screen shot.
Fitting the audio tracks together.

You can listen to my promo spot here.

Once you're done editing your audio track, export the movie as QuickTime. We need to make some changes to our file as we export it. When you choose to export the file as QuickTime, you'll get an option to alter the format. Select the Expert setting in this menu.

Screen shot.
Select "Expert".

Now click Prepare for Internet>Quicktime Streaming Server.

Screen shot.
Prepare for Internet...

Finally, change the compression settings to MPEG-4 and export.

Screen shot.
Select MPEG-4.

You now need to convert the movie file from MPEG-4 to MP3 before you can use it with the other music files. This is very easy. First open iTunes and drag the file into your Library.

Screen shot.
Time to edit the promo "song" information.

The next step is to edit the promo spot "song information" so that when you convert this file to MP3, it will automatically create a promo folder where we can collect future files. Simply highlight the file and select File>Get Info. At the top of the window type a title for this spot, like "Promo Spot 1". Under Artist, type something like "My Promotional Spots". In the Album field name it "Promo Spots", and now you have a folder to place all future promo files.

To convert the file to MP3, highlight it and select Advanced>Convert Selection to MP3. Now you can delete the old file from the Library and move on to getting your station up and running.

Step 3: QTSS General Settings

Screen shot.
General Settings

Open the server and jump on over to General Settings. Here we want to double check that our Media Directory matches your iTunes folder. You can set your maximum number of connections and your maximum throughput. Remember to calculate your required bandwidth. When your traffic exceeds the maximum throughput, the server will not allow any more connections. If you want to run the server 24/7, check Start Server at System Startup.

Step 4: Build A Playlist

You can create playlists using most text editors, but most people will find it easier to create a playlist through the server's web interface. Our main QTSS screen looks like this:

Screen shot.
Main QTSS screen.

Jump to the Playlists link to the left. At the Playlists screen, click on the button to create a new MP3 playlist.

Screen shot.
Select "New MP3 Playlist".

Creating the actual playlist is quite simple, although there are a few quirks.

Screen shot.
Creating the playlist.

  1. Name -- Enter the name of your station: whatever name you enter here, will be displayed in the client's music player.
  2. Mount Point -- Part of the URL location that your users will use to tune into your station. By entering different Mount Points for different playlists, you could run more than one active playlist for different genres and listeners could listen to different types of music.
  3. Genre -- Simply the genre of the music.
  4. Play Mode/Repetition -- "Sequential" plays the media in the order it appears in the playlist. When the last file is done playing, the broadcast stops.
  5. Available Media List -- Select the tracks you want to appear in you playlist and drag them over to the Playlist column (6.) to the right. You can shift-click items, but unfortunately you cannot Command-click them. You can enter any folder in the Media List by double clicking. Also in this listing you will find the folder with your promo spots in it. After creating your playlist, drag and drop your promo spots between however many songs you wish for it to play.
  6. If you want to keep a log of this playlists activity, select the option here.
  7. Save you settings and we're almost ready to tune in.

Step 5: Final Steps

You have a few small items to finish up before you are ready to go. First, go back to the main Playlists menu using the link to the left. Now make sure that your QTSS is running by pressing the start button in the upper left hand corner.

Screen shot.

Next, you need to start the playlist. Click on the "play" button in the Playlist window.

Screen shot.
Just press the button...

Screen shot.
Notice the change in status...

Step 6: Tune In

We've installed our server, created our promos, configured our server, built our playlists, and started our server. Now it is time to test our station by tuning in.

Open up iTunes and select Advanced -> Open Stream (Command-U). Enter your IP address or URL followed by the port number and finally the Mount Point. It should look something like 192.168.2.9:8000/oreilly (where the IP address or URL is your own). If everything goes well you should hear some tunes blasting from your speakers.

Step 7: Remote Administration

One handy feature of the QTSS is remote administration. You can make changes to the server or your playlist no matter your location. Access the server by typing your IP Address or URL and specifying port 1220.

Step 8: Help

Apple has an extensive help file associated with QTSS. You can access it via the server's interface, but you can also find it here.

Enjoy! There are tons of exciting things you can do with the QTSS and Mac OS X. Streaming can be a complicated task, but hopefully this will get you started. In the future we'll touch on more advanced streaming topics such as video and mobile broadcasting via the iPod.

Alan Graham is the creator of the Best of Blogs book series and is a frequent writer on the O'Reilly Network.


Return to the Mac DevCenter.


Copyright © 2009 O'Reilly Media, Inc.