Chords graph

maj min +1 maj +5 maj +7 maj Etc.. with all intervals and with minor chords also [....] [....] 0 5 6 6

model A with short memory (only last chord): only 1 transition

0

2

on arcs we put how many times this transition has been played by human

+x maj/min = interval (semitones) chord type

each time a new chord is asked the manager says 2 things:

current chord type

desired novelty

it will be coded with 2 tables:

nodes

arcs (from node, to node, weight)

for example in the above graph if the manager says (maj, 6) i respond +7 maj which mean go up a 5th, major chord. if the manager says (min, 1) i respond +1 maj which mean go up a minor 2nd , major chord.

Pros: easy to populate

Cons: i think tonality won't be reproducible, we need longer sequences

model B with longer memory

same as previous but with 2 or more transitions

we'll have many many nodes...

pros: tonality possible

cons: hard to populate

model C short memory but tonality aware

input chord is not maj or min but its role in the tonality

so possible nodes will be:

I II III IV V VI VII

but also alterated chords?

Solutions:

La Motte signs [TODO: write all possibile chords]

using all possibile chords: Imin Imaj Imin7min Imin7maj Imaj7min Imaj7maj Idim Idim7min Idim7dim IImin Iimaj etc... for a total of 9x7=63 chords

short memory should be enough, but:

How to manage chords like C#maj in Cmaj? We should then use 9x11nodes = 99 (wow!)

How to manage modulations?

For modulations we should add some new nodes:

new tonality: x semitones, maj/min

when training the graph we should in some way tell the graph that next chord will be in a new tonality, i mean: if we are in Cmaj, this transition: Bdim Ebmaj could be both a modulation or not, we must tell the graph if is a modulation somehow!

We'll have 2 tables with at least:

99 nodes for chords names

99x99 weightened arcs (9801 arcs)

pros:

tonality possible

good for temporarly modulations?

Good for modulations: if we train the graph with modulations we can ask the graph to build a sequence to modulate to a given new tonality: the graph will look in its modulation nodes and will build a walk backwards using the wanted “novelty” to get to the current chord...

we can ask the graphs walk for targets: something like “i want to get to this chord using this average novelty or this path lenght”

cons:

hard to setup?

how to manage modulation? How to teach realtime?

Links:

http://en.wikipedia.org/wiki/Graph_%28mathematics%29

(but with weights)

in SVN there is now implemented a first version that uses model C

now we want to write all the functions needed to do searches on this graph.

Search strategies: how to build walks to a target?

In our case the cost of an arc is not his weight but

abs(arc.weight - desired_weight)

Let's keep it in mind and have a look at the literature...

See: AIMA chapter 3 paragraph 5

our graph has a ramification factor of 10x12 (120)

i can't see a way to build an euristic, so we are doing non-informed search (we cannot use A*)

whide search:

this obviously puts wide search out: for a path 4 chord long we'd need to evaluate up to 120^4 nodes!

Uniform cost search:

we can use this search because we don't have negative weights.

Cons: much memory needed

if we specify a walk 4 steps long we need to evaulate 120^4 nodes....

not usable

Deep search:

better not to use because we have cycles

not usable

Limited deep search:

limitated memory usage.

Really fitting when we specify the walk length!

Not so when the length is not set...

Iterative limited deep search:

limitated memory usage.

I don't see problems using it even when specifying walk's lenght

bidirectional search:

we know our target, we could start searching both from start and from end, we have access at our predecessors, we have a single target.

Cons: much memory needed, not as much as with uniform or wide but

i think our best chance is using “iterative limited deep search” when we simply want to get to target in minimum steps possibile and “limited deep search” when we know how many steps we want.

Comments by vatic (from an email by vatic to dmorelli dated 10/10/05):

I'm assuming that the chord manager both "produces" chords in real time
and also "listens" to update the "history" of what has been played.
My first comment has to do with the major/minor distinction you made in
the notes; it seems like this would be one of the first things to "go"
as you move to modeling more chromatic music. The distinction of
major/minor seems clear for only a small portion of your subject matter.
So I would suggest a system that is based on the 12 semitones and is
neutral with respect to their function. Functionality would be contained
within the memory of the transition tables.
In representing chords, I would follow a reversible data reduction
technique that I would borrow from post-tonal theory, which would remove
(and save) octave equivalence and put the chord in "prime form." (A
simple reference to Lewin/Rahn post-tonal analysis would be Joseph N.
Straus, _Intro to Post Tonal Analysis_)
Prime form would arrange the chord into it's components starting from
semitone 1 and progressing up in pitch order.
I would then submit the notes of the chord each to their own transition
table. 12 semitones of transition would be 144 places total for each
note. You could have many transition tables keeping track of 1st note in
the chord, 2nd note in the chord... 7th note in the chord, etc.
Either update the transition value as listener or process the chord as
player.
Then reverse the chord into it's original "inverted state" (ie,
non-prime) and process the octave transpositions. These also could be
subject to their own tables so that they could be manipulated as well.
The above is for a 1 period memory, but given how small the note tables
are, generalizing it to a longer memory would be easy...

