Example #1
0
def mixerSendInfo(info_type: str, trackID: int, **kwargs):
    """ Sends info about the mixer tracks to the device.
    
    info_type -- The kind of information you're going to send. ("VOLUME", "PAN"...) Defined on nihia.mixerinfo_types
    
    trackID -- From 0 to 7. Tells the device which track from the ones that are showing up in the screen you're going to tell info about.
    Third agument depends on what kind of information you are going to send:
    value (integer) -- Can be 0 (no) or 1 (yes). Used for two-state properties like to tell if the track is solo-ed or not.
    
    or
    info (string) -- Used for track name, track pan and track volume.
    """

    # Gets the inputed values for the optional arguments from **kwargs
    value = kwargs.get("value", 0)
    info = kwargs.get("info", None)

    # Defines the behaviour for when additional info is reported (for track name, track pan and track volume)
    if info != None:

        # Tells Python that the additional_info argument is in UTF-8
        info = info.encode("UTF-8")
        
        # Conforms the kind of message midiOutSysex is waiting for
        msg = [240, 0, 33, 9, 0, 0, 68, 67, 1, 0, mixerinfo_types.get(info_type), value, trackID] + list(bytes(info)) + [247]

        # Warps the data and sends it to the device
        device.midiOutSysex(bytes(msg))

    # Defines how the method should work normally
    else:
        
        # Takes the information and wraps it on how it should be sent and sends the message
        device.midiOutSysex(bytes([240, 0, 33, 9, 0, 0, 68, 67, 1, 0, mixerinfo_types.get(info_type), value, trackID, 247]))
Example #2
0
def printPan(trkn, pan): 

      pan = round(pan,0)

      volk = ""

      lettersh = [] 
      header = [240, 0, 33, 9, 0, 0, 68, 67, 1, 0, 71, 0,]

      p = 0
      n = 0
      m = 0

      header.append(trkn)
      

      if pan == 0:
         volk = "Centered"
         letters = list(volk) 

         while n < len(volk):
            lettersh.append(ord(letters[n]))
            n += 1 

      elif pan < 0:
         
         volk = u'%d%% Left' % round((pan*-1),2)
         letters = list(volk) 
         
         while n < len(volk):
            lettersh.append(ord(letters[n]))
            n += 1

      elif pan > 0 and pan < 101:
         
         volk = u'%d%% Right' % round((pan),2)
         letters = list(volk) 
         
         while n < len(volk):
            lettersh.append(ord(letters[n]))
            n += 1 

      elif pan >= 103:
         volk = "N/A"
         letters = list(volk) 

         while n < len(volk):
            lettersh.append(ord(letters[n]))
            n += 1        

      while m < len(lettersh):
         header.append(lettersh[m])
         m += 1

      header.append(247)

      device.midiOutSysex(bytes(header))
Example #3
0
def dataOut(data1: int or hex, data2: int or hex):
    """ Function for easing the communication with the device. By just entering the DATA1 and DATA2 bytes of the MIDI message that has to be sent to the device, it 
    composes the full message in order to satisfy the syntax required by the midiOutSysex method, 
    as well as setting the STATUS of the message to BF as expected and sends the message. 
    
    data1, data2 -- Corresponding bytes of the MIDI message."""
    
    # Composes the MIDI message and sends it
    device.midiOutSysex(bytes([240, 191, data1, data2, 247]))
Example #4
0
def dataOut(data1, data2):
    """ Function that makes commmuication with the keyboard easier. By just entering the DATA1 and DATA2 of the MIDI message, 
    it composes the full message in forther to satisfy the syntax required by the midiOut functions, as well as the setting 
    the STATUS of the message to BF as expected.""" 
    
    # Composes the MIDI message and sends it
    convertmsg = [240, 191, data1, data2] # takes message and add the header required for communication with device
    msgtom32 = bytearray(convertmsg) #converts message array into bytes, 1 turns into 0x01 but in b/01/ format
    device.midiOutSysex(bytes(msgtom32)) #converts to 0x01 format
