PDA

View Full Version : FM/AM radio (from antenna)



koenie
2007-07-02, 11:33
I am new to digital music players and my wife wants to be able to listen to radio as well as music. There exist a few devices that can do this. Is this also possible with slimserver (or a plugin) to recieve your local FM/AM radio broadcast and stream them?

bpa
2007-07-02, 12:19
For PC Linux boxes with tuner cards such as Hauppuage WinTV with the FM tuner - you can use this plugin

http://forums.slimdevices.com/showthread.php?t=18904

I'm playing around with a Griffin Radio Shark with the intent of using it on a NAS - this will give AM/FM and the Radio Shark2 has optional external antenna.

peterw
2007-07-02, 12:55
I've been using a RadioShark (original version) on a Linux Slimserver system. I use the DarkIce software to feed the RadioShark output to an IceCast streaming server as a constant bitrate MP3 stream, and tune in to the stream URL provided by IceCast. I have not built anything to allow changing the station -- there's not that much desirable terrestrial radio near me. To listen, I press Favorites, arrow down to the "Radio" favorite, and press Play.

You might search the forums for RadioShark, and RadioTime, too (RadioTime caveats: http://forums.slimdevices.com/showthread.php?t=34909). RadioTime is a very nice idea, but I found it lacking mainly due to the local broadcasters' providing only very low quality (32k!) streams.

In addition to live streaming, having a tuner on your Slimserver host also allows you to record programs for later listening.

mflint
2007-07-03, 13:19
I've been using a RadioShark (original version) on a Linux Slimserver system. I use the DarkIce software to feed the RadioShark output to an IceCast streaming server as a constant bitrate MP3 stream, and tune in to the stream URL provided by IceCast. I have not built anything to allow changing the station -- there's not that much desirable terrestrial radio near me. To listen, I press Favorites, arrow down to the "Radio" favorite, and press Play.

I've been playing with the RadioShark too... and the only thing I've got working so far is tuning the device from Perl. (I figured that'd be the trickiest bit, so tackled it first)

So between us it looks like we have enough info for a good implementation... I may ask you for details of your IceCast solution when I've made a bit more progress on the tuning plugin.

Matthew

bpa
2007-07-03, 13:28
If you are using a Linux system with ALSA then after tuning the following command can be run

arecord -c 2 -f S16 -r 44100 -D hw:1,0

This produces a WAV stream on stdout from the Shark and can be used in the same way mplayer is used for AlienBBC. For some system the sample rate of 44100 may be too fast so a lower one can be used.

peterw
2007-07-03, 15:30
I've been playing with the RadioShark too... and the only thing I've got working so far is tuning the device from Perl. (I figured that'd be the trickiest bit, so tackled it first)

So between us it looks like we have enough info for a good implementation... I may ask you for details of your IceCast solution when I've made a bit more progress on the tuning plugin.

Matthew

No problem.

Here's my setup in a nutshell:

An init script sets the permissions (this probably *ought* to be done in udev, but since I already needed to use the 'shark' app anyway, I figured I'd just use the init script), turns off the LEDs, tunes the shark, and starts the DarkIce app:


# turn off the RadioShark LEDs
/usr/local/bin/shark -blue 0
/usr/local/bin/shark -red 0
# tune the RadioShark
/usr/local/bin/shark -fm 88.5
# start streaming the RadioShark output
chown $darkiceuser /dev/dsp2
daemon --user $darkiceuser /usr/bin/darkice -c /etc/darkice-shark.cfg &

"daemon" there is from the standard Red Hat/Fedora init script "functions" library. Once this is running, all you need is for some user to run the 'shark' tool to change the tuner.

My DarkIce config looks like this:



[general]
duration = 0
bufferSecs = 5
reconnect = yes
[input]
device = /dev/dsp2
sampleRate = 44100
bitsPerSample = 16
channel = 2
[icecast-7]
[icecast2-0]
bitrateMode = cbr
format = mp3
bitrate = 160
server = localhost
port = 8000
password = my secret password
mountPoint = shark.mp3
name = Radio tuner
description = RadioShark output
url = http://10.1.2.3
genre = various
public = no


I decided on constant bitrate MP3 to conserve CPU power -- it's far easier on the server to stream 320k CBR MP3 than to try making more compact variable bitrate streams. The metadata ("description = RadioShark output") is constant. It'd be nice if this could reflect the current radio station name. IIRC, more dynamic metadata was easy with IceS, but didn't appear easy with DarkIce. Or maybe I was too lazy to fully RTFM. Since I almost always listen to the same station, I didn't have much motivation to work that out.

I then tune to the Internet Radio URL http://10.1.2.3:8000/shark.mp3 to listen to the tuner. As you'd expect, buffering means it takes a few seconds to hear the new station when you re-tune.

To record radio shows, I use the 'streamripper' utility. Since there's one multi-hour radio show I record regularly and FM doesn't sound all that good (especially with my RadioShark in the basement?), I use 160k CBR MP3 to keep the recordings a bit smaller. I also use DarkIce to stream what's on my stereo (so I can listen to vinyl anywhere in the house!), and for that I use the 320k MP3. I tried using IceS to stream Ogg, but that was unlistenable because my Squeezeboxes played the music back too slowly. DarkIce/lame is more efficient than IceS, too, so I haven't checked to see if later firmware releases fix the slow Ogg stream playback.

I'd love to see a plugin that I could program (through the web UI?) some "presets" for. Bonus points for supporting some sort of locking mechanism, so the script I use with streamripper could indicate that it was recording something and not to allow changing the station. But I've got very, very little time for side projects at the moment.

I hope that helps.

-Peter

bpa
2007-07-03, 17:06
Attached is a quick and dirty plugin and script I put to together to test basic Shark operation as a URL and accessible from SB interface (taken from the other Radio plugin which used V4L interface).

It provides.
1. URL like interface with "shark:" prefix so that you can use Tune-in or a playlist entry eg. shark:106.0 - tunes into 106.0 MHz.
2. Interface on SB allow you to enter the frequency directly.

You need to have ALSA installed as the script uses "arecord". Using "arecord" allows an easy way to alter parameters such as sampling rate.

To install.
1. Unzip and install in the Plugins directory
2. Build shark2 executable (if using a Shark2) and install executable. You need libhid installed.
3. copy shark.sh from SharkTuner/src directory into Slimserver Bin directory. Edit shark.sh to reflect where shark2 executable has been installed and make sure shark.sh is executable.
4. Restart slimserver.

mortslim
2007-07-06, 14:23
I want to put a good word in for RadioTime. Before I obtained my squeezebox, I played around with the RadioShark for awhile. It's cool and does what it says it does.

However now that I have my squeezebox with the free RadioTime service, I have not looked back.

RadioTime gives you static free digital connections to your favorite radio stations, courtesy of the squeezenetwork.

Yeah the bitrates are rather low, but then again, I use RadioTime for talk radio, which doesn't require a higher bitrate. And I don't have to worry about antenna reception issues.

In Los Angeles, we have AM 640, 790 and 870 which are good enough to be syndicated around the country in various markets because of their host's personalities (including Dennis Miller on AM 870), and NPR radio at FM 89.3 and 89.9 as well as FM 97.1 (Howard Stern's old station and still used by Tom Likus). Also I like Michael Savage's show, The Savage Nation, showcased on 244 stations on the RadioTime service.

Both RadioTime and third parties offer software for recording shows, just like the RadioShark.

If I want music, the squeezenetwork offers thousands of stations on other services (Pandora, Rhapsody, RadioIO, Acuradio, Shoutcast, Live365, etc.) for high bit rate streaming.

If I am in the mood for talk, I can get it through RadioTime.

My two cents.

rainjacks
2008-12-17, 13:56
My current setup takes the line out from a stereo system and goes to the line-in/mic jack on an old laptop. I'm running Windows on the laptop. Initially I used Windows Media Encoder to take the soundcard input and create a stream out of it. This worked great, except when I tried to listen with softsqueeze. WME only creates Windows Media streams, not MP3 streams.

Now I use m3w and icecast. They can both be found easily through a Google search. Both programs are open source. They simply take the soundcard input and create an MP3 stream. The setup works flawlessly. Now, I can listen to any output from my main stereo system anywhere through my Squeeze-System.