10

Background

My father has an old radio program that he loves. It is a series of recordings done 30-40 years ago, but now he has found out that they are sent now and then as a historical retrospects. He loves them and don't want to miss a single one. He is eager to record them so I found a little program called CoolRecord that can record from broadcast through web player. It works OK, but the problem is that there recording is done through audio card and when he uses Skype to talk to his grandchildren he always messes up sound settings and when the next recording session comes everything is chaos ....

Idea

Now I recently found out that it is possible to catch the radio stream BEFORE it passes through the audio card. This is great news! I searched and found the url to the broadcast. On http://www.listenlive.eu/sweden.html I found the following url that looks promising: http://sverigesradio.se/topsy/direkt/1602-hi-mp3.pls. It is an MP3 decoded stream with 192 kbps.

I searched the web and found several software for listening to radio and even record, but all Windows based software that I have found records audio stream after it has passed through the computer audio card .... I actually found a freeware for Mac who does the right thing. It is called FStream but it has no Windows version ;-)

My intention is therefore to build a VERY simple program that will always connect to the same radio station and catch the stream directly without going through the audio card.

I want to keep it dead simple to my father: All he needs to do is to push a big red record button when it is time for his favorite program! No hassle with confusing audio settings, just a file automatically saved to his audio directory.

Questions

I prefer to use C#. I guess the .Net class library has some useful methods that might help me on .... But I have never worked with radio streaming and broadcast technology. 1) How do I set up a "stream listener"? 2) Is it possible to detect program title and automate the recording start/stop? 3) How do I save the stream to a MP3 file? Do I need to add headers etc? 4) Do I need to take care of possible interrupts in the streaming?

Jonas
  • 121,568
  • 97
  • 310
  • 388
Jakob Lithner
  • 4,225
  • 6
  • 38
  • 59
  • VLC media player has capability of ripping internet streams to mp3 files. – Spook Aug 27 '14 at 11:03
  • Pop open the .pls file in a text editor. Within it you will find the URL of the actual audio stream. Downloading it is as simple as using curl pointing to the address from above. Automating it in a program is as easy as downloading a file... The only difference being that this file is endless, so you need to interrupt the download to finish. – spender Feb 19 '18 at 00:23

2 Answers2

2

The latest version of NAudio added support for MP3 streams. It's a very mature audo management library for .NET that is easy to work with. You can stream the incoming buffer into most supported audio formats.

Tomislav Markovski
  • 12,331
  • 7
  • 50
  • 72
2

Have a look at streamripper. It seems to be doing what you're trying to achieve and is also available on windows. It also seems to be generating separate mp3s automatically using silent marks in the audio stream if you want to.

There also exists a "dead simple" frontend to streamripper, called SimpleRipper which might be just what you need.

Stefan Paul Noack
  • 3,654
  • 1
  • 27
  • 38
  • 1
    I'm not happy with this as answer because it's not much more than a software recommendation. This isn't what was asked, and if it was, the question would be closed. – spender Feb 19 '18 at 00:48
  • @spender I see your point, the answer should at least contain some code examples on how to achieve the things OP specifically asked for, using the mentioned library, so that anyone finding this answer can immediately see if it fits their needs. Feel free to edit the answer or provide a better version yourself and I'll upvote it! (also, wow, this answer is old!) – Stefan Paul Noack Feb 27 '18 at 13:28