“The Bees… They’re EVERYWHERE!”

March 3rd, 2006

Elder Brenders (right) from Lyon, France decided to do this. In Heilbronn the chapel is designed in such a way that bees can somehow find their way into the building, but cannot get back out again. They congregate near the windows frantically flying around until they lose all strength, give up, and die.

In the springtime this is especially troubling because the number of bees that get stuck rises from about 2 per day to somewhere near two thousand! People have to swat them away all during Sacrament Meeting, and the missionaries volunteer to come and sweep up the piles of dead bees before Sunday comes every week.

The choice of the phrase “I Love Bees” is pretty funny considering how much we all hated them after having to clean them up week after week.

I Love Bees!

Record Streaming Audio with Linux: Part II

March 3rd, 2006

I said I was looking into getting FIFOs working so that the filesize requirements would be reduced. It’s also more efficient this way. I was heavily influenced by the two scripts created by Daniel Howard.

So here’s how it works. You get to create two scripts. The first one is for recording. It’s an all-purpose script that I called record.sh. Here is the code:

#!/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</p>
<p>DIR=/home/shawn/PodCasts #directory where to save the file

TEMPDIR=/tmp</p>
<p># Don’t edit anything below this line

#######################################################

DATE=`date +%d-%b-%Y`  # 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</p>
<p># Capture Stream

mkfifo $TEMPFILE.wav

mkfifo $TEMPFILE-silenced.wav</p>
<p># 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 0.2 0.5% -1 0.2 0.5% >/dev/null&

/usr/bin/mplayer -quiet -cache 500 \

    -ao pcm:file=”$TEMPFILE.wav” -vc dummy -vo null \

    -noframedrop $STREAM >/dev/null&</p>
<p>sleep 5

# get the pid of all processes started in this script.

PIDS=`ps auxww | grep $TEMPFILE | awk ‘{print $2}’`</p>
<p># 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