paste of the irc chat about this model:

[16:05] <dmorelli> i've put your comments at the end of chords_graph.doc

[16:06] <dmorelli> actually it can handle 10 different chord type:

[16:06] <dmorelli> maj, min, aug, dim, same with 7th maj and min

[16:07] <dmorelli> i am using maxlib's [chord] way of naming chords, so you can simply connect [chord] to [chords_graph]

[16:07] <dmorelli> i can use up to 70 chords types, but we are still in the tonal world

[16:08] <dmorelli> your idea is amazing, i think i will make another version of chords_graph for it

[16:09] <dmorelli> but i haven't fully understood how you would represent chords, i need to read your notes more

[16:09] <vatic> at just 144 bytes/ints per table, you could also maintain a distinction between chords or 3 or 4 or however many notes if you thought htat was important.

[16:10] <vatic> I don't know maxlib's [chord]. I'll have to look.

[16:12] <vatic> chord reprensentation:

[16:12] <vatic> remove and save ocatve equivalence.

[16:13] <vatic> reorder and preserve non-prime form.

[16:13] <dmorelli> what do you mean for non-prime form?

[16:14] <vatic> for example: 7, 3, 5, 8 (thinking of scale degree, not semitones) would becaome 1,3,5,7

[16:15] <dmorelli> ok, got it

[16:15] <dmorelli> are we talking of a diatonic or chromati world?

[16:15] <vatic> in a chromatic world:

[16:16] <vatic> hold on...

[16:16] <dmorelli> also, would your model handle only 3th based chords?

[16:17] <vatic> so, in semitones (same example): 10, 4, 7, 12 would become 1, 4, 7, 10

[16:18] <vatic> post-tonal theory has somme more detailed and rigorous ways of analysing tonal equivalence, but the above is the essence.

[16:18] <vatic> hold on...

[16:20] <vatic> then the separate notes just get fed into their individual transition table. the 1st prime has a table, second prime has a table, etc.

[16:20] <vatic> you could have quite a few tables at only 144 storage place per note in chord.

[16:21] <vatic> inversional equivalence might argue that you don't need to worry about the order or quantity of notes in a chord, butyou could also maintain separate sets of tables for 3 note chords, 4 note chords, etc.

[16:22] <vatic> once you have processed the note transitions, you just re-invert the notes based on the saved state and re-apply octave transpositions.

[16:23] <vatic> these could also be the subject of their own transition table as well, but again, it would be simple to add.

[16:24] <vatic> does that make sense?

[16:24] <dmorelli> trying to imagine that..

[16:28] <vatic> so, it could handle a chord of any number of notes.

[16:28] <dmorelli> vatic, but the information between primes would be lost.. and is important! i mean, look in Cmajor, after a Emin I may usually go to F, and after Emaj to Amin instead.. the table of the first prime should know somehow if E is min or maj, no?

[16:30] <vatic> the original proposal suggested that each voice of the chord is treated separately although the knowledge you speak of is maintained.

[16:31] <vatic> but you could track 3 note chords separate from 4 note chords and your concern would be answered, correct?

[16:32] <dmorelli> vatic, no, i mean if the transition table of each prime doesn't look for other primes then in my example which will be the first prime of the proposed chord after Emin? F or A?

[16:33] <vatic> hold on...

[16:33] <dmorelli> F is most used after Emin, Amin after Emaj..

[16:38] <dmorelli> mm.. can pland join this pm? are pm in 3 possibile?

[16:40] <vatic> we could move onto the main #dataflwo channel also...

[16:40] <vatic> I'm just really stupid doing chord conversions, sorry...

[16:42] <dmorelli> stupid in what? this model is super because it would handle well EACH kind of chord

[16:42] <dmorelli> the only problem is that there seem to be informations loss ("loss" is it correct?)

[16:42] <vatic> no, just converting E minor into semitones...

