def LaunchMidinProcess(launchqueue): launchqueue_get = launchqueue.get while True: msg = launchqueue_get() # Note On #print msg if msg[0] == NOTE_ON: #PadLeds[msg[1]] #Launch send back note on and off to light up the led. (x, y) = PadIndex(msg[1]) #print x,y #print ("Launchpad Button : ", str(msg[1])) if x < 9: msg[1] = BhorNoteXY(x, y) print "Pad Matrix : ", msg[1], msg[2] midi.NoteOn(msg[1], msg[2]) time.sleep(0.1) if x == 9: print "Right Button : ", y PadRightOn(y, msg[2]) time.sleep(0.1) PadRightOff(y) if msg[0] == CONTROLLER_CHANGE: print "Pad Top Button : ", str(msg[1] - 103) PadTopOn(msg[1] - 103, msg[2]) time.sleep(0.1) PadTopOff(msg[1] - 103)
def led(path, tags, args, source): # tags will contain 'fff' # args is a OSCMessage with data # source is where the message came from (in case you need to reply) #print (source,path,args[0],args[1]) user = ''.join(path.split("/")) midi.NoteOn(args[0], args[1])
def noteon(path, tags, args, source): user = ''.join(path.split("/")) #print "" #print path,args #print "note : ", args[0] #print "velocity : 127" #print "gstt.tomidi", str(gstt.tomidi) if gstt.tomidi and args[0] > 11: print "Note on sending to midi devices" midi.NoteOn(int(args[0]), 64) else: Noteon_Update(int(args[0]))
def send(self, command, kwargs): for key in kwargs: kwargs[key] = int(kwargs[key]) if self.type == 'SERIAL': channel = kwargs['channel'] + 1 if command == 'note_on': note = kwargs['note'] velocity = kwargs['velocity'] msg_type = midi.NoteOn(note, velocity) elif command == 'control_change': control = kwargs['control'] value = kwargs['value'] msg = midi.Message(msg_type, channel=channel) self.conn.write(msg) else: msg = mido.Message(command, **kwargs) self.conn.send(msg)
import midi midiPort = midi.MidiConnector('/dev/ttyAMA0') #noteOff = midi.NoteOff(note_number,velocity) noteOn = midi.NoteOn(63, 40) #noteOn.note_number = 60 #noteOn.velocity = 40 msg = midi.Message(noteOn, channel=1) midiPort.write(msg)
def print_data_structures(size): transition_matrix = create_transition_matrix(size) probability_matrix = create_zero_matrix(size) note_dict = create_note_dict(size) for row in transition_matrix: #print(row) pass for row in probability_matrix: #print(row) pass for key in note_dict.keys(): print(key, note_dict[key]) write_note_dict(note_dict, "NoteDictionary") note_dict = read_note_dict("NoteDictionary") print("\n") add_note_transition(0, 2, note_dict) add_note_transition(0, 3, note_dict) add_note_transition(4, 5, note_dict) for key in note_dict.keys(): print(key, note_dict[key]) new_message = midi.Message(midi.NoteOn(60, 50), 1)