This script takes three args:

  1. the name of the show you’re recording. This will be used in the final filename with the current date appended.
  2. the length of the show in minutes
  3. the URI of the stream (often mms:// or http://)

This integrates very well with another script that will hold all the data for the shows we want to record and automatically set the start times for us. Here is my script that I called today.sh

#!/bin/sh

#

# today.sh — schedule what programs you want to rip today using the

# recorder script.</p>
<p># Non-obvious paths

RECORDER=$HOME/bin/record.sh

RECORDER_HI=$HOME/bin/record-hi.sh</p>
<p># Set up stations

KFI=”http://a814.l1977144512.c19771.g.lm.akamaistream.net/D/814/19771/v0001/reflector:44512?MSWMExt=.asf”

WXNT=mms://wmc1.liquidviewer.net/WXNT

WPGB=”http://84.53.144.36:80/D/1046/20063/v0001/reflector:43803?MSWMExt=.asf”

KOZZ=mms://lotusradio-kozz.wm.llnwd.net/lotusradio_kozz</p>
<p># What day is it?

TODAY=`date +%a`</p>
<p># EVERY DAY

#everyday() {}</p>
<p># WEEKDAYS

weekday() {

	# “Record John_Ziegler for three hours, starting at 7:00pm.”

	echo $RECORDER John_Ziegler       180  $KFI | at  7:00pm

	echo $RECORDER Glenn_Beck         180 $WPGB | at  6:00am

}</p>
<p># MONDAY

if [ $TODAY = “Mon” ]; then

	# everyday

	weekday

fi</p>
<p># TUESDAY

if [ $TODAY = “Tue” ]; then

	# everyday

	weekday

fi</p>
<p># WEDNESDAY

if [ $TODAY = “Wed” ]; then

	# everyday

	weekday

fi</p>
<p># THURSDAY

if [ $TODAY = “Thu” ]; then

	# everyday

	weekday

fi</p>
<p># FRIDAY

if [ $TODAY = “Fri” ]; then

	# everyday

	weekday

fi</p>
<p># SATURDAY

if [ $TODAY = “Sat” ]; then

	# everyday

	echo $RECORDER Handel_On_The_Law   300 $KFI | at  6:00am

	echo $RECORDER Dr_Dean_Edell        60 $KFI | at  2:00pm

fi</p>
<p># SUNDAY

if [ $TODAY = “Sun” ]; then

	# everyday

	echo $RECORDER Jesus_Christ_Show   180  $KFI | at  6:00am

	echo $RECORDER Glenn_Beck          180 $WPGB | at 10:00am

	echo $RECORDER_HI Dr_Demento       120 $KOZZ | at 10:00pm

fi

Using this as a template you might notice another script being referred to. record.sh has audio processing optimized for talk radio. For higher quality and stereo, you need to change a few things. You can download all of the scripts mentioned here at the bottom of this post.

To finish off this solution you need to run today.sh at some point after 12:00am and before the start of the earliest program you wish to record. I set mine to run daily at 1:00am.

# Schedule recordings for today from radio streams

0 1 * * * /home/shawn/bin/today.sh >& /dev/null

Downloads:

Wie sagt man “Blatant Rip-off” auf Deutsch?

March 2nd, 2006

One of my favorite rip-offs was this unassuming little fast food grill restaurant in Ludwigsburg. The entire name is “Fried Chicken from Kentucky Land.” Although KFC franchises do exists in Germany, the closest one is over two hours away from this place. It is doubtful that most people that eat here even know what Kentucky Fried Chicken is. Maybe the owner just has a sense of humor.

Fried Chicken from Kentucky Land

Record Streaming Audio with Linux: Part I

February 28th, 2006

Update: For a better solution check out this newer post

I happen to enjoy listening to Glenn Beck. The problem is that I can’t receive his weekday shows where I live. Even if I could receive his weekday show over the air, I wouldn’t hear most of it because I am busy working all day.

The solution: cron and mplayer with a little help from sox.

Here’s a sample script:

#!/bin/bash

# Use mplayer to capture the stream

# at $STREAM to the file $FILE</p>
<p>DATE=`date +%d-%b-%Y`  # Save the date as DD-Mmm-YYYY

YEAR=`date +%Y` # Save just the year as YYYY</p>
<p># Where you want the file saved.  Leave off file extension

FILE=/home/shawn/PodCasts/Glenn_Beck_Show_$DATE</p>
<p># The following file should be a playlist file such as .asf or .asx

# You can also create your own file with a URI and put it here

STREAM=/home/shawn/bin/glenn_beck_show-6-9am

DURATION=3.1h # enough to catch the show, plus a bit

#DURATION=200s # a quick run, just for testing</p>
<p># For the id3v2 Tags

AUTHOR=”Glenn Beck”

ALBUM=”104.7 WPGB-FM Pittsburgh”

TITLE=”Glenn Beck Show – $DATE”</p>
<p># Capture Stream

/usr/bin/mplayer -really-quiet -cache 500 \

    -ao pcm:file=”$FILE.wav” -vc dummy -vo null \

    -playlist $STREAM &

# the & turns the capture into a background job

sleep $DURATION  # wait for the show to be over

kill $! # kill the stream capture</p>
<p># remove gaps and convert to mono

sox $FILE.wav -c 1 $FILE-silenced.wav \

     silence 1 -0.9 2% -1 -0.9 2% ;

rm $FILE.wav ; #remove original capture</p>
<p># Encode to .mp3, mono 32kHz 32kb/s, and tag the file

lame -a -m m –tt “$TITLE” –ta “$AUTHOR” \

     –tl “$ALBUM” –ty “$YEAR” –vbr-new -V 9 \

     –resample 32 $FILE-silenced.wav $FILE.mp3 ;

rm $FILE-silenced.wav # Remove the raw audio data file

Once all of the variables have been set, make this executable and make a cron job for it.
crontab -e

Here’s an example for starting at 6am every weekday:

0 6 * * 1-5 /home/shawn/bin/glenn_beck.sh >& /dev/null

Notes

  • The basis for this script is the one found at this Linux Journal article.
  • You need at least SoX version 12.17.9 for the silence filter to work properly.
  • MPlayer should be fairly recent. Older versions have a different syntax for pcm (wav) audio output
  • This solution still requires huge amounts of disk space (~500MB/hour). I am still experimenting with using named pipes (fifos) to do all of the file processing in RAM and only output the final encoded file to the disk.

Neglecting to Choose The Right

February 27th, 2006

This was on the side of the a buiding on the walk from the S-Bahn to the Stake Center in Stuttgart. CTR is a well known LDS abbreviation for “Choose The Right.” October 2002.

CTR Graffiti

links for 2006-02-27

February 27th, 2006

Mine is the Church of Emacs?

February 26th, 2006

Written on the chalkboard at the beginning of Elder’s Quorum meeting was the follwing:

  • What is vi?
  • What leads to vi?
  • What are the effects of vi?
  • How do I avoid vi?
  • Do I have vi?
  • How do I get rid of vi?

Which is better, vi or emacs? That is the age old debate among *NIX users. I never thought the Church would establish any doctrine on the matter, and for a minute I was second guessing myself.

As it turns out the teacher was just being lazy and “vi” stood for “vain imaginations.” I think I like my original notion better.

Tokers on the Top Floor

February 24th, 2006

We periodically receive notes from the manager slipped through our doors informing us of upcoming events and of problems that tennants and the staff may be having with the behaviour of other tennants. Usually these are somewhat humorous. The humor is generally not found in the content of the letter, but rather in the manager’s complete disregard for spelling and language use conventions. However, this was not the case today.

Here is an excerpt from the letter we received in our doors today:

Marijuana Letter

We frequently get letters informing us that certain tennants are putting things on their balconies that are not allowed even though we have nothing on our balcony. Most of these letters are delivered to every tennant in the apartment complex, but this letter was only delivered to tennants in our building. I have never smelled the marijuana, so they must be on the other side of the building or far away. I have often heard people walking around after midnight, though. I just assumed the guy above us worked an evening shift and came home late. All I can say is that these issues haven’t bothered us at all.

Now if we can just keep people from leaving the bass turned up when they watch TV at one in the morning.

No Good Deed…

February 22nd, 2006

Post It NoteMy Uncle just recently moved into a different apartment complex. I won’t say that it’s new, because it’s not. I was helping him by setting up his computer for him and getting him to the point where he can get on “the intarweb.” He told me that I could park anywhere. Furthermore, he told me when we got there which parking space to park in. I was there from around 8:00pm until almost 11:00pm. The computer is really slow and they just moved in so there are boxed and things everywhere. Most of the time spent was trying to find all the components and cables and get them plugged in somewhere. After a long while I was finally able to return home. It had not been a fun experience.

As I was walking out to the car I felt a little uncomfortable, almost as if someone were watching me. When I got to the car I found a Post It note affixed to the driver’s side window which read:

You are parked in my space. Do not park here again or you will be towed.

All I have to say is, “Thank you.” I can only imagine how the rest of the night might have been had I come out to find my car gone. I only wish that I knew which car belonged to the kind soul who spared me the frustration and the $200, because I would have put a post it on their window saying:

Sorry for the inconvenience that I may have caused you by parking in your spot. Thanks for not ruining my day!

Your Friend

Rock and Suck

February 21st, 2006

In a blog posting at his website, rentzsch.com, Jon discusses a scanner that he recently purchased for his computer. He describes its overall quality in the following way:

It’s not rock, but it’s not suck. Apparently, nonsuck is the best the scanner market currently offers.

This is one of the most efficient descriptions of any product’s quality that I’ve ever seen.
The verbs to rock and to suck (meaning to be good or to perfom well, and to be bad or to perform poorly respectively) have been “nouned” here. Usually Nouns get “verbed” in English, but here we see the opposite. A more standard rendering of this sentence would be: “It doesn’t rock, but it doesn’t suck.”