[16:42] <vatic> you could be right.

[16:43] <dmorelli> E minor= 4 7 11

[16:43] <vatic> It may also be, I don't have a reference handy, that post-tonal treatment (ie "prime-form") handles the situation.

[16:44] <vatic> do you want to move to #dataflow so pland can jump in?

[16:44] <vatic> I guess I'm logging this also...

[16:48] <dmorelli> yes, it is not ot at all!

[...]

[16:50] <vatic> dmorelli: so you're saying Emin -> F and Emaj -> Amin, right?

[16:50] <dmorelli> vatic, i've pasted our pm discussion in the chords_graph.doc

[16:51] <vatic> dmorelli: wow, fast!

[16:52] <dmorelli> vatic, yeah, if we have a transition table for each prime, how would the first prime know that it *should* go to F if Emin and A if Emaj?

[16:52] <dmorelli> vatic, i may need to read your papers.. i may be missing something obvious in post-tonal theory

[16:53] <vatic> dmorelli: don't be so sure. I can overlook big stuff!

[16:53] *** chikumo quit (Read error: 104 (Connection reset by peer))

[16:53] <vatic> dmorelli: so I have: 4 7 11 -> 5 9 12 and 4 8 11 -> 9 12 16, right?

[16:55] <dmorelli> vatic, yes, if the first table only knows 4, how can it know if say 5 vs 9 ?

[16:57] <vatic> dmorelli: just stating my thought as an example, simplifying: 4 7 11 becomes 0 3 7,

[16:57] <vatic> 5 9 12 becomes 0 4 7

[16:57] <vatic> 4 8 11 becomes 0 4 7

[16:58] <vatic> 9 12 16 becomes 0 3 7.

[16:58] <vatic> so 0 3 7 -> 0 4 7 and 0 4 7 -> 0 3 7.

[16:58] *** mamalala changed nick to mamalala_away

[16:58] <mamalala_away> back later .... shopping, housekeeping, etc ....

[16:59] <vatic> or 0 -> 0, 7 -> 7, 4 -> 3, and 3 -> 4.

[17:00] <dmorelli> vatic, so there is not the idea of "main tone", i mean fundamental of what once was tonality?

[17:02] <vatic> dmorelli: it seems. I'm not necessarily proposing it, however. I wonder if a sequential application of the transitions would be correct?

[17:03] <vatic> in other words, 1st 0->0, 2nd 4->3, 3rd 7->7

[17:06] <dmorelli> vatic, but in this case every minor chord would go to a major chord a 2nd up, and evey major to a minor 1 4th up..

[17:06] <dmorelli> vatic, what if i want Cmaj to go to Gmaj?

[17:07] <dmorelli> vatic, it can't be done without the notion of fundamental

[17:07] <vatic> dmorelli: of course you could also look at the intervals together, in this case two.

[17:07] <dmorelli> pland, as you may have notices we are talking of [chords_graph]..

[17:08] <dmorelli> pland, a post-tonal model

[17:08] <vatic> so 3-4 -> 4-3 and 4-3 -> 3-4.

[17:09] <vatic> dmorelli: well, just using post-tonal ideas about transformational equivalence to attempt a reduction of the problem space.

