[CM] RE: [keykit] Synthesizing Midi
Tim Thompson
tjt@nosuch.com
Sun, 8 Aug 2004 16:59:08 -0700
> I have two midi files. (e.g. both just one bar long, in 4/4 measure).
>
> 1: rhythm.mid ( with the following note lengths)
> 1/4 1/4 1/4 1/8 1/8. (all C notes)
>
> 2: melody.mid (with the following notes)
> 1/4(Note C) 3/4(Note D)
>
> From these midi files I should get with Pd or Common Music or Key Kit a
> combination:
>
> 3: combi.mid
> 1/4(C) 1/4(D) 1/4(D) 1/8(D) 1/8(D)
In keykit, this would be:
p1 = readmf("rhythm.mid")
p2 = readmf("melody.mid")
p3 = applynear(p1,p2,PITCH)
writemf(p3,"combi.mid")
The source for the applynear function is in lib/basic1.k,
if you want to see how it works. It takes each note in p1,
and applies the pitch of the nearest (in terms of time)
note from p2.
...Tim...