Visual Basic 2010

An Internet Radio Player

Go Back Previous Page

Once the list has been populated, the play begins. It currently defaults to whatever is last in the favourites list and a later development may well be to default it to whatever the last station the user listened to was. There's a development project for you if you want to build something like this.

Once the playlist is populated, playback begins and the player connects to the internet URL concerned. Depending on your connection speed and what it is you're connecting to, the playback will be almost instantaneous or will take a few seconds. The internet connection where I live is incredibly slow as we are rural and nobody can be bothered supplying cable and our telephone exchange was built, I am sure, to service telegraph systems at the time of Samuel Morse himself and has never been upgraded since. So Radio 4 at 128 kb takes about five seconds to connect, as does Classic FM and Radio 1, but why you would  want to connect to Radio 1 is another question entirely and I wouldn't care if it took fifty years (anybody getting the impression I don't like Radio 1 very much?). Radio 3 (320 kb) takes a bit longer. BBC 5 Live (48 kb) takes no time at all and even on my slow internet BBC World Service (32 kb) comes up straightaway.


At this point, you may be asking why there's such a disparity in transmission rates, from 32 kb to 320kb?

It's to do with a thing called the Shannon-Nyquist sampling theory. Here's the usual stream of conversation when that's mentioned:

Me: "It's to do with the Shannon-Nyquist sampling theory."

Other Person: "Is it?"

Me: "Yes, it is."

OP: "Champagne nightmist, you say?"

Me: "No, Shannon-Nyquist."

OP: "Oh, well, that's why that is then. Shampoo tightfist. Of course."

Me: "Shannon-Nyquist ."

OP: "That too. Yes indeed."


There is a lot of really intense mathematics behind the shampoo tightfist......sorry  Shannon-Nyquist sampling theory but what it boils down to is that if you take an audio signal and turn it into a digital one in order to get a reproduction of the signal at the other end then you need to sample at a frequency of at least twice the highest frequency of the audio you are sampling. If you don't, there will be gaps and you will get a sound like bubbling mud, which is truly irritating. Voices can go as high as 3kHz but most of the power is around the 1kHz mark. You can't hear high-pitched sounds when somebody calls you on a mobile phone because the limiter is set to reject anything above 4kHz to save on the sample and therefore data rate.

The World Service is mainly voice, and 32kb is more than enough to include voice and a bit of uncomplicated music as well. 128kb performs reasonably well for music, but Radio 3 wants high-quality reproductions of classical music and so the stream is 320 kb per second. Try listening to Classic FM and then Radio 3. I just bet Radio 3 sounds better. A CD will be about 256 kb, so Classic FM is half CD quality, but their data rate is much faster than Radio 3's.


I promise you that is the end of the underpinning theory. If you are still awake at this point, well done and let's get back to the job in hand. So, the populated list, then:


You can click on any of the station names and it will play that station. If you can't see the station you want you can scroll the list box down until you find it and clicking on it will play that station (after it connects of course).

You can edit the name of the current station and the URL as well in case it ever changes. Currently I've got Radio 1 in the list. Let's say I want to rename it Radio Idiot. (I REALLY don't like Radio 1 do I?) Here's the steps:


First of all I need to select the station I want to edit:





















This does of course mean that Radio 1 will begin playing. May I suggest you mute the player first. Then I need to go to the edit menu:




















Clicking on the edit menu brings up the following:





















and in the text box for the station name I alter the text:






















Once I've finished editing the text I click the "Done" button. This sets several things in train. It updates the visible list but at the same time it updates the text file too. So, as the player is running, and next time I load the list into the player it will look like this:





















There's a remove button in there too. I'm going to enjoy removing Radio 1 when this demo is done.

At some point I may wish to add a station. So:






















and I type in a name and paste in a URL and click done; it updates the file and shows it in the list box.


irpeditmenu irpeditopen irpradio1 irpradioidiot irpidiotdone irpadd irpaddopen More >