Example #5
0
def KompleteDataOut(data11, data12):
    """ Funtion that makes commmuication with the keyboard easier. By just entering the DATA1 and DATA2 of the MIDI message, 
          it composes the full message in forther to satisfy the syntax required by the midiOut functions, as well as the setting 
            the STATUS of the message to BF as expected."""
    device.midiOutSysex(
        bytes([0xF0, 0xBF, data11, data12, 0x00, 0x0C, 1, 0xF7]))
    device.midiOutSysex(
        bytes([
            0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x40,
            0x01, 0x00, 0xF7
        ]))  # mute and solo light bug fix
Example #6
0
def printVol(trkn, vol):

      """ funtion that makes sendinig vol to the OLED screen easier"""
       
      volk = ""
      
      lettersh = [] 
      header = [240, 0, 33, 9, 0, 0, 68, 67, 1, 0, 70, 0,] 

      p = 0
      n = 0
      m = 0

      vol==(float(vol))

      if vol == 0:
         volk = "- oo dB"
         letters = list(volk) 

         while n < len(volk):
            lettersh.append(ord(letters[n]))
            n += 1
 
      elif vol >= 0.01 and vol <= 2.00:
         
         #volj = u'%d%%  ' % round((vol*100),2) # returns volume display to percentage
         #lettersj = list(volj)
         #while m < len(volj):
         #   lettersh.append(ord(lettersj[m]))
         #   m += 1 #end of volume in percentage 

         volk = '%s dB' % device_Komplete_Kontrol_DAW.VolTodB(vol) # volume displayed in dB from here
         letters = list(volk)
         while n < len(volk):
            lettersh.append(ord(letters[n]))
            n += 1 # end of volume in dB
         
      elif vol >= 103:
         volk = "N/A"
         letters = list(volk) 

         while n < len(volk):
            lettersh.append(ord(letters[n]))
            n += 1   

      header.append(trkn)
      
      while m < len(lettersh):
         header.append(lettersh[m])
         m += 1

      header.append(247)

      device.midiOutSysex(bytes(header))
Example #7
0
def initiate():
    """ Acknowledges the device that a compatible host has been launched, wakes it up from MIDI mode and activates the deep
    integration features of the device. TODO: Then waits for the answer of the device in order to confirm if the handshake 
    was successful and returns True if affirmative."""

    # Sends the MIDI message that initiates the handshake: BF 01 01

    dataOut(1, 1)
    #turning on group of lights not initialized during the nihia.initiate()
    dataOut(buttons["CLEAR"], on)
    dataOut(buttons["UNDO"], on) 
    dataOut(buttons["REDO"], on) 
    dataOut(buttons["AUTO"], on) 
    dataOut(buttons["QUANTIZE"], on) 
    device.midiOutSysex(bytes([240, 0, 33, 9, 0, 0, 68, 67, 1, 0, 64, 1, 0, 247])) # 'mute' & 'solo' button lights activated
Example #8
0
def setDisplayLine2(string):
    s = bytes(string, 'iso8859_2')
    length = len(s)
    if len(string) > 16:
        length = 16
    sysex = bytearray(b'\xF0\x00\x20\x29\x02\x0F\x04\x01')
    for i in range(0, length):
        if (s[i] < 0x20) or (s[i] == 0x7F):
            sysex.append(0x20)
        if s[i] > 0x7F:
            sysex.append(0x11)
            sysex.append(s[i] - 0x80)
        else:
            sysex.append(s[i])
    sysex.append(0xF7)
    device.midiOutSysex(bytes(sysex))
