Skip to content

Instantly share code, notes, and snippets.

Created June 24, 2015 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4ff67cf77d276e571af1 to your computer and use it in GitHub Desktop.
Save anonymous/4ff67cf77d276e571af1 to your computer and use it in GitHub Desktop.
#!/bin/sh
date=`date +"%Y_%a_%b_%d_%H%M%P"`
#url=http://4533.live.streamtheworld.com:80/KKFNFMAAC_SC
url=http://relay.broadcastify.com:80/il_chicago_police2
#output_filename=104_3.${date}
output_filename=CPD.${date}
duration=60
#output_dir=/var/www/radio/data/recordings
output_dir=/home/linaro/Podcasts
cd $output_dir
# Capture Stream
mkfifo $output_filename.wav
mkfifo $output_filename-silenced.wav
# The lame settings below are optimized for voice encoding
# The sox command below strips out any silent portions
lame -S -a -m m --ty "$YEAR" --vbr-new -V 9 --lowpass 13.4 --athaa-sensitivity 1 \
--resample 32 $output_filename-silenced.wav $FILE.mp3 > /dev/null&
sox $TEMPFILE.wav -c 1 $output_filename-silenced.wav \
silence 1 1.9 2.5% -1 1.9 2.5% > /dev/null&
streamripper $url -d $output_dir -l $duration -a $output_filename -o always
#!/bin/bash
#
# record.sh
#
# Use mplayer to capture the stream
# at $STREAM to the file $FILE
#
# example: record.sh my_radio_show 60 mms://someserver.com/stream
#DIR=/home/linaro #directory where to save the file
#TEMPDIR=/tmp
# Don't edit anything below this line
#######################################################
#DATE=`date +%j-%A-%B-%d-%Y-%I-%M-%S` # Save the date as DD-Mmm-YYYY
#YEAR=`date +%Y` # Save just the year as YYYY
#NAME=$1
#DURATION=$2 # enough to catch the show, plus a bit
#STREAM=$3
#TEMPFILE=$TEMPDIR/$NAME-$DATE
#FILE=$DIR/$NAME-$DATE # Where to save it
# Capture Stream
#mkfifo $TEMPFILE.wav
#mkfifo $TEMPFILE-silenced.wav
# The lame settings below are optimized for voice encoding
# The sox command below strips out any silent portions
#lame -S -a -m m --ty "$YEAR" --vbr-new -V 9 --lowpass 13.4 --athaa-sensitivity 1 \
# --resample 32 $TEMPFILE-silenced.wav $FILE.mp3 > /dev/null&
#sox $TEMPFILE.wav -c 1 $TEMPFILE-silenced.wav \
# silence 1 1.9 2.5% -1 1.9 2.5% > /dev/null&
#/usr/bin/mplayer -quiet -cache 500 \
# -ao pcm:fast:waveheader:file="$TEMPFILE.wav" -benchmark -vc null -vo null \
# -noframedrop $STREAM > /dev/null&
#sleep 5
# get the pid of all processes started in this script.
#PIDS=`ps auxww | grep $TEMPFILE | awk '{print $2}'`
# the & turns the capture into a background job
#sleep `echo ${DURATION}*60 | bc` # wait for the show to be over
#kill $PIDS # kill the stream capture
#rm $TEMPFILE.wav
#rm $TEMPFILE-silenced.wav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment