in reply to Music: Calculate Chord Progression Triads
Sadly, I never took up a musical instrument, something I now regret very much. I wonder if it is too late to do so now that I am in my fifties.
Moving back to Perl, I would just like to bring the qw{ ... } construct to your attention, which could save you some typing when setting up your arrays. Instead of
my @notes = ('C', 'C#/Db', 'D', 'D#/Eb', 'E', 'F', 'F#/Gb', 'G', 'G#/Ab', 'A', 'A#/Bb', 'B');
you could do
my @notes = qw{C C#/Db D D#/Eb E F F#/Gb G G#/Ab A A#/Bb B};
And one slight niggle. You use meaningful variable names throughout your script except for the my $i = shift;. It seems a shame to make this omission when the rest of the script is so very clear.
I hope this is of interest.
Cheers,
JohnGG
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: [OT] Music: Calculate Chord Progression Triads
by wazoox (Prior) on Jan 27, 2007 at 12:43 UTC | |
by johngg (Canon) on Jan 27, 2007 at 13:03 UTC | |
Re: Music: Calculate Chord Progression Triads
by jonadab (Parson) on Jan 27, 2007 at 19:18 UTC | |
by johngg (Canon) on Jan 28, 2007 at 00:05 UTC | |
Re^2: Music: Calculate Chord Progression Triads
by zeno (Friar) on Jan 30, 2007 at 14:23 UTC |
In Section
Cool Uses for Perl