Skip to content

Commit 4a38287

Browse files
committed
fix pitch bend message creation
1 parent 30633c3 commit 4a38287

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tmidi.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,15 @@ def __init__(self, mtype=SYSTEM_RESET, channel=None, data0=0, data1=0):
189189
m = Message(tmidi.NOTE_ON, 0, 60, 127)
190190
# create CC 74 with val 63 on ch 4
191191
m = Message(tmidi.CC, 3, 74, 63)
192+
# create a pitch bend full up on ch 1
193+
m = Message(tmidi.PITCH_BEND, 0, 8191)
192194
"""
193195
self.type = mtype
194196
self.channel = channel
195197
self.data0 = data0
196198
self.data1 = data1
199+
if mtype == PITCH_BEND and data1 == 0:
200+
self.pitch_bend = data0
197201

198202
def __bytes__(self):
199203
status_byte = self.type
@@ -246,6 +250,7 @@ def pitch_bend(self):
246250

247251
@pitch_bend.setter
248252
def pitch_bend(self, pbval):
253+
pbval += 8192
249254
self.data0 = pbval & 0x7F
250255
self.data1 = pbval >> 7
251256

0 commit comments

Comments
 (0)