Example #9
0
def printText(trkn, word):
    """ Function for easing the communication with the device OLED easier. The device has 8 slots 
      that correspond to the 8 knobs. Knobs 0 through 7 on the device. Slot 0 (aka Knob 0 aka the
      first knob from the left) is also use to display temporary messages. """

    lettersh = [
    ]  #array where message to screen will be broken down by letter and/or spaces, i.e. hello turns into [h,e,l,l,o] **1
    header = [
        240, 0, 33, 9, 0, 0, 68, 67, 1, 0, 72, 0
    ]  #required header in message to tell m32 where to place track title

    n = 0
    m = 0

    letters = list(word)  #convert word into letters in array

    if len(
            letters
    ) <= 11:  #if the message to screen is less than 11 characters convert to message by letters see -> **1
        while n < len(
                letters
        ):  #convert letters in array to integer representing the Unicode character
            if ord(letters[n]) > 256:
                n += 1
            else:
                lettersh.append(ord(letters[n]))
                n += 1
    else:
        while n < 12:  #convert letters in array to integer representing the Unicode character
            if ord(letters[n]) > 256:
                n += 1
            else:
                lettersh.append(ord(letters[n]))
                n += 1

    header.append(trkn)  #adding track number to header at the end

    while m < len(
            lettersh
    ):  #combining header array and unicode value array together; just makes it easier to send to device
        header.append(lettersh[m])
        m += 1

    header.append(247)  #tells m32, that's it that's the whole word

    device.midiOutSysex(
        bytes(header))  #send unicode values as bytes to OLED screen
Example #10
0
	def OnDeInit(self):

		if device.isAssigned():

			for m in range(0, 8):
				device.midiOutSysex(bytes([0xF0, 0x00, 0x00, 0x66, 0x15, 0x20, m, 0, 0xF7]))

			if ui.isClosing():
				self.SendMsg(ui.getProgTitle() + ' session closed at ' + time.ctime(time.time()), 0)
			else:
				self.SendMsg('')

			self.SendMsg('', 1)
			self.SendAssignmentMsg('  ')
			self.EmptyLastMsgT()

		print('OnDeInit ready')
Example #11
0
def oled_mute_solo(lighttype, state): 

   header = [0, 240, 0, 33, 9, 0, 0, 68, 67, 1, 0]

   omute = [lighttype, state, 0]
   osolo = [lighttype, state, 0]

   n = 0

   if lighttype == buttons["MUTE"]:
      while n < len(omute):
         header.append(omute[n])
         n += 1

   elif lighttype == buttons["SOLO"]:
      while n < len(osolo):
         header.append(osolo[n])
         n += 1

   header.append(247)
   device.midiOutSysex(bytes(header))
Example #12
0
	def OnInit(self):

		self.FirstTrackT[0] = 1
		self.FirstTrack = 0
		self.SmoothSpeed = 469
		self.Clicking = True

		device.setHasMeters()
		for m in range (0, len(self.FreeCtrlT)):
			self.FreeCtrlT[m] = 8192 # default free faders to center
		if device.isAssigned():
			for x in range(0, 8):
				device.midiOutSysex(bytes([0xF0, 0x00, 0x00, 0x66, 0x15, 0x0C, 1, 0xF7]))

		self.SetBackLight(2) # backlight timeout to 2 minutes
		self.UpdateClicking()
		self.UpdateMeterMode()

		self.SetPage()
		self.OnSendTempMsg('Linked to ' + ui.getProgTitle() + ' (' + ui.getVersion() + ')', 2000);
		print('OnInit ready')
Example #13
0
 def OnInit(self):
     KompleteDataOut(0x15, 0x01) #clear light on
     KompleteDataOut(0x20, 0x01) #undo light on
     KompleteDataOut(0x21, 0x01) #undo light on
     device.midiOutSysex(bytes([0xF0, 0xBF, 0x23, 0x00, 0x00, 0x0C, 1, 0xF7])) # auto button light fix
     device.midiOutSysex(bytes([0xBF, 0x22, 0x01])) #quantize light fix
     device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x40, 0x01, 0x00, 0xF7])) # mute and solo light bug fix         
     print("Komplete Kontrol M32 Script - V2.9.8")
