def show(): # How turn off all leds ''' if bhoreal.Here != -1: bhoreal.Cls(0) if launchpad.Here != -1: launchpad.Cls() ''' # Check if midi3 has been previously initiated if len(midi3.OutDevice) == 0: midi3.OutConfig() if (mididest == 'launchpad' and launchpad.Here != -1) or (mididest == 'bhoreal' and bhoreal.Here != -1): rotation(rotangle) for note in range(1, 65): midi3.NoteOn(note - 1, BhorLeds[note - 1], mididest) time.sleep(0.0001) else: print(mididest, 'is connected ?')
def runPatch(number, laser=0): print() print("Run patch :", number, "on laser", laser, "...") # Patch exist ? if (str(number + 1) in gstt.patchs['pattrstorage']['slots']) != False: # Yes gstt.patchnumber[laser] = number for ccnumber in range(len(maxwell['ccs'])): # Update cc variable content and OSC UI for given laser gstt.ccs[laser][ccnumber] = getPatchValue(gstt.patchnumber[laser], ccnumber) SendOSCUI('/cc/' + str(ccnumber), [getPatchValue(gstt.patchnumber[laser], ccnumber)]) # Update BCR 2000 CC if exists if bcr.Here != -1: midi3.MidiMsg([ CONTROLLER_CHANGE, ccnumber, getPatchValue(gstt.patchnumber[laser], ccnumber) ], "BCR2000") for ccnumber in range(len(maxwell['ccs'])): print(ccnumber, " ", gstt.ccs[laser][ccnumber]) # Update OSC UI patch number and send to Maxwell via midi SendOSCUI('/laser/patch/' + str(laser), [gstt.patchnumber[laser]]) midi3.NoteOn(gstt.patchnumber[laser], 127, 'to Maxwell 1') #print("Laser", laser, ": current patch is now :", gstt.patchnumber[laser], 'ccs', gstt.ccs[laser]) else: print("Patch doesnt exists")
def PrevPatch(value): global current print('PrevPatch function') if value == 127 and current['patch'] - 1 > -1: cc(9, 127, dest=djdest) time.sleep(0.1) current['patch'] -= 1 print("Current patch is now :",current['patch']) midi3.NoteOn(current['patch'], 127, 'to Maxwell 1') cc(9, 0, dest=djdest)
def NextPatch(value): global current print('NextPatch function', current["patch"]) if value == 127 and current["patch"] + 1 < 41: cc(3, 127, dest = djdest) current["patch"] += 1 #ModeNote(current["patch"], 127, 'to Maxwell 1') midi3.NoteOn(current["patch"], 127, 'to Maxwell 1') print("Current patch is now :",current["patch"]) time.sleep(0.1) cc(3, 0, dest = djdest)
def NoteOff(note, dest=mididest): midi3.NoteOn(note, mididest)
def NoteOn(note, velocity, dest=mididest): midi3.NoteOn(note, velocity, mididest)
def MidinProcess(BEATSTEPqueue): global computer while True: BEATSTEPqueue_get = BEATSTEPqueue.get msg = BEATSTEPqueue_get() # print (msg) # Note if msg[0] == NOTE_ON: # note mode midi3.NoteOn(msg[1], msg[2], mididest) # Program Change button selected : change destination computer if msg[0] == PROGRAM_CHANGE: print("Beatstep : Program change : ", str(msg[1])) # Change destination computer mode print("Destination computer", int(msg[1])) computer = int(msg[1]) # Beatstep Encoders are on Midi Channel 1 : CCnumber is matrix name -> midi CC if msg[0] == CONTROLLER_CHANGE: if computer == 0 or computer == 1: macroname = "m" + str(msg[1]) macroargs = msg[2] MidiChannel = msg[0] - 175 MidiCC = msg[1] MidiVal = msg[2] Encoder(macroname, macroargs) # LccZcc ''' # encoder slowly turned to right if MidiVal == 1: +1 # encoder fastly turned to right if MidiVal > 1 and MidiVal <20: +10 # encoder slowly turned to left if MidiVal == 127: -1 # encoder fasly turned to left if MidiVal < 127 and MidiVal > 90: -10 gstt.ccs[0][MaxwellCC] + value ''' if len(macros["LccZcc"]) > 0: # print("LccZcc test...", MidiChannel, MidiCC, MidiVal, macros["LccZcc"][0]["chanIN"], gstt.songs[gstt.song]) for counter in range(len(macros["LccZcc"])): if (macros["LccZcc"][counter]["songname"] == gstt.songs[gstt.song] or macros["LccZcc"] [counter]["songname"] == "all") and ( macros["LccZcc"][counter]["chanIN"] == MidiChannel or macros["LccZcc"][counter]["chanIN"] == "all" ) and (macros["LccZcc"][counter]["ccs"] == msg[1] or macros["LccZcc"][counter]["ccs"] == "all"): print("Beatstep : LccZcc", macros["LccZcc"][counter]["songname"], ":", macros["LccZcc"][counter]["name"]) print( "Beatstep LccZcc got song :", macros["LccZcc"][counter]["songname"], " IN Channel :", macros["LccZcc"][counter]["chanIN"], " value :", macros["LccZcc"][counter]["value"], ) if macros["LccZcc"][counter]["value"] == "linear": print("Beatstep Linear", MidiVal) midi3.MidiMsg( (176 + macros["LccZcc"][counter]["chanOUT"] - 1, macros["LccZcc"][counter]["ccOUT"], MidiVal), macros["LccZcc"][counter]["mididest"], laser=0) if macros["LccZcc"][counter]["value"] == "curved": print("Beatstep :", MidiVal, "got curved", maxwellccs.curved(MidiVal)) midi3.MidiMsg( (176 + macros["LccZcc"][counter]["chanOUT"], macros["LccZcc"][counter]["ccOUT"], maxwellccs.curved(MidiVal)), macros["LccZcc"][counter]["mididest"], laser=0) else: SendOSC(gstt.computerIP[computer - 1], gstt.MaxwellatorPort, '/cc', [int(msg[1]), int(msg[2])]) # Beatstep Pads are on channel 10 if msg[0] == CONTROLLER_CHANGE + 10 - 1: #if msg[0] == CONTROLLER_CHANGE + 10 -1 and msg[2] > 0: MidiCC = msg[1] MidiVal = msg[2] state = MidiVal #print(MidiCC, MidiVal) macroname = "m" + str(MidiCC) print("Beatstep : macroname", macroname, "state", state) padCC(macroname, state) '''
def NoteOn(note, velocity, dest=mididest, laser=gstt.lasernumber): midi3.NoteOn(note, velocity, mididest, laser)
def NoteOff(note, dest=mididest, laser=gstt.lasernumber): midi3.NoteOn(note, mididest, laser)