Circle and Square

Art, Code, Music, Mathematics

  • About
  • Art:31416kungfu
  • Curated Links
  • Jabberwocky
  • Music
  • OffCenter Apps

Dumb keyboard ready for action

Posted by epsilon on February 4, 2013
Posted in: Music, Photography. Tagged: dumb keyboard, piano, piano practiciing. Leave a comment

20130204-071631.jpg

Great for practicing while on the road – folds once to fit in my backpack or small suitcase.

Location: hotel room in San Diego.


zipTimer: an iPod/iPhone app for pacing piano practice, cooking, workouts, you name it.


Dumb piano keyboard under construction

Posted by epsilon on February 4, 2013
Posted in: Music, Photography. Tagged: dumb keyboard, Music, piano, piano pradticing. Leave a comment

20130204-071527.jpg

I could not find a dumb keyboard to buy, so I made one using stiff cardboard, a rule, pencil, fine marker, thick marker, and exacto knife. Very low-tech, but it works!

If you do this yourself, I recommend a square as well — to make good right angles. You can take measurements from a real piano, or look them up on the internet. I did the latter, since I was away from a piano when I decided to build the dumb keyboard. You can get all the supplies you need at an art store. Oh yes — you need a good cutting surface or you will be in trouble with someone:-) Art stores also sell nice cutting mats if cutting is something you will do regularly.


zipTimer: an iPod/iPhone app for pacing piano practice, cooking, workouts, you name it.


Python’s eval at the command line

Posted by epsilon on February 3, 2013
Posted in: Code. Tagged: command line, eval, python, unix. Leave a comment

With four lines of text you can add a command to do this:

% ev "sqrt(2)"
1.4142135623730951

Below is the code — just put it in your personal bin or script directory:

#! /usr/bin/env python3
import sys
from math import *
print(eval(sys.argv[1]))

This is useful for quick one-line computations. For more, it’s of course better to jump into the Python interpreter — or sage. If you have any Python functions that you want to use in this way, just add an import statement to the above. For example, in my PYTHONPATH directory, I have a file mathtools.py which defines a function factor.
Thus I can do this:

% ev "factor(123456789)"
[3, 3, 3607, 3803]

provided that I add the line

from mathtools import *

to the code for ev.


zipTimer: an iPod/iPhone app for pacing piano practice, cooking, workouts, you name it.


Interior view

Posted by epsilon on February 3, 2013
Posted in: Music, Photography. Tagged: Music, photography, piano. Leave a comment

20130203-015611.jpg


zipTimer: an iPod/iPhone app for pacing piano practice, cooking, workouts, you name it.


Shostakovich Fuga II

Posted by epsilon on February 3, 2013
Posted in: Music, Photography. Tagged: fugue, Music, photography, shostakovich. Leave a comment

20130203-015520.jpg


zipTimer: an iPod/iPhone app for pacing piano practice, cooking, workouts, you name it.


Arduino: send time over serial port

Posted by epsilon on February 1, 2013
Posted in: Code. Tagged: arduino, python, serial port, set time. Leave a comment

Below is Python code to send an appropriately formatted string representing the date and time over the serial port (USB) to an Arduino board. I use this for a temperature monitor.


zipTimer: an iPod/iPhone app for pacing piano practice, cooking, workouts, you name it.


"""
File:     pst.py (Port Send Time)

Purpose:  Set the time on the arduino board
          for use with the Time library found
          at http://playground.arduino.cc/Code/time

Usage:    % python pst.py

Effect:   Send message like "T1359713903" over the serial port
          That is the time string for Fri Feb  1 10:18:23 EST 2013

Config:   Set the variable "time_zone_offset" for the offset to GMT.  The
          value -5 works for US Eastern Standard Time

          Set the variable port to the usb port used by your Arduino
          board.  In Arduino IDE, go to Tools > Serial Port and note
          which port is checked.
          
Ref:      http://www.moosechips.com/2010/07/python-subprocess-module-examples/

Author:   J. Carlson, Feb 2, 2013
"""

import os, subprocess

# Settings
time_zone_offset = -5
port = "/dev/tty.usbmodemfa131"

# Put stdout into pipe
proc = subprocess.Popen("date +%s", shell=True, stdout=subprocess.PIPE)
return_code = proc.wait()
# Read from pipe
for line in proc.stdout:
    time = int(line.rstrip())

# Output to terminal and port
print
os.system("date")
time += 60*60*time_zone_offset
print "Time:", time

cmd = "echo T" + str(time) + " > " + port
print "Cmd:", cmd
print
os.system(cmd)

The Rent-Seekers, Episode 1

Posted by epsilon on December 10, 2012
Posted in: Politics. Leave a comment

Would you believe it?!  We, the public, pay an estimated $3.5 billion per year for medicine because drug manufactures such as Merck pay other companies NOT to put generic drugs on the market.  Sounds like a monopolistic practice to me! See <a href=”http://www.politico.com/story/2012/12/supreme-court-generic-drugs-pay-for-delay-84810.html?hp=r9>politico.com’s article on this subject</a> For general context, see Joseph Stiglitz’s book, The Price of Inequality.

IOS Programming Blogs

Posted by epsilon on October 29, 2012
Posted in: Code. Leave a comment

Objective C

Just so that I can find them again:

Blocks

Blocks, 2

Metaprogramming

New York City #2

Posted by epsilon on May 16, 2012
Posted in: NYC, Photography. Tagged: freedom tower, ground zero, NYC, photography, sky scrapers, world trade center. Leave a comment

New York City

New York City #1

Posted by epsilon on May 16, 2012
Posted in: NYC, Photography. Tagged: cityscape, night photo, NYC, photography. Leave a comment

New York City

Posts navigation

← Older Entries
Newer Entries →
  • Categories

  • Recent Posts

    • Generative Art
    • BonsaiBot
    • New York City
    • Geometry in New York City
    • Nonsense words in Swift
  • Top Posts

    • Dumb piano keyboard under construction
    • Fractal cross
    • Photo by Malika
    • Werner Herzog on Imagery
    • Brownian Motion #1
  • Pages

    • About
    • Art:31416kungfu
    • Curated Links
    • Jabberwocky
    • Music
    • OffCenter Apps
  • Archives

  • February 2026
    M T W T F S S
     1
    2345678
    9101112131415
    16171819202122
    232425262728  
    « Feb    
  • Category Cloud

    31416kungfu Art Code Film Mathematics Music NYC Photography Politics RPi-Arduino Science Travel Uncategorized Words
Blog at WordPress.com.
Circle and Square
Blog at WordPress.com.
  • Subscribe Subscribed
    • Circle and Square
    • Join 143 other subscribers
    • Already have a WordPress.com account? Log in now.
    • Circle and Square
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...