Example #14
0
	def UpdateMeterMode(self):

		# force vertical (activity) meter mode for free controls page
		self.CurMeterMode = self.MeterMode

		if device.isAssigned():
			#clear peak indicators
			for m in range(0, len(self.ColT) - 1):
				device.midiOutMsg(midi.MIDI_CHANAFTERTOUCH + (0xF << 8) + (m << 12))
			# disable all meters
			for m in range (0, 8):
				device.midiOutSysex(bytes([0xF0, 0x00, 0x00, 0x66, 0x15, 0x20, m, 0, 0xF7]))

		# reset stuff
		if self.CurMeterMode > 0:
			self.TempMsgCount = -1
		else:
			self.TempMsgCount = 500 // 48 + 1

		self.EmptyLastMsgT()
		self.MeterMax = 0xD + int(self.CurMeterMode == 1) # $D for horizontal, $E for vertical meters
		self.ActivityMax = 0xD - int(self.CurMeterMode == 1) * 6

		# meter split marks
		if self.CurMeterMode == 0:
			s2 = '';
			for m in range(0, len(self.ColT) - 1):
				s2 = s2 + '      .'
			self.SendMsg(s2, 1);
		else:
			self.UpdateTextDisplay()

		if device.isAssigned():
			# horizontal/vertical meter mode
			device.midiOutSysex(bytes([0xF0, 0x00, 0x00, 0x66, 0x15, 0x21, int(self.CurMeterMode > 0), 0xF7]))

			# enable all meters
			if self.CurMeterMode == 2:
				n = 1
			else:
				n = 1 + 2;
			for m  in range(0, 8):
				device.midiOutSysex(bytes([0xF0, 0x00, 0x00, 0x66, 0x15, 0x20, m, n, 0xF7]))
Example #15
0
def sendUniversalDeviceEnquiry():
    """Sends a universal device enquiry to the controller.
    """
    device.midiOutSysex(consts.DEVICE_ENQUIRY_MESSAGE)
Example #16
0
	def SetBackLight(self, Minutes): # set backlight timeout (0 should switch off immediately, but doesn't really work well)

		if device.isAssigned():
			device.midiOutSysex(bytes([0xF0, 0x00, 0x00, 0x66, 0x15, 0x0B, Minutes, 0xF7]))
Example #17
0
	def UpdateClicking(self): # switch self.Clicking for transport buttons

		if device.isAssigned():
			device.midiOutSysex(bytes([0xF0, 0x00, 0x00, 0x66, 0x15, 0x0A, int(self.Clicking), 0xF7]))
Example #18
0
def sendDeviceInquiry():
    device.midiOutSysex(bytes([0xF0, 0x7E, 0x7F, 0x06, 0x01, 0xF7]))
Example #19
0
def clearDisplay():
    device.midiOutSysex(bytes([0xF0, 0x00, 0x20, 0x29, 0x02, 0x0F, 0x06,
                               0xF7]))
