rewind() # initialize before start active=True # and start... if not onoff and active: active=False # stop first rewind() # initialize completely for safety... def togglepower(CCval, *z): global mode,lastmode #if currnote<0: if not active: if mode==0: mode=lastmode power(True) else: lastmode=mode mode=0 power(False) gv.setMC(gv.ARP,togglepower) def noteoff(): global playnote,velocity if playnote>-1: if playnote in gv.playingnotes: for m in gv.playingnotes[playnote]: m.fadeout(noteticks<stepticks) # damp when notes are consecutive gv.playingnotes[playnote]=[] if noteticks<stepticks: # process release sample if notes are not consecutive gv.PlayRelSample(m.playingrelsample(),gv.currvoice,playnote,velocity,m.playingretune()) playnote=-1 def rewind(): global currnote,cycletick currnote=-1 # stop the loop first
global VIBRpitch VIBRpitch = 1.0 * CCval / 32 # steps of 1/32th, range like GUI def VibrSetspeed(CCval, *z): global VIBRspeed VIBRspeed = 1.0 * CCval / 4 # range=32 VibrLFO.setstep(VIBRspeed) def VibrToggletrill(CCval, *z): global VIBRtrill VIBRtrill = not (VIBRtrill) gv.setMC(gv.VIBRDEPTH, VibrSetpitch) gv.setMC(gv.VIBRSPEED, VibrSetspeed) gv.setMC(gv.VIBRTRILL, VibrToggletrill) #gv.VibrSetspeed=VibrSetspeed TremLFO = plfo() TREMvalue = 1.0 # Full volume TREMampl = 0 # declare TREMspeed = 0 # declare TREMtrill = False # declare def TremProc(*z): global VIBRspeed, TREMtrill, TREMvalue, TREMampl if effect == 4: TremLFO.setstep(VIBRspeed)
stopit=True while gv.currsmf>0: time.sleep(.01) for i in gv.playingnotes: # What's playing at stop time ? if i<gv.MTCHNOTES: continue # Skip main controller/keyboard for m in gv.playingnotes[i]: # But remove our notes, as m.fadeout() # the player may have had gv.playingnotes[i]=[] # note-off's pending... def tempo(x,*z): global streamtempo gv.smftempo=int(streamtempo*(1+(-1+2.0*x/128))) if gv.smftempo<1: gv.smftempo=1 seq.change_tempo(gv.smftempo) # implicitely executes seq.drain() gv.setMC(gv.SMFS,play) gv.setMC(gv.SMFLOOP,loop) gv.setMC(gv.SMFSTOP,stop) gv.setMC(gv.SMFTEMPO,tempo) # ---------------------------------------------------------------------- # P L A Y E R T H R E A D # ---------------------------------------------------------------------- def player(): global seq,loopit,stopit,streamtempo,actvoicemap seq.subscribe_port(client, port) while True: if gv.currsmf>0: print "SMFplay %s, res=%d, %s" %(gv.smfseqs[gv.currsmf][0],gv.smfseqs[gv.currsmf][1],gv.smfseqs[gv.currsmf][3]) streamtempo=120 # default in sequencer, don't see use making this a parameter
if scope in [-2, -3, -4]: # also reset values FVtype = gv.getindex(gv.cp.get(gv.cfg, "Reverb".lower()), FVtypes, True, False) if FVtype < 0: FVtype = 0 #if scope == -3: # load sample set default # load sample set default #else: # system default FVsetroomsize(gv.cp.getfloat(gv.cfg, "FVroomsize".lower()) * 127) FVsetdamp(gv.cp.getfloat(gv.cfg, "FVdamp".lower()) * 127) FVsetlevel(gv.cp.getfloat(gv.cfg, "FVlevel".lower()) * 127) FVsetwidth(gv.cp.getfloat(gv.cfg, "FVwidth".lower()) * 127) FVsetType(FVtype) gv.setMC(gv.REVERB, FVsetReverb) # announce to CCmap gv.setMC(gv.REVERBLVL, FVsetlevel) gv.setMC(gv.REVERBROOM, FVsetroomsize) gv.setMC(gv.REVERBDAMP, FVsetdamp) gv.setMC(gv.REVERBWIDTH, FVsetwidth) # # = = = W A H = = = # # AutoWah (envelope & LFO) and Wah-Wah (pedal) based on # autowah by Daniel Zanco: https://github.com/dangpzanco/autowah # Autowah takes about 6% on PI3 # c_filters.awsetMinMaxFreq.argtypes = [c_float, c_float] c_filters.awsetQualityFactor.argtypes = [c_float] c_filters.awsetMixing.argtypes = [c_float]
import gv effects=["Off","On"] effect=False depth=0.0 gain=0.0 def setType(x,*z): global effect if x>0: effect=True else: effect=False def toggle(*z): global effect effect=not(effect) def setdepth(x,*z): # 2-15 global depth depth=2+13*x/127 def setgain(x,*z): # 0.3-0.8 global gain gain=0.3+0.5*x/127.0 def reset(): global effect,depth,gain effect=False depth=gv.cp.getfloat(gv.cfg,"CHOdepth".lower()) gain=gv.cp.getfloat(gv.cfg,"CHOgain".lower()) reset() gv.setMC(gv.CHORUS,toggle) gv.setMC(gv.CHORUSDEPTH,setdepth) gv.setMC(gv.CHORUSGAIN,setgain)
def decr(*z): nav(2, CCbuts) def sel(*z): nav(3, CCbuts) def ret(*z): nav(4, CCbuts) def CCdef(): global CCbuts CCbuts = 0 for m in gv.CCmap: if m[1] in CCbut: CCbuts += 1 CCbut.append(gv.setMC( gv.MENU_INCR, incr)) # and announce the procs while preserving its index CCbut.append(gv.setMC(gv.MENU_DECR, decr)) CCbut.append(gv.setMC(gv.MENU_SEL, sel)) CCbut.append(gv.setMC(gv.MENU_RET, ret)) gv.menu_CCdef = CCdef ############################################################### # Define table for general user interface use (UI.py) ############################################################### buttons = ["", "Up/Next", "Down/Prev", "Select", "Return"]