[17:09] <pland> sorry totally overwhelmed by work here... :-(

[17:09] <vatic> pland: ;(

[17:11] <pland> dmorelli: and vatic oh MY...a post-tonal model for [chords_graph] is a grand idea

[17:12] <vatic> dmorelli: I've forgotten what has been done about the reduction of interval space.

[17:13] <vatic> pland: do you have access to Joseph Strauss _Intro to Post Tonal Theory_?

[17:13] <vatic> dmorelli: you see where I'm going?

[17:13] <pland> vatic: not sure, will look in library

[17:13] <pland> /me must admit he couldn't really follow the above dialog, but then just skimming, kinda snowed under here

[17:14] <vatic> pland: if not, I'll xerox and mail to you and dmorelli...

[17:15] <pland> vatic: I'll try my best to find it

[17:15] <vatic> pland: don't rrouble too much. I can find somethng we can consult.

[17:15] <pland> vatic: ok

[17:16] *** chikumo (n=asds@224.Red-81-38-189.dynamicIP.rima-tde.net) joined

[17:16] <matju> dmorelli: find / -iname .pdrc

[17:17] *** p8r quit ("BitchX-1.1-final © 1996-2000 Colten Edwards")

[17:17] *** aspect (i=foobar@61.68.135.200) joined

[17:18] <dmorelli> vatic, yes, i see, i am trying to figure out how to preserve important informations..

[17:19] <dmorelli> vatic, another issue is the chord reduction: no great problem if we assume that we only have 3th based chords... but if not?

[17:20] <vatic> dmorelli: I don't have enough info here to be correct or very persuasive, but the list of unique pitch classes are...

[17:20] <vatic> dmorelli: (let me count)

[17:22] <vatic> dmorelli: there are ~114 prime classes that account for CHORDS up to nonachords.

[17:23] <dmorelli> vatic, where does this number (114) come from?

[17:23] <vatic> dmorelli: that is, a novachord can be transformationally derived from it's trichord complement. (eg 12-9=3)

[17:23] <vatic> dmorelli: fairly complicated to explain, but reduction based on transformational equivalence.

[17:24] <vatic> dmorelli: which in most cases is reversible, so you can reapply after your transition to get your non-prime expression back.

[17:24] <pland> wow I almost have no idea what you guys are talking about

[17:26] <vatic> dmorelli: I think about 29 prime set are "Z-related" which means you can't get back to the non-prime form from the prime expression.

[17:26] <vatic> dmorelli: there are multiple expressions.

[17:26] <dmorelli> vatic, well, now i'm really curious to read about averithing this.. should i look for J. Strauss "intro to posto tonal theory"?

[17:26] *** andree (n=andree@modemcable031.253-81-70.mc.videotron.ca) joined

[17:27] *** andree quit (Client Quit)

[17:27] <vatic> dmorelli: so a transtion table of 114 x 114 would handle CHORDAL transitions for all chords of 3 to 9 notes!

[17:28] <vatic> dmorelli, pland: there is quite a lot of info about this stuff. Straus' book is short and to the point.

[17:29] <vatic> dmoreli, pland: I'll cast around and find some information, but if it's easy to get Straus, good!

[17:31] <vatic> dmorelli, pland: here: http://www.amazon.com/exec/obidos/tg/detail/-/0131898906/qid=1128958154/sr=1-1/ref=sr_1_1/103-4538903-7463833?v=glance&s=books

[17:32] <vatic> I think the earlier editions, which would be fine are much fewer pages, maybe 150-200, so xeroxing could be a solution.

[17:34] <dmorelli> wow! 0.5 € each page!

[17:38] <vatic> dmorelli: 2 pages each side = 4 pages a xerox. with a $68 dollar book, it's cheap by commparison.

[17:39] <vatic> dmorelli: I'm gonna tunnel a bit to see if I can find something I can email. biab...

[17:39] *** vatic (n=charlest@pool-162-83-246-117.ny5030.east.verizon.net) left ()

[17:45] <matju> moin moin

[17:46] <matju> dmorelli: did you find the .pdrc using the "find" command ?

[17:47] <matju> dmorelli: should chord reversals count as a same chord? C,E,G vs E,G,C vs G,C,E ...

[17:48] <matju> dmorelli: i dunno what vatic means by Z-related tho

[17:50] <dmorelli> matju, didn't find, now trying as root (sudo)

[17:50] <dmorelli> matju, actually i don't mind inversions.. in the real world they are important though..

[17:51] <dmorelli> how do i tell svn not to commit a specific file in a folder where are other files (that i want committed)

[17:52] <matju> dmorelli: if you want to merge inversions then it's more work. Before merging there are 11 2-chords (the fundamental is fixed; just pick one interval). After merging there are 6 2-chords because the rest are just inversions of 5 of them.

[17:54] <matju> dmorelli: i mean:

[17:54] <matju> dmorelli: modes and not actual chords.

[17:54] <matju> dmorelli: for 3-chord modes the situation is more complex

[17:55] <dmorelli> matju, i am a bit dumb in this moment (tired..)

[17:57] *** gisle quit (Remote closed the connection)

[17:59] <matju> a chord mode like C C# is an inversion of C B because B C can be transposed so that it becomes C C#

[17:59] <matju> C F# is its own inversion so there's no duplicate

[17:59] <matju> aug chords are also symmetric: each chord is also its two other inversions

[17:59] <matju> dim7 chords too: each chord is also its three other inversions

[18:00] *** chikumo quit (clarke.freenode.net irc.freenode.net)

[18:00] *** drobilla quit (clarke.freenode.net irc.freenode.net)

[18:00] <dmorelli> matju, yes, i'd save memory and cpu

Davide Morelli

2005-10-07T12:10:47