About Me

My photo
By day I'm a propeller-head geek. I design software for electronic components for a major automotive supplier. When I'm not earning a paycheck, I enjoy playing music -- primarily jazz and classical but I dabble in other genres as well. I also compose, arrange, and play with electronic gadgets and toys. My other hobbies include photography, colored pencil drawing, genealogy, model railroading, and crosswords.

Tuesday, May 21, 2013

A More Compact "Pythonic" Guido Function


from random import choice

def guido2(gtxt):
    return [guidoPitches[(len(vmap)*choice([0,1,2]))+vmap[c]]
            for c in gtxt.lower() if c in vmap]

Wednesday, May 15, 2013

A Simple Composition Algorithm According to Guido

I'm reading Musimathics, by Gareth Loy. Composition and methodology is the subject of volume 1, chapter 9, where "Guido's Method" is discussed. The author presents an implementation of Guido's method in his own devised language called MUSIMAT but I wanted to see if I could do the same in Python. So here it is:


import random

guidoPitches = [                        'G3', 'A3', 'B3',
                'C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'B4',
                'C5', 'D5', 'E5', 'F5', 'G5']
vmap = {'a':0, 'e':1, 'i':2, 'o':3, 'u':4}

def guido(gtxt):
    G=[]
    for c in gtxt.lower():
        if c in vmap.keys():
            G.append(guidoPitches[(len(vmap.keys())*random.choice([0,1,2]))+vmap[c]])
    return G

guido('Ut queant laxis resonare.')


Saturday, February 25, 2012

Model Railroad Progress

It's been a long time since I've made any progress on my model railroad. It has gotten a little scenery work here and there but has been non-operational for at least a year - I have yet to get around to completing the electrical wiring. Today, I finally completed the mechanical work of assembling the operating panel. The next step is break out the soldering iron and put wire to terminal. Here is a mockup of the panel - created in Visio:
Figure 1 - panel mockup

I've also devised a way to use SPDP panel switches for my Atlas twin coil switch machines. The unique thing about this design is the use of bipolar electrolytic capacitors - they're a bit pricey but greatly simplify the the design.

Figure 2 - bipolar capacitive discharge schematic

Wednesday, January 11, 2012

True and False in the C Programming Language

I know, C is dead, right? Not quite. While C has been supplanted in many industries by C++, C#, and other object-oriented languages, much of the automotive industry still relies on plain vanilla C - MISRA C, to be specific. I overheard the following question today: "should TRUE be set to !FALSE or should it be set to 1 - which is more MISRA compliant?" I don't know which is more MISRA compliant (off the top of my head), but I'd like to offer an alternative that, to my thinking, is more type-safe and avoids clashes with the macro definitions provided with many compilers.

Since C does not have native support for a Boolean type, it is common to #define TRUE and FALSE:

#define FALSE 0
#define TRUE !FALSE

FALSE is always zero and true may be any non-zero integer, so it is safest to let the pre-compiler decide what !FALSE means. This is portable but not type-safe; TRUE and FALSE may be compared to a result of any type (leaving the type conversion to the compiler). I like to use a typedef'd enumeration, instead:

typedef enum {eFALSE = 0; eTRUE;} BOOL_t;

Since this is "user defined", it is incompatible with the return type of standard library functions, so they must either be handled in the typical manner or with explicit casts.

Thinking about how to define and use boolean types in C reveals an important lesson about the "safe" use of C. That is: Avoid comparisons to TRUE (or eTRUE or whatever). Since zero will always be "false", comparisons with FALSE will always work.

Tuesday, January 03, 2012

Fitting a Round Peg into a Square Hole

I received an iPod nano for Christmas. It's just what I wanted but I was not looking forward to moving the 400+ albums I had in Windows Media Player - complete with album art - into iTunes. My anxiety was warranted: the result was a disaster. So, I took the opportunity to completely re-rip my entire CD library into iTunes. I chose to keep working with the mp3 format but bumped up the resolution from 128 kbps to 192 kbps. I must say that iTunes seems to do a slightly better job of finding album art than WMP, though I still found many albums for which I had to manually paste an image (either found on the web or scanned from the original).

Wednesday, February 10, 2010

Resurrection?

Wow - over two years since my last post here ... wondering if I really have anything to say. Maybe I'm just a little paranoid about putting myself too "out there" on the Web, afraid to voice a disagreeable opinion or to be judged in an unfavorable light. I've witnessed too many "flame wars" ignited and fueled by thoughtless comments and want no part of that childish game. So it's safer to remain a lurker in the shadows. But - what the hell? - nothing ventured, nothing gained.

Random thoughts for today:

I tried Twitter for a short time. I can see its appeal but I had little to say and became overwhelmed with the influx of short messages from those I was following. Tried TweetDeck to get some sort of grip on the volume but the whole thing just became a time vacuum. So I deleted my account and I haven't missed out on anything important yet.

I do have a presence on LinkedIn. My network isn't that big but the service does keep me connected to my career industry.

I uploaded a bunch of stuff to my photostream on flickr - mostly recent art work from my participation on wetcanvas.com.

The Inter-Urban Industrial has been disassembled and moved twice in the last two years. I need to get some new pictures up on Flickr.

