Compute pi to base 12 using Python?

François Pinard pinard at iro.umontreal.ca
Thu Apr 14 10:18:08 EDT 2005


[Bengt Richter]

> It might also be interesting to keep a running sum of the base 12
> values and use sum % 88 to select piano keys, to let it walk intervals
> outside of a single octave ;-)

The generated would then run from the low octaves to high octaves
monotically, then start over again and again.

Maybe a more interesting approach might be to pick the note in the same
octave, the octave below or above, where the new note is closest to the
preceding one.

> a "random" walk picture was interesting.

Using the closest note would have similarity with a random walk, given
π digits are seemingly random.  On a random walk, one gets away from
the departure point on average, the distance being proportional to
sqrt(N) where N is the number of steps.  So, when using the closest
note, one would need a corrective device nevertheless so notes are kept
near the middle of the range of comfortable audible frequencies.

> Anyone have an easy python midi interface for windows to play on the
> sound card?  I could generate a .wav file to play tones, but midi
> would be much more compact ;-)

There are surely many.  I use my own (Python) interfaces on Linux, and
even there, by combining a few tools, it is rather easy to get .WAV
files out of MIDI.  In any case, googling around might help.

-- 
François Pinard   http://pinard.progiciels-bpi.ca



More information about the Python-list mailing list