Browse Source

limit internal pitches to 0 to 127. They can be reached through the GUI and need protection logic

master
Nils 2 years ago
parent
commit
55b76cf5a5
  1. 4
      engine/pattern.py

4
engine/pattern.py

@ -395,6 +395,10 @@ class Pattern(object):
velocity = noteDict["velocity"]
pitch = self._cachedTransposedScale[noteDict["pitch"] + scaleTransposition] + halftoneTransposition
if pitch > 127:
pitch = 127
elif pitch < 0:
pitch = 0
exportPattern += cbox.Pattern.serialize_event(startTick, 0x90 + self.parentTrack.midiChannel, pitch, velocity) # note on
exportPattern += cbox.Pattern.serialize_event(endTick-1, 0x80 + self.parentTrack.midiChannel, pitch, velocity) # note off #-1 ticks to create a small logical gap. Does not affect next note on.

Loading…
Cancel
Save