Rotary Phone Dials 10,000 Digits of Pi 
Saturday, August 23, 2014, 06:33
Posted by Administrator
I've been spending most of my spare time lately working on my Youtube channel and creating 12 hour videos of looped sounds. Usually I'll go with space ship noise, or ambient sounds from SciFi movies, but this time I wanted to do something a little different.

I first had the idea for this when I started noticing that old rotary phones are becoming very nostalgic for people. Most everyone has now switched to using cellphones and it is only a distant memory to use a landline telephone. Rotary phones have officially entered the good-old-memory phase for a lot of people and that is clearly evident in the price a nice working rotary phone will pull on a site like Ebay (40+ bucks).

I recently found an old brown rotary phone at Goodwill and decided it would be perfect for playing all the digits of pi. I took the phone apart so that I could get a microphone closer to its internal dialing mechanism and then I made a series of recordings of playing each digit in a row. After quite a bit of trial and error I got a recording of each digit that I liked.

Next up I split each digit into .wav files so that I could feed them into this short and simple python script that I wrote:

# This script creates all the file ordering for ffmpeg
# First set up our variables

# The numbers file to read in character by character
file = 'pi1k.txt'

# The path that we want to create the files list
path = 'file \'/home/nrg/pi/\''

# The video extension that we decide upon
ext = '.mp3'

# Read in all the characters in the text file in a loop
with open(file) as f:
while True:

# Get the next character and set it to c
c =

# If there is no character to read break
if not c:

# There is no switch/cast statement in python
# So lets just be extra lazy and use if statements
if c == '1':
print path + '1' + ext
elif c == '2':
print path + '2' + ext
elif c == '3':
print path + '3' + ext
elif c == '4':
print path + '4' + ext
elif c == '5':
print path + '5' + ext
elif c == '6':
print path + '6' + ext
elif c == '7':
print path + '7' + ext
elif c == '8':
print path + '8' + ext
elif c == '9':
print path + '9' + ext
elif c == '0':
print path + '0' + ext

I fed the script a long list of digits of pi ( with the period removed ) and generated a long text file where each line specifies a wav file location corresponding to that lines digit in pi.

The only thing left to do at this point was to concatenate all the files together. Luckily ffmpeg does this quite easily with a command such as the one below:

ffmpeg -f concat -i pilines.txt -c copy 10000.wav

I then took the wav file which was produced and generated the following Youtube video with a combination of Openshot and Avidemux:

Image Removed

Pretty satisfied with how this all came out especially since it was so easy to complete this project. The hardest part by far was getting some good audio samples of the rotary mechanism on the phone.

I was beyond pleasantly shocked to see that I was featured on for this video in the following article: What the First 10,000 Digits of Pi Sound Like Dialed on a Rotary Phone

If you have any ideas for the next project I should work on please leave them in a comment below. Thanks for reading!
2 comments ( 10036 views )   |  permalink   |  related link   |  $star_image$star_image$star_image$star_image$star_image ( 3 / 9771 )
The original Super Mario Bros sound effects 
Sunday, April 27, 2014, 16:26
Posted by Administrator
I have created a playist of all the original Super Mario Bros sound effects looped for one hour on youtube. It amazes me to this day how iconic these sounds have remained. People who haven't even played this game recognize many of the sounds easily.

Super Mario Bros Sound Loops

Also check out the related link for an awesome post by Jake VanderPlas who made the image above by doing some neat python hacking on the smb sprite sheets.
add comment ( 11653 views )   |  permalink   |  related link   |  $star_image$star_image$star_image$star_image$star_image ( 3 / 381 )
Online Sales Physical Notification with a Raspberry Pi 
Friday, January 24, 2014, 15:15
Posted by Administrator
Selling no longer wanted things from my apartment online with Amazon and Ebay is one of my new favorite hobbies. I take pride in getting quality items out for sale in a timely manner but it has been a constant drag to be checking my email account hundreds of times a day to see if I have sold anything. I’ve been mentally working on an idea to have my ceiling mounted LEDs turn on every time I have a new sale to ship out. I finally sat down to implement this project a few nights ago and was shocked when it only took me about 20 minutes to get everything working the way I wanted.