Example #20
0
def mixerSendInfo(info_type: str, trackID: int, **kwargs):
    """ Sends info about the mixer tracks to the device.
    
    ### Parameters

     - info_type: The kind of information you're going to send as defined on `mixerinfo_types`. ("VOLUME", "PAN"...)
         - Note: If declared as `"EXIST"`, you can also declare the track type on the `value` argument as a string (values are contained in `track_types` dictionary).
    
     - trackID: From 0 to 7. Tells the device which track from the ones that are showing up in the screen you're going to tell info about.

    The third (and last) argument depends on what kind of information you are going to send:

     - value (integer): Can be 0 (no) or 1 (yes). Used for two-state properties like to tell if the track is solo-ed or not (except `"EXIST"`).

     - info: Used for track name, track pan, track volume and the Komplete Kontrol instance ID.

     - peakValues: For peak values. They can be neither integers or floats, and they will get reformated automatically. You can
    also use the `mixer.getTrackPeaks` function directly to fill the argument, but remember you have to specify the left and the right channel separately. You have to 
    report them as a list of values: `peak=[peakL_0, peakR_0, peakL_1, peakR_1 ...]`
    """

    # Gets the inputed values for the optional arguments from **kwargs
    value = kwargs.get("value", 0)
    info = kwargs.get("info", None)

    peakValues = kwargs.get("peakValues", None)

    # Compatibility behaviour for older implementations of the layer before the addition of track_types
    # This will retrieve the correct value in case the developer used the string based declaration
    if type(value) == str:
        value = track_types.get(value, 0)


    # Defines the behaviour for when additional info is reported (for track name, track pan, track volume and peak values)
    if info != None:
        # Tells Python that the additional_info argument is in UTF-8
        info = info.encode("UTF-8")

        # Converts the text string to a list of Unicode values
        info = list(bytes(info))
        
        # Conforms the kind of message midiOutSysex is waiting for
        msg = [240, 0, 33, 9, 0, 0, 68, 67, 1, 0, mixerinfo_types.get(info_type), value, trackID] + info + [247]

        # Warps the data and sends it to the device
        device.midiOutSysex(bytes(msg))

    # Defines how the method should work normally
    elif info == None:
        
        # Takes the information and wraps it on how it should be sent and sends the message
        device.midiOutSysex(bytes([240, 0, 33, 9, 0, 0, 68, 67, 1, 0, mixerinfo_types.get(info_type), value, trackID, 247]))

    
    # For peak values
    # Takes each value from the dictionary and rounds it in order to avoid conflicts with hexadecimals only being "compatible" with integer numbers 
    # in case peak values are specified
    if peakValues != None:
            
        for x in range(0, 16):
            # Makes the max of the peak meter on the device match the one on FL Studio (values that FL Studio gives seem to be infinite)
            if peakValues[x] >= 1.1:
                peakValues[x] = 1.1
        
            # Translates the 0-1.1 range to 0-127 range
            peakValues[x] = peakValues[x] * (127 / 1.1)
        
            # Truncates the possible decimals and declares the number as an integer to avoid errors in the translation of the data
            peakValues[x] = int(math.trunc(peakValues[x]))

        # Conforms the kind of message midiOutSysex is waiting for
        msg = [240, 0, 33, 9, 0, 0, 68, 67, 1, 0, mixerinfo_types.get(info_type), 2, trackID] + peakValues + [247]

        # Warps the data and sends it to the device
        device.midiOutSysex(bytes(msg))
def send_to_device(data):
    """Sends a data payload to Arturia device. """
    debug.log('CMD', 'Sending payload: ' + str(data))
    # Reference regarding SysEx code : # https://forum.arturia.com/index.php?topic=90496.0
    device.midiOutSysex(
        bytes([0xF0, 0x00, 0x20, 0x6B, 0x7F, 0x42]) + data + bytes([0xF7]))
def send_to_device(data):
    """Sends a data payload to Arturia device. """
    # debug.log('CMD', 'Sending payload: ' + str(data))
    # Reference regarding SysEx code : # https://forum.arturia.com/index.php?topic=90496.0
    device.midiOutSysex(
        bytes(SYSEX_HEADER) + bytes(data) + bytes(SYSEX_FOOTER))
Example #23
0
 def _send_bytes(self, text, row=0):
     text_bytes = text.encode("ascii", errors="ignore")
     device.midiOutSysex(self.sysex_prefix + text_bytes)
     self.pending_redraw = False
