Raspberry Pi as radio recorder

if you do not want do play the files on the pi you can skip the following part

play mp3-files on the PI

first you install the following package (drivers)

  sudo apt-get install alsa-utils

  sudo modprobe snd-bcm2835

then you install the program to play the mp3 files or streams

  sudo apt-get install mpg321to listen through the analog-audio you have to configure it as follows
  amixer cset numid=3 1set output to line-out (0=auto, 1=analog, 2=hdmi – here 1 for analog)

now you have a simple audio-playback. try a mp3-file or a mp3-stream
  mpg321 test.mp3
  mpg321 http://mp3stream1.apasf.apa.at:8000

to test the audio output do the following
  speaker-test -t sin -f 440 -c 2 -s 1if you have an old micro-speaker from a pc, it works best with 2000Hz
  speaker-test -t sin -f 2000 -c 1 -s 1

install streamripper to record web radio

first install streamripper (needs about 200kB (wow))

  sudo apt-get install streamripper 
it’s a very simple program with automatic separation of the songs (if supplied by the radio-station). if you start the following command, your mp3-files will be saved into a new folder named after the radio-station

  streamripper http://mp3stream1.apasf.apa.at:8000

if you want just on big file from a radio-show use -a and you get a large seperate file
  streamripper http://mp3stream1.apasf.apa.at:8000 -a
in combination with cron-job you can define the recording length -l and the destination directory -d
#write log
echo -n „START $now “  >> /home/me/mylog
# -A don’t write individual tracks
# -a for no auto-files
# -l 20 for 20 seconds recording, 300 = 5min, 3600 = 1h, 7200 = 2h
# -d for destination-path
# -i no id3-tags
# –xs-none dont’t search for silence
# -m number of seconds before fore-closing stalled connection
# 2h + 3m = 7380
# 1h + 3m = 3780
streamripper http://mp3stream1.apasf.apa.at:8000 –xs-none -a -A -i -l 7380 -d /media/RALLY2/www/ -m 60
# orig file sr_program_2013_05_26_21_00_02.mp3
/bin/mv /media/sda/www/FM4/sr_*.mp3 /media/sda/www
/bin/rm -r /media/sda/www/FM4/*
#write log
echo END $now >> /home/me/mylog
create a script file with the content above and add a new line to your cron-job using crontab -e (list existing crons with crontab -l). here is a sample for a radio-show each sunday at 21h.
  59 20 * * 0 /home/me/scr/recordFM4_2h.sh

  59 23 * * 0 /home/me/scr/recordFM4_1h.sh

the log of crontab can be viewed with
  grep CRON /var/log/syslog

here are some radio-stations 
Austria Alternative FM4 
Austria Culture Oe1/Ö1
Germany Culture Deutschlandfunk

init soundsystem on reboot



Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:


Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s