Guest User

C3toolbox.py

a guest
Nov 8th, 2015
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.51 KB | None | 0 0
  1. tracks_array = { "PART DRUMS" : 999,
  2. "PART GUITAR" : 999,
  3. "PART BASS" : 999,
  4. "PART VOCALS" : 999,
  5. "PART KEYS" : 999,
  6. "PART REAL_KEYS_X": 999,
  7. "PART REAL_KEYS_H": 999,
  8. "PART REAL_KEYS_M": 999,
  9. "PART REAL_KEYS_E": 999,
  10. "PART KEYS_ANIM_LH": 999,
  11. "PART KEYS_ANIM_RH": 999,
  12. "HARM1": 999,
  13. "HARM2": 999,
  14. "HARM3": 999,
  15. "EVENTS": 999,
  16. "BEAT": 999,
  17. "PART DRUMS 2X": 999,
  18. "VENUE": 999,
  19. "PART RHYTHM": 999,
  20. "PART REAL_GUITAR": 999,
  21. "PART REAL_GUITAR_22": 999,
  22. "PART REAL_BASS": 999,
  23. "PART REAL_BASS_22": 999
  24. }
  25. array_instruments = {
  26. "Drums" : "PART DRUMS",
  27. "2x Drums" : "PART DRUMS 2X",
  28. "Rhythm" : "PART RHYTHM",
  29. "Guitar" : "PART GUITAR",
  30. "Bass" : "PART BASS",
  31. "Keys" : "PART KEYS",
  32. "Pro Keys" : "PART REAL_KEYS",
  33. "Vocals" : "PART VOCALS",
  34. "Harmony 1" : "HARM1",
  35. "Harmony 2" : "HARM2",
  36. "Harmony 3" : "HARM3",
  37. "Pro Guitar" : "PART REAL_GUITAR",
  38. "Pro Guitar 22" : "PART REAL_GUITAR_22",
  39. "Pro Bass" : "PART REAL_BASS",
  40. "Pro Bass 22" : "PART REAL_BASS_22"
  41. }
  42.  
  43. ...
  44.  
  45. def pg_root_notes(instrument, estringlow, astring, dstring, gstring, bstring, estringhigh):
  46.  
  47. #instrument (PART REAL_GUITAR, PART REAL_GUITAR_22, PART REAL_BASS, PART REAL_BASS_22)
  48. #all strings : tuning
  49.  
  50. global maxlen
  51.  
  52. instrument_track = tracks_array[instrument]
  53. notes_dict = notesname_array[notesname_instruments_array[instrument]]
  54.  
  55. division = int(math.floor((correct_tqn*4)*divisions_array[grid]))
  56.  
  57. array_instrument_data = process_instrument(instrument_track)
  58. array_instrument_notes = array_instrument_data[1]
  59. end_part = array_instrument_data[2]
  60. start_part = array_instrument_data[3]
  61. array_notesevents = create_notes_array(array_instrument_notes)
  62. array_notes = array_notesevents[0]
  63. array_events = array_notesevents[1]
  64. notes_found = 0
  65. result = 0
  66.  
  67. string1 = 0 + estringlow
  68. string2 = 0 + astring
  69. string3 = 0 + dstring
  70. string4 = 0 + gstring
  71. string5 = 0 + bstring
  72. string6 = 0 + estringhigh
  73.  
  74. for x in range(0, len(array_notes)):
  75. note = array_notes[x]
  76. if notes_dict[note[2]][1] == "root_notes":
  77. notes_found = 1
  78. result = RPR_MB( "Root notes found. Do you want to delete them and proceed?", "Root notes found", 1 )
  79. break
  80.  
  81. if result == 1 or notes_found == 0:
  82. array_temp = list(array_notes)
  83. array_notes = []
  84. for x in range(0, len(array_temp)):
  85. note = array_temp[x]
  86. if notes_dict[note[2]][1] != "root_notes":
  87. array_notes.append(note)
  88. else:
  89. return
  90.  
  91. for x in range(0, len(array_notes)):
  92. note = array_notes[x]
  93. if notes_dict[note[2]][1] == "notes_x":
  94. #It's an expert note, let's add it as a root note
  95. new_note = list(note)
  96. if(pitch == 96): #Which string? Which note?
  97. openstring = 4 + string1
  98. if(pitch == 97):
  99. openstring = 9 + string2
  100. if(pitch == 98):
  101. openstring = 14 + string3
  102. if(pitch == 99):
  103. openstring = 7 + string4
  104. if(pitch == 100):
  105. openstring = 11 + string5
  106. if(pitch == 101):
  107. openstring = 4 + string6
  108. root = openstring + velocity
  109. if (root > 3 or root < 16):
  110. while True: #Determining the right MIDI note by adding/removing an octave if necessary
  111. if (root < 4):
  112. newroot = root + 12
  113. if newroot > 3 or newroot < 16:
  114. break
  115. if (root > 15):
  116. newroot = root - 12
  117. if newroot > 3 or newroot < 16:
  118. break
  119. new_note[2] = newroot
  120. array_notes.append(new_note)
  121.  
  122. array_notes = add_objects(array_validnotes, array_validobjects)
  123. write_midi(instrument_track, [array_notes, array_events], end_part, start_part)
Advertisement
Add Comment
Please, Sign In to add comment