Penguin

A piece of Hardware that allows you to pick up broadcast radio on your computer.

Many TvTunerCards have a radio tuner built in.

Tuning/Listening to the radio

You can use the "radio" application to tune and listen to radio stations. This is part of the xawtv(1) package, but in Debian at least it is split into its own binary package:

  apt-get install radio

Here is a sample /.radio configuration file for it (based on Hamilton frequencies):


[Stations]
89000000=The Generator
89800000=ZMFM
91400000=Concert Radio
92000000=More FM
93000000=The Rock
93800000=Solid Gold
94500000=Life FM
96000000=Radio Hauraki
97000000=scan-9
97800000=scan-10
98600000=Classic Hits
99300000=scan-13
99950000=scan-14
101000000=National Radio
103340000=scan-16

[Buttons]
1=89000000
2=89800000
3=91400000
5=93000000
6=93800000
7=96000000
8=100100000

Gnome Radio is a nice gui for GTK2 that can store frequencies and record streams onto disk as Wav, MP3 or OggVorbis.
RedHat users with Dags repo set up on Apt or yum can install `gnomeradio`

Recording

1. Use the Gnome Radio program as above.

2. From the command line:

Step 1 - (Make sure your sound card's mixer is set to record from the appropriate device - eg from Line In if you are using a loop-back cable).

Step 2 - run the "radio" command or whatever program you use to get output to the sound card.

Step 3 - run the following commands (or put them in a script and run that). Press Ctrl-C to finish.


 #!/bin/sh

 # -c 1 for mono

 # -s signed/-u unsigned, -w words (2byte samples)
 datatype="-s -w"

 # cd quality sample rate
 rate="-r 44100"
 # this is fine for voice recordings
 rate="-r 22050"

 # I like ogg.
 encodecmd="oggenc - -o out.ogg"
 #If you prefer mp3, you could install "gogo" and use
 #encodecmd="gogo stdin out.mp3"

 sox -t ossdsp /dev/dsp -t wav -c 1 $rate $datatype - | $encodecmd

Note that these commands aren't really radio-specific - they could be used for recording anything, although the settings here are ok for radio-quality audio. Also, if you use ALSA then you will need to have OSS-emulation drivers loaded.


Troubleshooting

UDev

UDev by default (at least in Debian and Ubuntu) doesn't create a symlink for /dev/radio (to /dev/radio0), but the 'radio' program tries to use /dev/radio.

To tell udev to create a symlink, create a file called 00_video4linux.rules in the /etc/udev/rules.d directory, with the following content:

# make a symlink to the first radio device
KERNEL="radio0",        SYMLINK="radio"

Misc

The driver for the radio tuner on the saa7134 tv tuner card seemed to have been broken for LinuxKernel 2.6.8, but works again in 2.6.9.

Kernel parameters

There is an insmod parameter for saa7134 "radio_nr" that specifies the number of radion device and ther is probably no "radio" flag parameter, by which you can turn the support on/off (use modinfo for more info). But if you want to use a radio and your doesn't have an EEPROM, you must set the "card" parameter explicitly and the board you set MUST have a builtin radion. Otherwise the radio just won't play, and no error message appears.


See also Video4Linux


CategoryHardware