def detectDevice(): """ Gets the MIDI device name from FL Studio and sets `DEVICE_SERIES` to the right value in order for the script to work properly. """ # Imports DEVICE_SERIES from the global scope global DEVICE_SERIES # Retrieves the device name from FL Studio deviceName = device.getName() # Saves the 22th character of the device name for the S-Series check to isolate the extraction and avoid errors stopping the execution of the script char21 = None try: char21 = deviceName[21] except: char21 = None # Sets DEVICE_NAME depending on the retrieved name if deviceName == "Komplete Kontrol A DAW": DEVICE_SERIES = "A_SERIES" print("Detected device: Komplete Kontrol A-Series") elif deviceName == "Komplete Kontrol M DAW": DEVICE_SERIES = "M_SERIES" print("Detected device: Komplete Kontrol M-Series") elif char21 == "-": # Gets the 18th char on the name to see if it matches the "Komplete Kontrol DAW - X" naming scheme S-Series devices follow DEVICE_SERIES = "S_SERIES" print("Detected device: Komplete Kontrol S-Series") else: print( "Device detection failed. Going with the manually specified device on the script:", DEVICE_SERIES)
def OnInit(): """Function called when script starts""" if device.isAssigned(): print("Device assigned - ver 1.54") print(device.getName()) print(f"Port Number: {device.getPortNumber()}") else: print("Not assigned - ver 1.54")
# User-settable settings to alter behavior of keyboard import device TRUE_IF_ESSENTIAL_KEYBOARD = 'mkII' not in device.getName() # Set to True to allow drum pads to light up as a metronome indicator. ENABLE_PAD_METRONOME_LIGHTS = True # Set to True to allow transport lights to light up as a metronome indicator. ENABLE_TRANSPORTS_METRONOME_LIGHTS = True # Set to True to only allow visual metronome lights when audible metronome in FL Studio is enabled. # Set to False to always enable visual metronome lights when playing/recording. METRONOME_LIGHTS_ONLY_WHEN_METRONOME_ENABLED = False # Set to True to enable piano roll to be focused on during playback/record. This is needed for punch buttons to work. ENABLE_PIANO_ROLL_FOCUS_DURING_RECORD_AND_PLAYBACK = True # Configure the port number that midi notes are forwarded to for plugins. PLUGIN_FORWARDING_MIDI_IN_PORT = 10 # Set to True to put display text hints in all caps. HINT_DISPLAY_ALL_CAPS = False # Set to True to enable color bank lights. On Essential keyboards, the pad colors are set to the active channel color. ENABLE_COLORIZE_BANK_LIGHTS = True # Set True to also colorize the pad lights according to the active color channel (only on MKII. For Essential keyboard, # the ENABLE_COLORIZE_BANK_LIGHTS sets this option). ENABLE_MK2_COLORIZE_PAD_LIGHTS = True
def OnRefresh(flags): print('working') print(device.getName()) device.midiOutSysex( bytes([0xF0, 0x00, 0x00, 0x66, 0x14, 0x0C, 1, 0xF7]))
from arturia_midi import send_to_device import config import device import time import utils ESSENTIAL_KEYBOARD = 'mkII' not in device.getName() MKII_88_KEYBOARD = 'mkII 88' in device.getName() MKII_49_KEYBOARD = 'mkII 49' in device.getName() class ArturiaLights: """Maintains setting all the button lights on the Arturia device.""" # Value for turning on an LED. LED_ON = 127 # Value for turning off an LED. LED_OFF = 0 MISSING = 0 # IDs for all of the buttons with lights. ID_OCTAVE_MINUS = 16 ID_OCTAVE_PLUS = 17 ID_CHORD = 18 ID_TRANSPOSE = 19 ID_MIDI_CHANNEL = 20 ID_PAD_MODE_CHORD_TRANSPOSE = 21 ID_PAD_MODE_CHORD_MEMORY = 22 ID_PAD_MODE_PAD = 23 ID_NAVIGATION_CATEGORY = 24