The hardware component of this is shown below:

Image Removed

This is the set of LED’s that I have attached to the ceiling with thumbtacks and some cardboard. I’ve lately added the green strand of LED leaves that I got at the dollar store. I’ve been controlling these lights with the same “LazierGeek” app I use to turn my binary clock on and off with. The only difference now is that I also let the following scripts turn on the light if they want to.
curl -u username:password --silent "" | tr -d '\n' | awk -F '<entry>' '{for (i=2; i<=NF; i++) {print $i}}' | sed -n "s/<title>\(.*\)<\/title.*name>\(.*\)<\/name>.*/\2 - \1/p

This is a very hand bash script making use of curl that I found online which scrapes Gmail’s atom feed for unread emails and does some sed manipulation to trim down the output to just the senders name and subject. To get this one working just replace the username and password section with your appropriate account information. In conjunction with this script I made the following Python code to run it occasionally.
#!/usr/bin/env python
Unread email notifier - Spike Snell - 2014
Version 1.5
# Import what we need to drive the light
import time, sys, subprocess
import RPi.GPIO as GPIO
from datetime import datetime

# Set Up the GPIO to use our notification light
GPIO.setwarnings(False) # Set warnings to false
GPIO.setmode(GPIO.BOARD) # Use board pin numbering
GPIO.setup(5, GPIO.OUT) # Setup GPIO Pin 8 to OUT

# Loop Forever and Drive the Notification Light
while True:

GPIO.output(5,True) # Turn off the light by default

# Get the current local machine hour in 24 hour format
h = int('%H'))

# Make sure it is after 0700 and before 2100
if h > 6 and h < 21:
# The time is just right so check for sales with bash script
proc = subprocess.Popen(["bash",""], stdout=subprocess.PIPE)
(out, err) = proc.communicate()

# Check if there are recent unread mail subjects that indicate a sale
if out.find("ship now:") > 0 or out.find("item sold!") > 0:
GPIO.output(5,False) # Turn on the light

time.sleep(600) # Wait ten minutes
To run this notifier I use the command " sudo nohup python & " this lets me run the script in the background as a nohup ( no hang up ) process where the output is logged to nohup.out so that I can monitor the state of it remotely if I wish. Every 600 seconds ( 10 minutes ) this script will wake up from its slumber and fire the Gmail scraping bash script. If any of the subjects match text information indicating that an online sale has occurred it turns the LEDs on. If no sales have occurred lately it sets the LEDs to their off position. One handy feature of this is that after I have checked my email to see what sale occurred the lights automatically turn themselves off after a while since the email is no longer unread at that point. I might increase the delay in checking for sales since I’m a little hesitant to be polling Gmail for information this frequently and don’t want to be a nuisance to a service I rely so heavily on.

The only complaint I have about my notification system so far is that it is annoying when it comes on in the middle of the night when I am trying to sleep and wakes me up. I'm probably going to modify this code tonight so that it doesn't come on at night even if a sale has occurred but then operates normally if it is daytime.

So far this sales notification light has been working splendidly. Future expansions could include making the light blink to indicate how many sales have occurred or to have the script also text my phone to let me know that something sold. I’d love to hear any ideas or comments that the rest of you have about this small project.

-- Edit 2.11.14

I have updated the Python portion of the code to reflect my latest version which doesn't turn on at night. This one is much more straightforward because the indicator light's off position is the default state. Periodically the light will turn off briefly and then back on when going through another cycle if there is an active sale; this operational feature is to make it even more obvious that a sale has occurred.
5 comments ( 72905 views )   |  permalink   |  related link   |  $star_image$star_image$star_image$star_image$star_image ( 3 / 6239 )

<<First <Back | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Next> Last>>