Jump to content

coatsie

Member
  • Posts

    8
  • Joined

  • Last visited

coatsie's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. First of all, the cleanup with the all_chords array was astonishing. It cut the size of the script in half. That's a trick I'll never forget. My only remaining issue, outside of creating graphics for all the chord types, is that it seems note ons are read from bottom to top as the piano roll is viewed. So I have to put the 7 on the bottom of the chord in the piano roll. If it's not, as it iterates through the possible patterns, as soon as it hits a triad, it assumes it found the chord without further comparisons. Would I be incorrect thinking the pattern could be called through a function so all 3 intervals are present for comparison rather than the 2 in a triad? My only issue with that is having the HandleMIDI() called from within another function. Oh yeah, and I had to fix the Major7s in the array, as they're actually Dominant7s... oops.
  2. You are an inspiration! I can’t wait to get home and apply all this knowledge.
  3. It's a for loop inside a for loop. So far, the array only has the figures for Major, minor, M7 and m7 chords for all 12 notes. Still need to add to the array for the aug and dim etc chords. It's a LOT of work hahaha.
  4. Here's the entire script. Beware, the array is huge! var all_chords = [[[64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [72, 79], [72, 79], [64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78]] , [[45, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [45, 72, 79], [37, 38, 39, 45, 72, 79], [40, 41, 42, 45, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [43, 44, 45]] , [[48, 49, 50, 51, 52, 53, 54, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [54, 55, 72, 79], [48, 49, 50, 51, 52, 53, 54, 55, 72, 79], [54, 55, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [48, 49, 50, 51, 52, 53, 54]] , [[45, 48, 49, 50, 51, 52, 53, 54, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [45, 54, 55, 72, 79], [37, 38, 39, 45, 48, 49, 50, 51, 52, 53, 54, 55, 72, 79], [40, 41, 42, 45, 54, 55, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [43, 44, 45, 48, 49, 50, 51, 52, 53, 54]] , [[53, 54, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [54, 55, 72, 79], [40, 41, 44, 45, 46, 47, 54, 55, 72, 79], [47, 48, 54, 55, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [49, 50, 51, 52, 53, 54]] , [[59, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [58, 59, 60, 61, 62, 72, 79], [59, 61, 72, 79], [58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [59, 61]] , [[45, 59, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [45, 58, 59, 60, 61, 62, 72, 79], [37, 38, 39, 45, 59, 61, 72, 79], [40, 41, 42, 45, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [43, 44, 45, 59, 61]] , [[48, 49, 50, 51, 52, 53, 54, 59, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [54, 55, 58, 59, 60, 61, 62, 72, 79], [48, 49, 50, 51, 52, 53, 54, 55, 59, 61, 72, 79], [54, 55, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [48, 49, 50, 51, 52, 53, 54, 59, 61]] , [[45, 48, 49, 50, 51, 52, 53, 54, 59, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [45, 54, 55, 58, 59, 60, 61, 62, 72, 79], [37, 38, 39, 45, 48, 49, 50, 51, 52, 53, 54, 55, 59, 61, 72, 79], [40, 41, 42, 45, 54, 55, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [43, 44, 45, 48, 49, 50, 51, 52, 53, 54, 59, 61]] , [[53, 54, 59, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [54, 55, 58, 59, 60, 61, 62, 72, 79], [40, 41, 44, 45, 46, 47, 54, 55, 59, 61, 72, 79], [47, 48, 54, 55, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [49, 50, 51, 52, 53, 54, 59, 61]] , [[64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [64, 72, 79], [64, 72, 79], [65, 66, 67, 68, 69, 70, 71, 73, 74, 75, 76, 77, 78]] , [[45, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [45, 64, 72, 79], [37, 38, 39, 45, 64, 72, 79], [40, 41, 42, 45, 65, 66, 67, 68, 69, 70, 71, 73, 74, 75, 76, 77, 78], [43, 44, 45]] , [[48, 49, 50, 51, 52, 53, 54, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [54, 55, 64, 72, 79], [48, 49, 50, 51, 52, 53, 54, 55, 64, 72, 79], [54, 55, 65, 66, 67, 68, 69, 70, 71, 73, 74, 75, 76, 77, 78], [48, 49, 50, 51, 52, 53, 54]] , [[45, 48, 49, 50, 51, 52, 53, 54, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [45, 54, 55, 64, 72, 79], [37, 38, 39, 45, 48, 49, 50, 51, 52, 53, 54, 55, 64, 72, 79], [40, 41, 42, 45, 54, 55, 65, 66, 67, 68, 69, 70, 71, 73, 74, 75, 76, 77, 78], [43, 44, 45, 48, 49, 50, 51, 52, 53, 54]] , [[53, 54, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [54, 55, 64, 72, 79], [40, 41, 44, 45, 46, 47, 54, 55, 64, 72, 79], [47, 48, 54, 55, 65, 66, 67, 68, 69, 70, 71, 73, 74, 75, 76, 77, 78], [49, 50, 51, 52, 53, 54]] , [[65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [64, 79], [64, 79], [65, 78]] , [[45, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [45, 64, 79], [37, 38, 39, 45, 64, 79], [40, 41, 42, 45, 65, 78], [43, 44, 45]] , [[48, 49, 50, 51, 52, 53, 54, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [54, 55, 64, 79], [48, 49, 50, 51, 52, 53, 54, 55, 64, 79], [54, 55, 65, 78], [48, 49, 50, 51, 52, 53, 54]] , [[45, 48, 49, 50, 51, 52, 53, 54, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [45, 54, 55, 64, 79], [37, 38, 39, 45, 48, 49, 50, 51, 52, 53, 54, 55, 64, 79], [40, 41, 42, 45, 54, 55, 65, 78], [43, 44, 45, 48, 49, 50, 51, 52, 53, 54]] , [[53, 54, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [54, 55, 64, 79], [40, 41, 44, 45, 46, 47, 54, 55, 64, 79], [47, 48, 54, 55, 65, 78], [49, 50, 51, 52, 53, 54]] , [[59, 61, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [58, 59, 60, 61, 62, 64, 79], [59, 61, 64, 79], [58, 59, 60, 61, 62, 65, 78], [59, 61]] , [[45, 59, 61, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [45, 58, 59, 60, 61, 62, 64, 79], [37, 38, 39, 45, 59, 61, 64, 79], [40, 41, 42, 45, 58, 59, 60, 61, 62, 65, 78], [43, 44, 45, 59, 61]] , [[48, 49, 50, 51, 52, 53, 54, 59, 61, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [54, 55, 58, 59, 60, 61, 62, 64, 79], [48, 49, 50, 51, 52, 53, 54, 55, 59, 61, 64, 79], [54, 55, 58, 59, 60, 61, 62, 65, 78], [48, 49, 50, 51, 52, 53, 54, 59, 61]] , [[45, 48, 49, 50, 51, 52, 53, 54, 59, 61, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [45, 54, 55, 58, 59, 60, 61, 62, 64, 79], [37, 38, 39, 45, 48, 49, 50, 51, 52, 53, 54, 55, 59, 61, 64, 79], [40, 41, 42, 45, 54, 55, 58, 59, 60, 61, 62, 65, 78], [43, 44, 45, 48, 49, 50, 51, 52, 53, 54, 59, 61]] , [[53, 54, 59, 61, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [54, 55, 58, 59, 60, 61, 62, 64, 79], [40, 41, 44, 45, 46, 47, 54, 55, 59, 61, 64, 79], [47, 48, 54, 55, 58, 59, 60, 61, 62, 65, 78], [49, 50, 51, 52, 53, 54, 59, 61]] , [[64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [64, 79], [64, 79], [65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78]] , [[45, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [45, 64, 79], [37, 38, 39, 45, 64, 79], [40, 41, 42, 45, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [43, 44, 45]] , [[48, 49, 50, 51, 52, 53, 54, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [54, 55, 64, 79], [48, 49, 50, 51, 52, 53, 54, 55, 64, 79], [54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [48, 49, 50, 51, 52, 53, 54]] , [[45, 48, 49, 50, 51, 52, 53, 54, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [45, 54, 55, 64, 79], [37, 38, 39, 45, 48, 49, 50, 51, 52, 53, 54, 55, 64, 79], [40, 41, 42, 45, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [43, 44, 45, 48, 49, 50, 51, 52, 53, 54]] , [[53, 54, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [54, 55, 64, 79], [40, 41, 44, 45, 46, 47, 54, 55, 64, 79], [47, 48, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [49, 50, 51, 52, 53, 54]] , [[59, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [58, 59, 60, 61, 62, 64, 79], [59, 61, 64, 79], [58, 59, 60, 61, 62, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [59, 61]] , [[45, 59, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [45, 58, 59, 60, 61, 62, 64, 79], [37, 38, 39, 45, 59, 61, 64, 79], [40, 41, 42, 45, 58, 59, 60, 61, 62, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [43, 44, 45, 59, 61]] , [[48, 49, 50, 51, 52, 53, 54, 59, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [54, 55, 58, 59, 60, 61, 62, 64, 79], [48, 49, 50, 51, 52, 53, 54, 55, 59, 61, 64, 79], [54, 55, 58, 59, 60, 61, 62, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [48, 49, 50, 51, 52, 53, 54, 59, 61]] , [[45, 48, 49, 50, 51, 52, 53, 54, 59, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [45, 54, 55, 58, 59, 60, 61, 62, 64, 79], [37, 38, 39, 45, 48, 49, 50, 51, 52, 53, 54, 55, 59, 61, 64, 79], [40, 41, 42, 45, 54, 55, 58, 59, 60, 61, 62, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [43, 44, 45, 48, 49, 50, 51, 52, 53, 54, 59, 61]] , [[53, 54, 59, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [54, 55, 58, 59, 60, 61, 62, 64, 79], [40, 41, 44, 45, 46, 47, 54, 55, 59, 61, 64, 79], [47, 48, 54, 55, 58, 59, 60, 61, 62, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [49, 50, 51, 52, 53, 54, 59, 61]] , [[64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [64, 72, 79], [64, 72, 79], [64, 72, 79]] , [[45, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [45, 64, 72, 79], [37, 38, 39, 45, 64, 72, 79], [40, 41, 42, 45, 64, 72, 79], [43, 44, 45]] , [[48, 49, 50, 51, 52, 53, 54, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [54, 55, 64, 72, 79], [48, 49, 50, 51, 52, 53, 54, 55, 64, 72, 79], [54, 55, 64, 72, 79], [48, 49, 50, 51, 52, 53, 54]] , [[45, 48, 49, 50, 51, 52, 53, 54, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [45, 54, 55, 64, 72, 79], [37, 38, 39, 45, 48, 49, 50, 51, 52, 53, 54, 55, 64, 72, 79], [40, 41, 42, 45, 54, 55, 64, 72, 79], [43, 44, 45, 48, 49, 50, 51, 52, 53, 54]] , [[53, 54, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [54, 55, 64, 72, 79], [40, 41, 44, 45, 46, 47, 54, 55, 64, 72, 79], [47, 48, 54, 55, 64, 72, 79], [49, 50, 51, 52, 53, 54]] , [[64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [72, 79], [72, 79], [72, 79]] , [[45, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [45, 72, 79], [37, 38, 39, 45, 72, 79], [40, 41, 42, 45, 72, 79], [43, 44, 45]] , [[48, 49, 50, 51, 52, 53, 54, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [54, 55, 72, 79], [48, 49, 50, 51, 52, 53, 54, 55, 72, 79], [54, 55, 72, 79], [48, 49, 50, 51, 52, 53, 54]] , [[45, 48, 49, 50, 51, 52, 53, 54, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [45, 54, 55, 72, 79], [37, 38, 39, 45, 48, 49, 50, 51, 52, 53, 54, 55, 72, 79], [40, 41, 42, 45, 54, 55, 72, 79], [43, 44, 45, 48, 49, 50, 51, 52, 53, 54]] , [[53, 54, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [54, 55, 72, 79], [40, 41, 44, 45, 46, 47, 54, 55, 72, 79], [47, 48, 54, 55, 72, 79], [49, 50, 51, 52, 53, 54]] , [[59, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [58, 59, 60, 61, 62, 72, 79], [59, 61, 72, 79], [58, 59, 60, 61, 62, 72, 79], [59, 61]] , [[45, 59, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [45, 58, 59, 60, 61, 62, 72, 79], [37, 38, 39, 45, 59, 61, 72, 79], [40, 41, 42, 45, 58, 59, 60, 61, 62, 72, 79], [43, 44, 45, 59, 61]] , [[48, 49, 50, 51, 52, 53, 54, 59, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [54, 55, 58, 59, 60, 61, 62, 72, 79], [48, 49, 50, 51, 52, 53, 54, 55, 59, 61, 72, 79], [54, 55, 58, 59, 60, 61, 62, 72, 79], [48, 49, 50, 51, 52, 53, 54, 59, 61]] , [[45, 48, 49, 50, 51, 52, 53, 54, 59, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [45, 54, 55, 58, 59, 60, 61, 62, 72, 79], [37, 38, 39, 45, 48, 49, 50, 51, 52, 53, 54, 55, 59, 61, 72, 79], [40, 41, 42, 45, 54, 55, 58, 59, 60, 61, 62, 72, 79], [43, 44, 45, 48, 49, 50, 51, 52, 53, 54, 59, 61]] , [[53, 54, 59, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [54, 55, 58, 59, 60, 61, 62, 72, 79], [40, 41, 44, 45, 46, 47, 54, 55, 59, 61, 72, 79], [47, 48, 54, 55, 58, 59, 60, 61, 62, 72, 79], [49, 50, 51, 52, 53, 54, 59, 61]] , [[65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [64, 79], [64, 79], [64, 72, 79], [65, 66, 67, 68, 69, 70, 71, 72]] , [[45, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [45, 64, 79], [37, 38, 39, 45, 64, 79], [40, 41, 42, 45, 64, 72, 79], [43, 44, 45, 65, 66, 67, 68, 69, 70, 71, 72]] , [[65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [48, 49, 50, 51, 52, 53, 54, 64, 79], [54, 55, 64, 79], [48, 49, 50, 51, 52, 53, 54, 55, 64, 72, 79], [54, 55, 65, 66, 67, 68, 69, 70, 71, 72] , [48, 49, 50, 51, 52, 53, 54]], [[45, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [45, 48, 49, 50, 51, 52, 53, 54, 64, 79], [37, 38, 39, 45, 54, 55, 64, 79], [40, 41, 42, 45, 48, 49, 50, 51, 52, 53, 54, 55, 64, 72, 79] , [43, 44, 45, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72], [48, 49, 50, 51, 52, 53, 54]], [[53, 54, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [54, 55, 64, 79], [40, 41, 44, 45, 46, 47, 54, 55, 64, 79] , [47, 48, 54, 55, 64, 72, 79], [49, 50, 51, 52, 53, 54, 65, 66, 67, 68, 69, 70, 71, 72]], [[65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [59, 61, 64, 79], [58, 59, 60, 61, 62, 64, 79] , [59, 61, 64, 72, 79], [58, 59, 60, 61, 62, 65, 66, 67, 68, 69, 70, 71, 72], [59, 61]], [[45, 59, 61, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [45, 58, 59, 60, 61, 62, 64, 79] , [37, 38, 39, 45, 59, 61, 64, 79], [40, 41, 42, 45, 58, 59, 60, 61, 62, 64, 72, 79], [43, 44, 45, 59, 61, 65, 66, 67, 68, 69, 70, 71, 72]], [[65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [48, 49, 50, 51, 52, 53, 54, 59, 61, 64, 79] , [54, 55, 58, 59, 60, 61, 62, 64, 79], [48, 49, 50, 51, 52, 53, 54, 55, 59, 61, 64, 72, 79], [54, 55, 58, 59, 60, 61, 62, 65, 66, 67, 68, 69, 70, 71, 72], [48, 49, 50, 51, 52, 53, 54, 59, 61]], [[45, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78] , [45, 48, 49, 50, 51, 52, 53, 54, 59, 61, 64, 79], [37, 38, 39, 45, 54, 55, 58, 59, 60, 61, 62, 64, 79], [40, 41, 42, 45, 48, 49, 50, 51, 52, 53, 54, 55, 59, 61, 64, 72, 79], [43, 44, 45, 54, 55, 58, 59, 60, 61, 62, 65, 66, 67, 68, 69, 70, 71, 72], [48, 49, 50, 51, 52, 53, 54, 59, 61]], [[65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78], [53, 54, 59, 61, 64, 79], [54, 55, 58, 59, 60, 61, 62, 64, 79], [40, 41, 44, 45, 46, 47, 54, 55, 59, 61, 64, 72, 79], [47, 48, 54, 55, 58, 59, 60, 61, 62, 65, 66, 67, 68, 69, 70, 71, 72], [49, 50, 51, 52, 53, 54, 59, 61]], [[58, 59, 60, 61, 62, 74, 75, 76, 77, 78, 79], [58, 60, 62, 78], [65], [58, 59, 60, 61, 62, 76], [60, 62, 64, 65, 66, 67, 68, 69, 70, 75], [58, 59, 61, 66, 70, 73, 74, 75, 76, 77, 78, 79], [66, 70], [58, 59, 60, 61, 62, 66, 70, 73, 74, 75, 76, 77, 78, 79]]] var tonky = ""; var chr_scale = ['A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#'] const chord_names = {"Major": [0,4,7], "Minor": [0,3,7], "Major7": [0,4,7,11], "Augmented": [0, 4, 8], "Diminished": [0,3,6], "Diminished7": [0,3,6,9], "Half-diminished7": [0,3,6,10], "Minor-major7": [0, 3, 7, 11], "Augmented7": [0, 4, 8, 10], "Augmented major7": [0, 4, 8, 11], "Minor7": [0,3,7,10], "Major6": [0,4,7,9], "Minor6": [0,3,7,9], "Dominant7": [0,4,7,10], "Sus2": [0,2,7], "Sus4": [0,5,7], "Add9": [0,2,4,7]} //var chord = 1; var ffffff = "hoo"; var basic_notes = []; var raw_list = []; var NeedsTimingInfo = true; var noteIn = ""; var basic_notes = []; var raw_list = []; function HandleMIDI(e) { if (e instanceof NoteOn) { init = e.toString().indexOf('pitch'); //parses out just the note fin = e.toString().indexOf('vel'); //still parsing noteIn = (e.toString().substr(init+10,fin-init-13)); //still parsing basic_notes.push(noteIn); Trace(basic_notes); } else if (e instanceof NoteOff) { for (i = 0; i < basic_notes.length; i++) { init2 = e.toString().indexOf('pitch'); //parses out just the note fin2 = e.toString().indexOf('vel'); //still parsing if (basic_notes[i] == (e.toString().substr(init2+10,fin2-init2-13))) { basic_notes.splice(i, 1); Trace(basic_notes); break; } } } for (tonic in basic_notes){ var tonic_note = basic_notes[tonic]; var pattern = []; for (note in basic_notes){ var actual_note = basic_notes[note]; interval = ((chr_scale.indexOf(actual_note) - chr_scale.indexOf(tonic_note)) + 12 ) % 12; pattern.push(interval); } pattern.sort(); for (const [key, value] of Object.entries(chord_names)) { if (JSON.stringify(value) === JSON.stringify(pattern)) { basic_notes.length = 0; raw_list.length = 0; //Trace(tonic_note); //Trace(key); var ffffff = (tonic_note + key); Trace(ffffff); if ((ffffff) == "AMajor") { chord = 0; } else if((ffffff) == "AMajor7"){ chord = 1; } else if((ffffff) == "AMinor"){ chord = 2; } else if((ffffff) == "AMinor7"){ chord = 3; } else if((ffffff) == "A?"){ chord = 4; } else if((ffffff) == "A#Major"){ chord = 5; } else if((ffffff) == "A#Major7"){ chord = 6; } else if((ffffff) == "A#Minor"){ chord = 7; } else if((ffffff) == "A#Minor7"){ chord = 8; } else if((ffffff) == "A#?"){ chord = 9; } else if((ffffff) == "BMajor"){ chord = 10; } else if((ffffff) == "BMajor7"){ chord = 11; } else if((ffffff) == "BMinor"){ chord = 12; } else if((ffffff) == "BMinor7"){ chord = 13; } else if((ffffff) == "B?"){ chord = 14; } else if((ffffff) == "CMajor") { chord = 15; } else if((ffffff) == "CMajor7"){ chord = 16; } else if((ffffff) == "CMinor"){ chord = 17; } else if((ffffff) == "CMinor7"){ chord = 18; } else if((ffffff) == "C?"){ chord = 19; } else if((ffffff) == "C#Major"){ chord = 20; } else if((ffffff) == "C#Major7"){ chord = 21; } else if((ffffff) == "C#Minor"){ chord = 22; } else if((ffffff) == "C#Minor7"){ chord = 23; } else if((ffffff) == "C#?"){ chord = 24; } else if((ffffff) == "DMajor"){ chord = 25; } else if((ffffff) == "DMajor7"){ chord = 26; } else if((ffffff) == "DMinor"){ chord = 27; } else if((ffffff) == "DMinor7"){ chord = 28; } else if((ffffff) == "D?"){ chord = 29; } else if((ffffff) == "D#Major"){ chord = 30; } else if((ffffff) == "D#Major7"){ chord = 31; } else if((ffffff) == "D#Minor"){ chord = 32; } else if((ffffff) == "D#Minor7"){ chord = 33; } else if((ffffff) == "D#?"){ chord = 34; } else if((ffffff) == "EMajor"){ chord = 35; } else if((ffffff) == "EMajor7"){ chord = 36; } else if((ffffff) == "EMinor"){ chord = 37; } else if((ffffff) == "EMinor7"){ chord = 38; } else if((ffffff) == "E?"){ chord = 39; } else if((ffffff) == "FMajor"){ chord = 40; } else if((ffffff) == "FMajor7"){ chord = 41; } else if((ffffff) == "FMinor"){ chord = 42; } else if((ffffff) == "FMinor7"){ chord = 43; } else if((ffffff) == "F?"){ chord = 44; } else if((ffffff) == "F#Major"){ chord = 45; } else if((ffffff) == "F#Major7"){ chord = 46; } else if((ffffff) == "F#Minor"){ chord = 47; } else if((ffffff) == "F#Minor7"){ chord = 48; } else if((ffffff) == "F#?"){ chord = 49; } else if((ffffff) == "GMajor"){ chord = 50; } else if((ffffff) == "GMajor7"){ chord = 51; } else if((ffffff) == "GMinor"){ chord = 52; } else if((ffffff) == "GMinor7"){ chord = 53; } else if((ffffff) == "G?"){ chord = 54; } else if((ffffff) == "G#Major"){ chord = 55; } else if((ffffff) == "G#Major7"){ chord = 56; } else if((ffffff) == "G#Minor"){ chord = 57; } else if((ffffff) == "G#Minor7"){ chord = 58; } else if((ffffff) == "G#?"){ chord = 59; } else if((ffffff) == "Nerd"){ chord = 60; } else { Trace(ffffff); basic_notes = []; break;} var info = GetTimingInfo(); var chunkstart = (Math.ceil(info.blockStartBeat)); var column = 0; //loop for as many times as there are columns in the chord for (diagramColumn = 0; diagramColumn < (all_chords[chord].length); diagramColumn++) { var column = column + 0.125; for (diagramNote = 0; diagramNote < all_chords[chord][diagramColumn].length; diagramNote++) { var noteOn = new NoteOn(); noteOn.pitch = all_chords[chord][diagramColumn][diagramNote]; noteOn.velocity = 127; noteOn.sendAtBeat((chunkstart) + column); var noteOff = new NoteOff(); noteOff.pitch = all_chords[chord][diagramColumn][diagramNote]; noteOff.velocity = 127; noteOff.sendAtBeat((chunkstart) + column + 0.12); } } } } } }
  5. This is being made for people that miss the chord track from Logic 9. I didn't include the rest of the script because the array that holds the notes to draw the chords is enormous, but the code itself is just a for loop inside a for loop that spits out columns on 32nd notes.
  6. hahahaha no. It does actually work, except, I wanna get the 7 chords. It's my first time using javascript so I'm just scouring stack exchange to find equivalent code from my native Python knowledge. I'll figure it out. It's part of a larger script I'm working on that prints the chords to a track. If I could just get it to recognize more than just triads, it'll be complete. See? No 7 chords display properly.
  7. I have an array of notes that's being compared to a list of chords. I adapted this from some python I found. Issue #1: I know there's got to be a better way of parsing the note from the event. This is just embarrassing. Issue #2: It's not seeing a lot of the chords. As soon as I hit 3 notes in a triad, it won't see the 7 , if added, for instance. The console will display some 6 chords and some augmented, but I don't know what I'm missing. var chr_scale = ['A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#'] const chord_names = {"Major": [0,4,7], "Minor": [0,3,7], "Major7": [0,4,7,11], "Augmented": [0, 4, 8], "Diminished": [0,3,6], "Diminished7": [0,3,6,9], "Half-diminished7": [0,3,6,10], "Minor-major7": [0, 3, 7, 11], "Augmented7": [0, 4, 8, 10], "Augmented major7": [0, 4, 8, 11], "Minor7": [0,3,7,10], "Major6": [0,4,7,9], "Minor6": [0,3,7,9], "Dominant7": [0,4,7,10], "Sus2": [0,2,7], "Sus4": [0,5,7], "Add9": [0,2,4,7]} var noteIn = ""; var basic_notes = []; var raw_list = []; function HandleMIDI(e) { e.send(); if (e instanceof NoteOn) { init = e.toString().indexOf('pitch'); //parses out just the note fin = e.toString().indexOf('vel'); //still parsing noteIn = (e.toString().substr(init+10,fin-init-13)); //still parsing basic_notes.push(noteIn); Trace(basic_notes); } else if (e instanceof NoteOff) { for (i = 0; i < basic_notes.length; i++) { init2 = e.toString().indexOf('pitch'); //parses out just the note fin2 = e.toString().indexOf('vel'); //still parsing if (basic_notes[i] == (e.toString().substr(init2+10,fin2-init2-13))) { basic_notes.splice(i, 1); Trace(basic_notes); break; } } } for (tonic in basic_notes){ var tonic_note = basic_notes[tonic]; var pattern = []; for (note in basic_notes){ var actual_note = basic_notes[note]; interval = ((chr_scale.indexOf(actual_note) - chr_scale.indexOf(tonic_note)) + 12 ) % 12; pattern.push(interval); } pattern.sort(); for (const [key, value] of Object.entries(chord_names)) { if (JSON.stringify(value) === JSON.stringify(pattern)) { Trace(tonic_note); Trace(key); }}}}
×
×
  • Create New...