Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Re: Chord root

by benn (Vicar)
on Aug 09, 2003 at 16:58 UTC ( #282447=note: print w/replies, xml ) Need Help??

in reply to Re: Chord root
in thread Chord root

Hi Gene.

Indeed - when I stick this in Music::Chord, it'll have strict and warnings plastered all over it...but I was playing golf :)

I too am a fan of Sean's MIDI Modules, but not of 'As' and 'Af' - I've been reading / writing real music for too long now. Again, if/when I 'modulise' this, and once we've sorted out a common standard for note interchange, this will probably sort itself out. The 'parsing gymnastics' though would seems to consist of s/s$/#/ and s/f$/b/ :)

Anyway, here are some answers.

1. 'f' stands (in my head) for 'final values'. It's just an array that stores the note counts. Yes, I could have called it '@final_values'.

2. ($n + $_) %12 represents adding a numerical note value ($n) to an interval ($_) and doing a modulus 12 on the result, to remain within the 0-11 note range.

3. These are harmonics. Indeed, the link describes the algorithm, and explains what the values meant, but briefly, the idea is to take the 1st 8 *sub*-harmonics (8va,5th,8va,3rd,5th,7th etc., but *downwards*) of each note in the chord, then do a popularity count on each note - the most popular is/are the root. The original algorithm misses out all octave equivalents, (doubled root + 5th), but I found that this gives wrong results for minor chords, so added them back in. This gives us a semitone-interval list of (0, -12, -19,-24...), but I didn't bother with working out all the big negative numbers, as this is just functionally equivalent to (0,0,5,0,8,5,10,0,2), ordered how you like - in my case, sorted numerically cos it looked nicer :)

Hope this answers the questions.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://282447]
[Discipulus]: good morning nuns and monks, even if rainy

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2018-03-19 07:54 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (236 votes). Check out past polls.