Monday, January 08, 2007

Railroad Update

The pictures are here!

The current state of my small N-gauge empire can be seen here.

Tuesday, February 07, 2006

House of Leaves

I've gotten tied up in reading House of Leaves by Mark Z. Danielewski. What an incredible work of literature! I'm about 3/4 of the way through and I'm thinking I'll have to re-read it immediately to get the full effect; there are so many mysteries.

Anyway, the vocabulary in HoL has been challenging me. Here's a few new words I've learned:
  • sabin
  • aphonia
  • scarification
  • tenebrific
  • tessellated
  • celerity
  • phillumenist
  • prolix
  • exegesis
Go loook them up if you don't already know their meanings.

Wednesday, January 04, 2006

Inter-Urban Industrial Update

The IUI has been downsized to something a little more manageable for my first foray into model railroading since I was a child. My little industrial empire now fits on a two foot by four foot table top. Here's the new plan:


I've left some expansion room to the right side, where the interchange track comes in. Where I intend to place the layout in my basement, I have another seven feet of shelf space about a foot wide. I've elevated the back side about 3/4" from the front to give a little interest to the terrain but the setting is essentially urban. The yard consists of 3 sorting tracks and a RIP track, with an engine terminal off the runaround. The right side of the loop also serves as the switching lead. The short siding crossing the yard lead serves a small freight station.

I've got the base built and a layer of foam on top of that. I've test fitted the track and will be ready to lay roadbed as soon as I purchase or manufacture the 3% grade inclines on get to the back industrial area.

Photos of progess to follow soon.

Sunday, December 04, 2005

The Whole-Tone Scale and Augmented Chords

In my study of jazz improvisation pedagogy, I've noticed a relative scarcity of instruction related to the whole-tone scale and the augmented chord that derives from it. There is quite a bit of information on the lydian-augmented scale, which is the 3rd mode of the ascending melodic minor scale, but even here there is a lack instruction on how to apply the scale in context. It seems to me that most of the literature focusing on scales does not go far enough in explaining the application of such scales in the context of the entire structure of real songs. In other words, it's easy enough to see that particular notes of a scale (i.e. the intervalic distances from the tonic) correspond with a particular chord (especially its altered extensions) but what are the possible functions of a scale or chord related to the surrounding changes in a song?

The augmented scale has intrigued me since I first learned about it in junior high school. I was taking saxophone lessons from a guy that got me interested in jazz improvisation. I had learned to write and play all of the major and minor scales (both melodic and harmonic) from memory and I wondered what other scales existed that I might have to memorize, hoping there were none. That's when my instructor embarked on several lessons in scale and chord construction and the limitless possibilities of sound using only the 12 tones of our Western chromatic scale. The first thing he showed me was that scales could have fewer or more tones than 7 (the number of tones in the majors and minors) and proceded to write out the formula for constructing a whole-tone scale : 1-1-1-1-1-1 (he always wrote scale formulas in terms of the intervals between successive notes, so a major scale would be written 1-1-1/2- 1-1-1-1/2). When he asked me to play a whole-tone scale starting on C, I was blown away by how accustomed I had become to diatonicity. My fingers had a hard time finding F# and G#. The B-flat (as I thought of it, instead of A#) was not as foriegn because I was used to playing the mixolydian modes, with their flatted sevenths. What really intrigued me about the whole-tone scale was that there are really only two of them (and only 4 augmented chords).

I've been trying to figure out how to use the whole-tone scale and the augmented chord in my improvisation ever since my first revelation. One of the first things I discovered is that the augmented 5th naturally resolves upward to become the major 3rd of the next chord. So a C+ chord naturally moves to F major. In other words, an augmented chord functions like V7 leanding to I. This is useful for the end of a song that ends on the V because V+ will naturally lead to Imaj, and this is can be heard almost as a signature in many older R&B and do-wap songs. It's fun to put a V+7 at the end of a blues progression. The disonance of the whole-tone scale can be suspended for a greater length of time in this situation because the tension is usually the greatest here and the listener expects a resolution on the downbeat of the next chorus. A III-VI-II-V-I turnaround offers an opportunity for whole-tone utilization because the III, VI, and II are really just substitutes for the V and the whole sequence functions as single dominant leading to the tonic. Playing a line on the whole-tone scale I+ just before the change to IV can add a sense of playing "outside" or ""sideslipping" but this opportunity comes and goes quickly as the tension and resolution of a I-IV near the beginning of the chorus does not have the urgency of a V-I progression. I've been trying to think of a way to keep the dissonant energy of a whole-tone line going from the final V of a blues chorus, through the I at the start of a new chorus, all the way to the IV in the 5th bar but I've not been successful in pulling this off (yet).

I've had quite a bit of success playing whole-tone patterns in modal playing, especially "one-chord" tunes where playing outside is almost a requirement to break the monotony. In a recent extended solo on Chain of Fools (known euphemistically by our band as Chain of Chord, or sometimes just Chord), which is in C minor, I managed to build the tension up through the use of chromaticism and a neopolitan minor scale to 8 bars of whole tone figures on E-flat. This had the effect of adding a flatted 9th to an ascending C melodic minor while omitting the root. A few obtuse counter-figures from the rhythm section really polished off the effect.