Hello all,
I'm trying to write code that groups together the members existing within a multi-dimensional array.
What I've written so far takes in a midi file and spits out the following list:
note: 41 velocity: 56 time: 0.00833333 duration: 3.98958 interval: 0
note: 53 velocity: 70 time: 0.00833333 duration: 3.98958 interval: 12
note: 60 velocity: 56 time: 0.00833333 duration: 3.98958 interval: 7
note: 63 velocity: 56 time: 0.00833333 duration: 3.98958 interval: 3
note: 65 velocity: 56 time: 0.00833333 duration: 3.98958 interval: 2
note: 69 velocity: 70 time: 0.00833333 duration: 3.98958 interval: 4
note: 34 velocity: 54 time: 4.00208 duration: 3.99583 interval: -35
note: 46 velocity: 56 time: 4.00208 duration: 3.99583 interval: 12
note: 53 velocity: 56 time: 4.00208 duration: 3.99583 interval: 7
note: 58 velocity: 56 time: 4.00208 duration: 3.99583 interval: 5
note: 58 velocity: 70 time: 4.00208 duration: 3.99583 interval: 0
note: 65 velocity: 56 time: 4.00208 duration: 3.99583 interval: 7
note: 70 velocity: 56 time: 4.00208 duration: 3.99583 interval: 5
note: 74 velocity: 56 time: 4.00208 duration: 3.99583 interval: 4
note: 77 velocity: 70 time: 4.00208 duration: 3.99583 interval: 3
note: 34 velocity: 54 time: 8.00208 duration: 3.99583 interval: -43
note: 46 velocity: 56 time: 8.00208 duration: 3.99583 interval: 12
note: 53 velocity: 56 time: 8.00208 duration: 3.99583 interval: 7
note: 58 velocity: 56 time: 8.00208 duration: 3.99583 interval: 5
note: 58 velocity: 70 time: 8.00208 duration: 3.99583 interval: 0
note: 65 velocity: 56 time: 8.00208 duration: 3.99583 interval: 7
note: 70 velocity: 56 time: 8.00208 duration: 3.99583 interval: 5
note: 74 velocity: 56 time: 8.00208 duration: 3.99583 interval: 4
note: 77 velocity: 70 time: 8.00208 duration: 3.99583 interval: 3
note: 41 velocity: 56 time: 12.0021 duration: 3.99583 interval: -36
note: 53 velocity: 56 time: 12.0021 duration: 3.99583 interval: 12
note: 57 velocity: 70 time: 12.0021 duration: 3.99583 interval: 4
note: 60 velocity: 56 time: 12.0021 duration: 3.99583 interval: 3
note: 65 velocity: 56 time: 12.0021 duration: 3.99583 interval: 5
note: 69 velocity: 56 time: 12.0021 duration: 3.99583 interval: 4
note: 72 velocity: 70 time: 12.0021 duration: 3.99583 interval: 3
NoteInfo[0Each parameter is stored in a multidimensional array as follows:
i = each event
NoteInfo[0][i] = note = midi pitch
NoteInfo[1][i] = velocity = how strong the note is played
NoteInfo[2][i] = time = when the note occurs
NoteInfo[3][i] = duration = how long the note lasts
(please ignore interval. It's not significant right now)
As you can see on the list, many of the notes occur at the same time, because these notes represent a sequence of chords. What I'm trying is to group together the notes that occur at the same time into another multidimensional array:
where "prog" represents current chord, or the number of groups of notes that occur at the same time:
Chords[prog][note]
i.e. all of the notes that occur at 0.00833.. will be in Chords[0][note], the ones at 4.00208 in Chords[1][note] and so forth.
I've tried using for loops and while loops but can't seem to get it to work. This may be a novice question but I had to learn C for a job very quickly and probably have skipped a lot of the basics.
Please give me some words of advice. Thanks.