Example #24
0
     def UpdateOLED(self):

        if (ui.getFocused(0) == 1) == True: #mixer volume control
            #spells out 'Mixer' on tracks 1 through 8 on OLED
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x00, 0x4D, 0x69, 0x78, 0x65, 0x72, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x01, 0x4D, 0x69, 0x78, 0x65, 0x72, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x02, 0x4D, 0x69, 0x78, 0x65, 0x72, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x03, 0x4D, 0x69, 0x78, 0x65, 0x72, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x04, 0x4D, 0x69, 0x78, 0x65, 0x72, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x05, 0x4D, 0x69, 0x78, 0x65, 0x72, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x06, 0x4D, 0x69, 0x78, 0x65, 0x72, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x07, 0x4D, 0x69, 0x78, 0x65, 0x72, 0xF7]))

            if mixer.isTrackEnabled(mixer.trackNumber()) == 1: #mute light off
               device.midiOutSysex(bytes([0x00, 0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x43, 0x00, 0x00, 0xF7]))
               KompleteDataOut(0x66, 0x00)
               
            elif mixer.isTrackEnabled(mixer.trackNumber()) == 0: #mute light on
               device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x43, 0x01, 0x00, 0xF7]))
               KompleteDataOut(0x66, 0x01)
            
            #if (mixer.isTrackSolo(mixer.trackNumber()) == 1) == True: trying to figure out how to turn off solo when mute turns on the same track
            #   if mixer.isTrackEnabled(mixer.trackNumber()) == False: 
            #      device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x44, 0x01, 0x00, 0xF7]))
            #      KompleteDataOut(0x69, 0x01)

            if (mixer.isTrackSolo(mixer.trackNumber()) == 0) == True: #solo light off
               device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x44, 0x00, 0x00, 0xF7]))
               KompleteDataOut(0x69, 0x00)

            elif (mixer.isTrackSolo(mixer.trackNumber()) == 1) == True: #solo light on
               device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x44, 0x01, 0x00, 0xF7]))
               KompleteDataOut(0x69, 0x01)


        if (ui.getFocused(1) == 1) == True: # channel rack
            #spells out 'Ch. Rack' on tracks 1 through 8 on OLED
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x00, 0x43, 0x68, 0x2E, 0x20, 0x52, 0x61, 0x63, 0x6B, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x01, 0x43, 0x68, 0x2E, 0x20, 0x52, 0x61, 0x63, 0x6B, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x02, 0x43, 0x68, 0x2E, 0x20, 0x52, 0x61, 0x63, 0x6B, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x03, 0x43, 0x68, 0x2E, 0x20, 0x52, 0x61, 0x63, 0x6B, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x04, 0x43, 0x68, 0x2E, 0x20, 0x52, 0x61, 0x63, 0x6B, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x05, 0x43, 0x68, 0x2E, 0x20, 0x52, 0x61, 0x63, 0x6B, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x06, 0x43, 0x68, 0x2E, 0x20, 0x52, 0x61, 0x63, 0x6B, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x07, 0x43, 0x68, 0x2E, 0x20, 0x52, 0x61, 0x63, 0x6B, 0xF7]))

            if channels.isChannelMuted(channels.channelNumber()) == 1: #mute light off
               device.midiOutSysex(bytes([0x00, 0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x43, 0x00, 0x00, 0xF7]))
               KompleteDataOut(0x66, 0x00)
               
            elif channels.isChannelMuted(channels.channelNumber()) == 0: #mute light on
               device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x43, 0x01, 0x00, 0xF7]))
               KompleteDataOut(0x66, 0x01)
            
            #if (mixer.isTrackSolo(mixer.trackNumber()) == 1) == True: trying to figure out how to turn off solo when mute turns on the same track
            #   if mixer.isTrackEnabled(mixer.trackNumber()) == False: 
            #      device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x44, 0x01, 0x00, 0xF7]))
            #      KompleteDataOut(0x69, 0x01)
            if channels.channelCount() >= 2: 
               if (channels.isChannelSolo(channels.channelNumber()) == 0) == True: #solo light off
                  device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x44, 0x00, 0x00, 0xF7]))
                  KompleteDataOut(0x69, 0x00)

               elif (channels.isChannelSolo(channels.channelNumber()) == 1) == True: #solo light on
                  device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x44, 0x01, 0x00, 0xF7]))
                  KompleteDataOut(0x69, 0x01)
                  


        if (ui.getFocused(2) == 1) == True: # playlist
            #spells out 'Playlist' on tracks 1 through 8 on OLED
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x00, 0x50, 0x6C, 0x61, 0x79, 0x6C, 0x69, 0x73, 0x74, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x01, 0x50, 0x6C, 0x61, 0x79, 0x6C, 0x69, 0x73, 0x74, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x02, 0x50, 0x6C, 0x61, 0x79, 0x6C, 0x69, 0x73, 0x74, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x03, 0x50, 0x6C, 0x61, 0x79, 0x6C, 0x69, 0x73, 0x74, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x04, 0x50, 0x6C, 0x61, 0x79, 0x6C, 0x69, 0x73, 0x74, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x05, 0x50, 0x6C, 0x61, 0x79, 0x6C, 0x69, 0x73, 0x74, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x06, 0x50, 0x6C, 0x61, 0x79, 0x6C, 0x69, 0x73, 0x74, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x07, 0x50, 0x6C, 0x61, 0x79, 0x6C, 0x69, 0x73, 0x74, 0xF7]))

        if (ui.getFocused(3) == 11) == True: # piano roll #disabled
            #spells out 'Piano Roll' on tracks 1 through 8 on OLED
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x00, 0x50, 0x69, 0x61, 0x6E, 0x6F, 0x20, 0x52, 0x6F, 0x6C, 0x6C, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x01, 0x50, 0x69, 0x61, 0x6E, 0x6F, 0x20, 0x52, 0x6F, 0x6C, 0x6C, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x02, 0x50, 0x69, 0x61, 0x6E, 0x6F, 0x20, 0x52, 0x6F, 0x6C, 0x6C, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x03, 0x50, 0x69, 0x61, 0x6E, 0x6F, 0x20, 0x52, 0x6F, 0x6C, 0x6C, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x04, 0x50, 0x69, 0x61, 0x6E, 0x6F, 0x20, 0x52, 0x6F, 0x6C, 0x6C, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x05, 0x50, 0x69, 0x61, 0x6E, 0x6F, 0x20, 0x52, 0x6F, 0x6C, 0x6C, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x06, 0x50, 0x69, 0x61, 0x6E, 0x6F, 0x20, 0x52, 0x6F, 0x6C, 0x6C, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x07, 0x50, 0x69, 0x61, 0x6E, 0x6F, 0x20, 0x52, 0x6F, 0x6C, 0x6C, 0xF7]))

        if (ui.getFocused(4) == 11) == True: # piano roll # disabled 
            #spells out 'Piano Roll' on tracks 1 through 8 on OLED
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x00, 0x42, 0x72, 0x6F, 0x77, 0x73, 0x65, 0x72, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x01, 0x42, 0x72, 0x6F, 0x77, 0x73, 0x65, 0x72, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x02, 0x42, 0x72, 0x6F, 0x77, 0x73, 0x65, 0x72, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x03, 0x42, 0x72, 0x6F, 0x77, 0x73, 0x65, 0x72, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x04, 0x42, 0x72, 0x6F, 0x77, 0x73, 0x65, 0x72, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x05, 0x42, 0x72, 0x6F, 0x77, 0x73, 0x65, 0x72, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x06, 0x42, 0x72, 0x6F, 0x77, 0x73, 0x65, 0x72, 0xF7]))
            device.midiOutSysex(bytes([0xF0, 0x00, 0x21, 0x09, 0x00, 0x00, 0x44, 0x43, 0x01, 0x00, 0x48, 0x00, 0x07, 0x42, 0x72, 0x6F, 0x77, 0x73, 0x65, 0x72, 0xF7]))
 def OnRefresh(flags):
     print('working')
     print(device.getName())
     device.midiOutSysex(
         bytes([0xF0, 0x00, 0x00, 0x66, 0x14, 0x0C, 1, 0xF7]))
 def sysex(self, msg):
     device.midiOutSysex(SYSEX_HEADER + msg)