def ratio_msb(param,x,y): count = len(HARMONICS) msb = MSB(canvas,param,editor,count) for i,p in enumerate(HARMONICS): v,text = p d = _msb_aspect(v,text) msb.define_aspect(i,v,d) self.add_control(param,msb) msb.layout((x,y)) msb.update_aspect() return msb
def msb_keybreak(param,x,y): count = len(KEYBREAK) msb = MSB(canvas,param,editor,count) for i,s in enumerate(KEYBREAK): d = {"fill" : CFILL, "foreground" : CFOREGROUND, "outline" : COUTLINE, "value" : s, "text" : "%d" % s} msb.define_aspect(i,s,d) self.add_control(param,msb) msb.layout((x,y)) msb.update_aspect() return msb
def msb_keybreak(self,param,x,y): count = len(acon.KEY_BREAKPOINTS) msb = MSB(self.canvas,param,self.editor,count) for i,val in enumerate(acon.KEY_BREAKPOINTS): d = {"fill" : acon.CFILL, "foreground" : acon.CFOREGROUND, "outline" : acon.COUTLINE, "value" : val, "text" : str(val)} msb.define_aspect(i,val,d) self.add_control(param,msb) msb.layout((x,y)) msb.update_aspect() return msb
def msb_keyscale(self,param,x,y): count = len(acon.KEYSCALES) msb = MSB(self.canvas,param,self.editor,count) for i,value in enumerate(acon.KEYSCALES): d = {"fill" : acon.CFILL, "foreground" : acon.CFOREGROUND, "outline" : acon.COUTLINE, "value" : value, "text" : "%+d" % value} msb.define_aspect(i,value,d) self.add_control(param,msb) msb.layout((x,y)) msb.update_aspect() return msb
def msb(param,x): b = MSB(canvas,param,editor,len(FREQ_RATIOS)) self.add_control(param,b) b.layout((x,y_msb)) for i,r in enumerate(FREQ_RATIOS): value = float(r[0]) txt = r[1] adict = {'value' : value, 'text' : txt, 'fill' : '#13302d', 'foreground' : '#8f94a9', 'outline' : '#8f94a9'} b.define_aspect(i,value,adict) b.update_aspect()
def msb_lfo_ratio(self,param,x,y): count = len(acon.LFO_RATIOS) msb = MSB(self.canvas,param,self.editor,count) for i in range(count): val,txt = acon.LFO_RATIOS[i] d = {"fill":acon.CFILL, "foreground":acon.CFOREGROUND, "outline":acon.COUTLINE, "value":val, "text":txt} msb.define_aspect(i,val,d) self.add_control(param,msb) msb.layout((x,y)) msb.update_aspect() return msb
def msb_modscale(param,x,y): count = len(MODSCALES) msb = MSB(canvas,param,editor,count) for i in MODSCALES: j = i+1 value = 10**i d = {"fill" : CFILL, "foreground" : CFOREGROUND, "outline" : COUTLINE, "value" : value, "text" : "x%d" % j} msb.define_aspect(i,value,d) self.add_control(param,msb) msb.layout((x,y)) msb.update_aspect()
def msb_mod_scale(self,param,x,y): msb = MSB(self.canvas,param,self.editor,acon.MOD_RANGE_COUNT) for i in range(acon.MOD_RANGE_COUNT): j = i+1 value = 10**i d = {"fill" : acon.CFILL, "foreground" : acon.CFOREGROUND, "outline" : acon.COUTLINE, "value" : value, "text" : "x%d" % j} msb.define_aspect(i,value,d) self.add_control(param,msb) msb.layout((x,y)) msb.update_aspect() return msb
def _init_copy_button(self): msb = MSB(self.canvas, '', None, 1) a0 = self._msb_aspect("Copy") msb.define_aspect(0,0,a0) x,y = self.xi0+128, self.y1-50 msb.layout((x,y)) msb.update_aspect() def copy_callback(*_): program = self.synth.bank()[None] for k in self.clipboard.keys(): p = self.params[k] v = program[p] self.clipboard[k] = v self.status("Envelope copied to clipboard") msb.client_callback=copy_callback
def _init_paste_button(self): msb = MSB(self.canvas, '', None, 1) a0 = self._msb_aspect("Paste") msb.define_aspect(0,0,a0) x,y = self.xi0+192, self.y1-50 msb.layout((x,y)) msb.update_aspect() def paste_callback(*_): for k in self.clipboard.keys(): p = self.params[k] v = self.clipboard[k] self.set_synth_value(p,v) self.sync_ui() self.status("Envelope pasted from clipboard") msb.client_callback = paste_callback
def msb_ratio(n,x): param = "lfo%d_ratio" % n count = len(LFO_RATIOS) msb = MSB(canvas,param,editor,count) for i,pair in enumerate(LFO_RATIOS): value,txt = pair d = {"fill" : CFILL, "foreground" : CFOREGROUND, "outline" : COUTLINE, "value" : value, "text" : txt} msb.define_aspect(i,value,d) self.add_control(param, msb) msb.layout((x,y_msb)) msb.update_aspect() return msb
def _init_copy_button(self): msb = MSB(self.canvas, '', None, 1) a0 = self._msb_aspect("Copy") msb.define_aspect(0, 0, a0) x, y = self.xi0 + 128, self.y1 - 50 msb.layout((x, y)) msb.update_aspect() def copy_callback(*_): program = self.synth.bank()[None] for k in self.clipboard.keys(): p = self.params[k] v = program[p] self.clipboard[k] = v self.status("Envelope copied to clipboard") msb.client_callback = copy_callback
def _init_paste_button(self): msb = MSB(self.canvas, '', None, 1) a0 = self._msb_aspect("Paste") msb.define_aspect(0, 0, a0) x, y = self.xi0 + 192, self.y1 - 50 msb.layout((x, y)) msb.update_aspect() def paste_callback(*_): for k in self.clipboard.keys(): p = self.params[k] v = self.clipboard[k] self.set_synth_value(p, v) self.sync_ui() self.status("Envelope pasted from clipboard") msb.client_callback = paste_callback
def mute_button(param, x): b = MSB(canvas,param,self.editor,2) aoff = {'fill' : 'black', 'foreground' : 'gray', 'outline' : 'gray', 'text' : 'Mute'} aon = {'fill' : '#002e00', 'foreground' : 'white', 'outline' : '#096c00', 'text' : 'Mute'} b.define_aspect(0, 0, aoff) b.define_aspect(1, 1, aon) self.add_control(param,b) x = x + 8 b.layout(offset = (x,y_mute)) b.update_aspect() return b
def msb_mod_scale(self, param, x, y): msb = MSB(self.canvas, param, self.editor, acon.MOD_RANGE_COUNT) for i in range(acon.MOD_RANGE_COUNT): j = i + 1 value = 10**i d = { "fill": acon.CFILL, "foreground": acon.CFOREGROUND, "outline": acon.COUTLINE, "value": value, "text": "x%d" % j } msb.define_aspect(i, value, d) self.add_control(param, msb) msb.layout((x, y)) msb.update_aspect() return msb
def msb_lfo_ratio(self, param, x, y): count = len(acon.LFO_RATIOS) msb = MSB(self.canvas, param, self.editor, count) for i in range(count): val, txt = acon.LFO_RATIOS[i] d = { "fill": acon.CFILL, "foreground": acon.CFOREGROUND, "outline": acon.COUTLINE, "value": val, "text": txt } msb.define_aspect(i, val, d) self.add_control(param, msb) msb.layout((x, y)) msb.update_aspect() return msb
def mute_button(param, x): b = MSB(canvas,param,self.editor,2) aoff = {'fill' : 'black', 'foreground' : 'gray', 'outline' : 'gray', 'text' : 'Mute'} aon = {'fill' : '#002e00', 'foreground' : 'white', 'outline' : '#096c00', 'text' : 'Mute'} b.define_aspect(0, 0, aoff) b.define_aspect(1, 1, aon) self.add_control(param,b) x = x + 8 y = y_slider + slider_height + 40 b.layout(offset = (x,y)) b.update_aspect() return b
def msb_ratio(n, x): param = "lfo%d_ratio" % n count = len(LFO_RATIOS) msb = MSB(canvas, param, editor, count) for i, pair in enumerate(LFO_RATIOS): value, txt = pair d = { "fill": CFILL, "foreground": CFOREGROUND, "outline": COUTLINE, "value": value, "text": txt } msb.define_aspect(i, value, d) self.add_control(param, msb) msb.layout((x, y_msb)) msb.update_aspect() return msb
def _init_init_button(self): msb = MSB(self.canvas, '', None, 1) a0 = self._msb_aspect("Init") msb.define_aspect(0,0,a0) x,y = self.xi0+64, self.y1-50 msb.layout((x,y)) msb.update_aspect() def init_callback(*_): self.set_synth_value(self.params['attack'], 0.0) self.set_synth_value(self.params['decay1'], 0.0) self.set_synth_value(self.params['decay2'], 0.0) self.set_synth_value(self.params['release'], 0.0) self.set_synth_value(self.params['breakpoint'], 1.0) self.set_synth_value(self.params['sustain'], 1.0) self.set_synth_value(self.params['gate-mode'], 0) self.sync_ui() self.status("Reset envelope") msb.client_callback = init_callback
def _init_init_button(self): msb = MSB(self.canvas, '', None, 1) a0 = self._msb_aspect("Init") msb.define_aspect(0, 0, a0) x, y = self.xi0 + 64, self.y1 - 50 msb.layout((x, y)) msb.update_aspect() def init_callback(*_): self.set_synth_value(self.params['attack'], 0.0) self.set_synth_value(self.params['decay1'], 0.0) self.set_synth_value(self.params['decay2'], 0.0) self.set_synth_value(self.params['release'], 0.0) self.set_synth_value(self.params['breakpoint'], 1.0) self.set_synth_value(self.params['sustain'], 1.0) self.set_synth_value(self.params['gate-mode'], 0) self.sync_ui() self.status("Reset envelope") msb.client_callback = init_callback
def _init_zoom_button(self): msb = MSB(self.canvas, "", None, 3) a0 = self._msb_aspect("X1") a1 = self._msb_aspect("X10") a2 = self._msb_aspect("X100") msb.define_aspect(0, 1, a0) msb.define_aspect(1, 10, a1) msb.define_aspect(2, 100, a2) x, y = self.xi0 + 256, self.y1-50 msb.layout((x,y)) msb.value(1) msb.update_aspect() def zoom_callback(*_): self.zoom = msb.value() self.sync_ui() msb.client_callback = zoom_callback
def _init_zoom_button(self): msb = MSB(self.canvas, "", None, 3) a0 = self._msb_aspect("X1") a1 = self._msb_aspect("X10") a2 = self._msb_aspect("X100") msb.define_aspect(0, 1, a0) msb.define_aspect(1, 10, a1) msb.define_aspect(2, 100, a2) x, y = self.xi0 + 256, self.y1 - 50 msb.layout((x, y)) msb.value(1) msb.update_aspect() def zoom_callback(*_): self.zoom = msb.value() self.sync_ui() msb.client_callback = zoom_callback
def __init__(self, editor): frame = editor.create_tab(self.NAME, self.TAB_FILE) frame.config(background=factory.bg()) canvas = factory.canvas(frame, 760, 708, self.IMAGE_FILE) canvas.pack() self.canvas = canvas self.editor = editor TkSubEditor.__init__(self, canvas, editor, self.NAME) editor.add_child_editor(self.NAME, self) y0 = 50 x0 = 75 xres = x0 + 75 xenv = xres + 90 xattack = xenv + 75 xxmod = xattack + 208 xout = xxmod + 90 def norm_slider(param, x): s = cf.normalized_slider(canvas, param, editor) self.add_control(param, s) s.widget().place(x=x, y=y0) return s def volume_slider(param, x): # auto build indent, mover 1-> s = cf.volume_slider(canvas, param, editor) self.add_control(param, s) s.widget().place(x=x, y=y0) return s def linear_slider(param, range_, x): # auto build indent, mover 1-> s = cf.linear_slider(canvas, param, editor, range_=range_) # auto build missing closing ) self.add_control(param, s) s.widget().place(x=x, y=y0) return s def bipolar_slider(param, x): return linear_slider(param, (-1.0, +1.0), x) cfill = "black" cforeground = "#aae1aa" coutline = "blue" msb_filter = MSB(canvas, "filterFreq", editor, len(FILTER_FREQUENCIES)) for i, ff in enumerate(FILTER_FREQUENCIES): d = { "value": int(ff), "fill": cfill, "foreground": cforeground, "outline": coutline, "text": str(ff) } msb_filter.define_aspect(i, ff, d) self.add_control("filterFreq", msb_filter) msb_filter.layout((x0, y0)) msb_filter.update_aspect() msb_gain = MSB(canvas, "pregain", editor, len(GAINS)) for i, g in enumerate(GAINS): val, tx = g d = { "value": float(val), "fill": cfill, "foreground": cforeground, "outline": coutline, "text": tx } msb_gain.define_aspect(i, float(val), d) self.add_control("pregain", msb_gain) msb_gain.layout((xenv, y0)) msb_gain.update_aspect() norm_slider("res", xres) linear_slider("attack", (0.01, 4.0), xattack) linear_slider("release", (0.01, 4.0), xattack + 60) bipolar_slider("modDepth", xattack + 120) bipolar_slider("xmod", xxmod) volume_slider("dryamp", xout) volume_slider("wetamp", xout + 60)
def __init__(self, editor): frame = editor.create_tab(self.NAME,self.TAB_FILE) frame.config(background=factory.bg()) canvas = factory.canvas(frame, 1000, 700, self.IMAGE_FILE) canvas.pack() self.canvas = canvas self.editor = editor TkSubEditor.__init__(self, canvas, editor, self.NAME) editor.add_child_editor(self.NAME, self) cfill = "black" cforeground="#c79fa1" coutline="blue" csfill = "#005c56" csforeground = "white" y0 = 0 ysliders = y0+192 ywave = y0+128 yclock = ywave yfilter = yclock yrsenable = y0+200 x0 = 75 xgain = x0+60 xwave = x0+143 xclock = xwave+100 xfilter = xclock+100 xefx = xgain+395 xdry = xgain+455 def volume_slider(param,x,y): s = cf.volume_slider(canvas,param,editor) self.add_control(param,s) s.widget().place(x=x,y=y) return s def linear_slider(param,range_,x,y): s = cf.linear_slider(canvas,param,editor,range_=range_) self.add_control(param,s) s.widget().place(x=x,y=y) return s linear_slider("gain",(0,8),xgain,ysliders) msb_wave = MSB(canvas,"wave",editor, 5) for i,tx in enumerate(("Off","Soft","Clip","Fold","Wrap")): d = {"fill" : cfill, "foreground" : cforeground, "outline" : coutline, "value" : i, "text" : tx} msb_wave.define_aspect(i,i,d) msb_wave.layout((xwave,ywave)) msb_wave.update_aspect() msb_clock = MSB(canvas,"clockFreq",editor,len(CLOCK_FREQS)) for i,freq in enumerate(CLOCK_FREQS): ad = {"fill" : cfill, "foreground" : cforeground, "outline" : coutline, "text" : str(freq), "value" : freq} msb_clock.define_aspect(i,freq,ad) self.add_control("clockFreq",msb_clock) msb_clock.layout((xclock,yclock)) msb_clock.update_aspect() msb_filter = MSB(canvas,"low",editor, len(LP_FREQS)) for i,freq in enumerate(LP_FREQS): ad = {"fill" : cfill, "foreground" : cforeground, "outline" : coutline, "text" : str(freq), "value" : freq} msb_filter.define_aspect(i,freq,ad) self.add_control("low",msb_filter) msb_filter.layout((xfilter,yfilter)) msb_filter.update_aspect() volume_slider("wet",xefx,ysliders) volume_slider("dry",xdry,ysliders) tog_rs_enable = ToggleButton(canvas,"resampleEnable",editor, fill = cfill, foreground = cforeground, outline = coutline, selected_fill = csfill, selected_foreground = csforeground, text = ["Off","On"], values = [0,1]) self.add_control("resampleEnable", tog_rs_enable) tog_rs_enable.layout((xclock,yrsenable)) tog_rs_enable.update_aspect()
def __init__(self, editor): frame = editor.create_tab(self.NAME, self.TAB_FILE) frame.config(background=factory.bg()) canvas = factory.canvas(frame, 811, 700, self.IMAGE_FILE) canvas.pack() TkSubEditor.__init__(self, canvas, editor, self.NAME) editor.add_child_editor(self.NAME, self) y0 = 60 ypan = y0 + 350 ymod = ypan ymute = ymod + 150 yledger = ymute + 60 x0 = 120 xmain = x0 + 500 def fader(chan, x): param = "gain%s" % chan s = cf.volume_slider(canvas, param, editor) self.add_control(param, s) s.widget().place(x=x, y=y0, height=300) def panner(chan, x): param = "pan%s" % chan s = cf.bipolar_slider(canvas, param, editor) self.add_control(param, s) s.widget().place(x=x, y=ypan, height=100) def mod_depth(chan, x): param = "mod%s" % chan s = cf.normalized_slider(canvas, param, editor) self.add_control(param, s) s.widget().place(x=x, y=ymod, height=100) def entry(x): var = StringVar() e = factory.entry(canvas, var) e.place(x=x, y=yledger, width=74) for i, prefix in enumerate("ABCD"): chan = "%s" % prefix x = x0 + i * 120 x_pan = x x_mod = x + 60 fader(chan, x + 30) panner(chan, x_pan) mod_depth(chan, x_mod) aoff = { 'fill': 'black', 'foreground': 'gray', 'outline': 'gray', 'text': 'Mute' } aon = { 'fill': '#002e00', 'foreground': 'white', 'outline': '#096c00', 'text': 'Mute' } msb_mute = MSB(canvas, "mute%s" % prefix, editor, 2) self.add_control("mute%s" % prefix, msb_mute) msb_mute.define_aspect(0, 0, aoff) msb_mute.define_aspect(1, 1, aon) msb_mute.layout((x + 7, ymute)) msb_mute.update_aspect() entry(x) for i in range(2): x = xmain + i * 60 fader(str(i + 1), x)
def __init__(self, editor): frame = editor.create_tab(self.NAME, self.TAB_FILE) frame.config(background=factory.bg()) canvas = factory.canvas(frame,1000,700,self.IMAGE_FILE) canvas.pack() TkSubEditor.__init__(self, canvas, editor, self.NAME) editor.add_child_editor(self.NAME, self) y0 = 75 y1 = y0+60 y2 = y1+60 y3 = y2+70 x0=90 x1 = x0+100 x2 = x1+60 x3 = x2+60 x4 = x3+60 x5 = x4+75 x6 = x5+60 xlfo = x6+75 xmix = x6+196 def norm_slider(param, x, y): s = cf.normalized_slider(canvas, param, editor) self.add_control(param,s) s.widget().place(x=x,y=y) return s def bipolar_slider(param, x, y, height=150): s = cf.bipolar_slider(canvas, param, editor) self.add_control(param,s) s.widget().place(x=x,y=y,height=height) return s def amp_slider(param, x, y): s = cf.volume_slider(canvas, param, editor) self.add_control(param,s) s.widget().place(x=x,y=y) return s def linear_slider(param, x, y, range_): s = cf.linear_slider(canvas, param, editor, range_=range_) self.add_control(param,s) s.widget().place(x=x,y=y) return s msb_xover = MSB(canvas,"xover",editor,len(xcon.CROSSOVER_FREQUENCIES)) for i,v in enumerate(xcon.CROSSOVER_FREQUENCIES): d = _msb_aspect(v,str(v)) msb_xover.define_aspect(i,v,d) self.add_control("xover", msb_xover) msb_xover.layout((x0,y0)) msb_xover.update_aspect() msb_maxxover = MSB(canvas,"maxXover",editor,len(xcon.CROSSOVER_FREQUENCIES)) for i,v in enumerate(xcon.CROSSOVER_FREQUENCIES): d = _msb_aspect(v,str(v)) msb_maxxover.define_aspect(i,v,d) self.add_control("maxXover", msb_maxxover) msb_maxxover.layout((x0,y1)) msb_maxxover.update_aspect() msb_minxover = MSB(canvas,"minXover",editor,len(xcon.CROSSOVER_FREQUENCIES)) for i,v in enumerate(xcon.CROSSOVER_FREQUENCIES): d = _msb_aspect(v,str(v)) msb_minxover.define_aspect(i,v,d) self.add_control("minXover",msb_minxover) msb_minxover.layout((x0,y2)) msb_minxover.update_aspect() norm_slider("lfoToXover", x1,y0) msb_lforatio = MSB(canvas,"lfo2Ratio",editor,len(xcon.LFO_RATIOS)) for i,p in enumerate(xcon.LFO_RATIOS): ratio, text = p d = _msb_aspect(ratio,text) msb_lforatio.define_aspect(i,ratio,d) self.add_control("lfo2Ratio", msb_lforatio) msb_lforatio.layout((x1-22,y3)) msb_lforatio.update_aspect() norm_slider("lfo2Wave",x2,y0) norm_slider("externToXover",x3,y0) norm_slider("res",x4,y0) norm_slider("filterBMix",x5,y0) norm_slider("filterBLag",x6,y0) msb_b_ratio = MSB(canvas,"filterBRatio",editor,len(xcon.FILTER_B_RATIOS)) for i,p in enumerate(xcon.FILTER_B_RATIOS): ratio,text = p d = _msb_aspect(ratio,text) msb_b_ratio.define_aspect(i,ratio,d) self.add_control("filterBRatio", msb_b_ratio) msb_b_ratio.layout((x5+6,y3)) msb_b_ratio.update_aspect() tumbler = Tumbler(canvas,"lfoFreq",editor,digits=4,scale=0.01) self.add_control("lfoFreq", tumbler) tumbler.layout((xlfo, y1)) msb_lfo_enable = ToggleButton(canvas,"lfoEnable",editor, fill='',foreground='#c29378',outline='#c29378', active_color='yellow', selected_fill='#825151', selected_foreground='white') self.add_control("lfoEnable",msb_lfo_enable) msb_lfo_enable.layout((xlfo, y2)) msb_lfo_enable.update_aspect() amp_slider("dryAmp", xmix, y0) amp_slider("filterAAmp", xmix+60, y0) amp_slider("filterBAmp", xmix+120, y0) amp_slider("amp", xmix+180,y0) bipolar_slider("dryPan", xmix, y3) bipolar_slider("filterAPan", xmix+60, y3) bipolar_slider("filterBPan", xmix+120, y3) linear_slider("xscale", xlfo-7, y3, (0,4)) linear_slider("xbias", xlfo+53, y3, (-4,4))
def __init__(self, editor): frame = editor.create_tab(self.NAME,self.TAB_FILE) frame.config(background=factory.bg()) canvas = factory.canvas(frame, 1400, 700, self.IMAGE_FILE) canvas.pack() self.canvas = canvas self.editor = editor TkSubEditor.__init__(self, canvas, editor, self.NAME) editor.add_child_editor(self.NAME, self) y = [50,275] x0 = 100 xdelay = x0 + 180 xmod = xdelay+90 xfeedback = xmod+120 xeq = xfeedback+60 xmixer = xeq+150 def add_slider(param,s,x,y,width=14,height=150): self.add_control(param,s) s.widget().place(x=x,y=y,width=width,height=height) def amp_slider(param,x,y): s = cf.volume_slider(canvas,param,editor) add_slider(param,s,x,y) def bipolar_slider(param,x,y, width=14, height=150): s = cf.bipolar_slider(canvas,param,editor) add_slider(param,s,x,y,width,height) def eq_slider(param,x,y): s = cf.third_octave_slider(canvas,param,editor) add_slider(param,s,x,y) def norm_slider(param,x,y): s = cf.normalized_slider(canvas,param,editor) add_slider(param,s,x,y) def linear_slider(param,x,y,range_=(0.0,1.0)): s = cf.linear_slider(canvas,param,editor,range_=range_) add_slider(param,s,x,y) for i in (0,1): n = i+1 for j, p in enumerate(('d%dDry1In','d%dDry2In')): x = x0 + j*60 param = p % n amp_slider(param,x,y[i]) amp_slider('d2Delay1In',x0+60*2, y[1]) param = 'd%dDelayTime' % n tumbler_delay = Tumbler(canvas, param, editor, sign=False, digits=4,scale = 0.001, range_ = (0,2000)) self.add_control(param,tumbler_delay) tumbler_delay.layout((xdelay, y[i])) param = 'd%dLfoRatio' % n msb_lfo_ratio = MSB(canvas,param,editor,len(LFO_RATIOS)) self.add_control(param, msb_lfo_ratio) for k,pair in enumerate(LFO_RATIOS): adict = {'text' : pair[0], 'font' : ('Times', 12), 'fill' : 'black', 'foreground' : 'white', 'outline' : 'white', 'active-fill' : 'black', 'active-foreground' : 'yellow', 'active-outline' : 'yellow'} msb_lfo_ratio.define_aspect(k,pair[1],adict) msb_lfo_ratio.layout((xdelay, y[i]+75)) msb_lfo_ratio.update_aspect() norm_slider('d%dLfoModDepth' % n, xmod,y[i]) norm_slider('d%dExternalModDepth' % n, xmod+60,y[i]) bipolar_slider('d%dFeedback' % n, xfeedback,y[i]) eq_slider('d%dLowpass' % n, xeq,y[i]) eq_slider('d%dHighpass' % n, xeq+60,y[i]) # Mixer amp_slider("dry1Amp", xmixer, y[0]) amp_slider("dry2Amp", xmixer+60, y[0]) amp_slider("d1Amp", xmixer+120, y[0]) amp_slider("d2Amp", xmixer+180, y[0]) bipolar_slider("dry1Pan", xmixer, y[1],height=75) bipolar_slider("dry2Pan", xmixer+60, y[1],height=75) bipolar_slider("d1Pan", xmixer+120, y[1],height=75) bipolar_slider("d2Pan", xmixer+180, y[1],height=75) msb_lfo_preset = MSB(canvas,"",None,7) for i in range(len(msb_lfo_preset)): adict = {'fill' : 'black', 'foreground' : 'white', 'outline' : 'white', 'active-fill' : 'black', 'active-foregeround' : 'yellow', 'active-outline' : 'yellow', 'text' : str(i+1), 'fomt' : ('Times', 8)} msb_lfo_preset.define_aspect(i,i+1,adict) msb_lfo_preset.layout((xmixer+160, y[1]+143),width=18,height=18) msb_lfo_preset.update_aspect() def lfo_preset_freq(*_): v = msb_lfo_preset.value() synth = self.editor.synth synth.x_param_change("lfoCommonFreq",v) synth.bank()[None]["lfoCommonFreq"] = float(v) tumbler_lfo.value(v) msb_lfo_preset.tag_bind("<Button-1>", lfo_preset_freq) msb_lfo_preset.tag_bind("<Button-3>", lfo_preset_freq) tumbler_lfo = Tumbler(canvas,"lfoCommonFreq",editor, sign=False,digits=5, scale=0.001, range_=(0,16999)) self.add_control("lfoCommonFreq", tumbler_lfo) tumbler_lfo.layout((xmixer+60, y[1]+143))
def __init__(self, n, editor): name = "OP%d" % n image_file = "resources/Corvus/editor_%d.png" % n tab_file = "resources/Corvus/tab_%d.png" % n frame = editor.create_tab(name,tab_file) frame.config(background=factory.bg()) canvas = factory.canvas(frame, 1053, 663, image_file) canvas.pack() self.canvas = canvas self.editor = editor TkSubEditor.__init__(self, canvas, editor, name) editor.add_child_editor(name, self) self.op = n y0 = 50 y_carrier = y0 y_mod = y_carrier y_env = y0 + 250 x0 = 50 x_fm = x0 x_mod_lfo1 = x_fm + 100 x_mod_lfo2 = x_mod_lfo1 + 60 x_mod_external = x_mod_lfo2 + 60 x_mod_keyscale = x_mod_lfo2 + 100 x_mod_amp = x_mod_keyscale + 87 x_carrier = x_mod_amp + 100 x_ratio = x_carrier x_velocity = x_ratio+120 x_lfo1 = x_velocity+60 x_lfo2 = x_lfo1+60 x_external = x_lfo2+60 x_keyscale = x_external + 60 x_enable = x_keyscale + 90 x_env = x0-22 def norm_slider(param,x,y,height=150): s = cf.normalized_slider(canvas,param,editor) self.add_control(param,s) s.widget().place(x=x,y=y,height=height) return s def volume_slider(param,x,y,height=150): s = cf.volume_slider(canvas,param,editor) self.add_control(param,s) s.widget().place(x=x,y=y,height=height) return s def linear_slider(param,range_,x,y): s = cf.linear_slider(canvas,param,editor,range_=range_) self.add_control(param,s) s.widget().place(x=x,y=y) return s def tumbler(param,digits,scale,x,y): t = Tumbler(canvas,param,editor,digits=digits,scale=scale) self.add_control(param,t) t.layout((x,y)) t.update_aspect() return t def msb_keyscale(param,x,y): count = len(KEYSCALES) msb = MSB(canvas,param,editor,count) for i,s in enumerate(KEYSCALES): d = {"fill" : CFILL, "foreground" : CFOREGROUND, "outline" : COUTLINE, "value" : s, "text" : "%+d" % s} msb.define_aspect(i,s,d) self.add_control(param,msb) msb.layout((x,y)) msb.update_aspect() return msb def msb_keybreak(param,x,y): count = len(KEYBREAK) msb = MSB(canvas,param,editor,count) for i,s in enumerate(KEYBREAK): d = {"fill" : CFILL, "foreground" : CFOREGROUND, "outline" : COUTLINE, "value" : s, "text" : "%d" % s} msb.define_aspect(i,s,d) self.add_control(param,msb) msb.layout((x,y)) msb.update_aspect() return msb def msb_modscale(param,x,y): count = len(MODSCALES) msb = MSB(canvas,param,editor,count) for i in MODSCALES: j = i+1 value = 10**i d = {"fill" : CFILL, "foreground" : CFOREGROUND, "outline" : COUTLINE, "value" : value, "text" : "x%d" % j} msb.define_aspect(i,value,d) self.add_control(param,msb) msb.layout((x,y)) msb.update_aspect() tumbler("fm%d_ratio" % n,5,0.001,x_fm,y_mod) norm_slider("fm%d_lfo1" % n,x_mod_lfo1,y_mod) norm_slider("fm%d_lfo2" % n,x_mod_lfo2,y_mod) norm_slider("fm%d_external" % n, x_mod_external, y_mod) msb_keyscale("fm%d_left" % n, x_mod_keyscale, y_mod) msb_keyscale("fm%d_right" % n, x_mod_keyscale, y_mod+70) msb_modscale("fm%d_modscale" % n, x_mod_amp, y_mod) norm_slider("fm%d_moddepth" % n, x_mod_amp+24, y_mod+50, height=100) norm_slider("fm%d_lag" % n, x_fm+30,y_mod+75,height=75) tumbler("op%d_ratio" % n,5,0.001,x_ratio+8,y_carrier) tumbler("op%d_bias" % n,6,0.001,x_ratio,y_carrier+75) norm_slider("op%d_velocity" % n,x_velocity,y0) norm_slider("op%d_lfo1" % n,x_lfo1,y0) norm_slider("op%d_lfo2" % n,x_lfo2,y0) norm_slider("op%d_external" % n,x_external,y0) msb_keyscale("op%d_left" % n, x_keyscale,y0) msb_keyscale("op%d_right" % n, x_keyscale,y0+70) msb_keybreak("op%d_key" % n, x_keyscale,y0+140) penable = "op%d_enable" % n msb_enable = ToggleButton(canvas,penable, editor, fill = CFILL, foreground = CFOREGROUND, outline = COUTLINE, text = ["Off","Enabled"]) self.add_control(penable,msb_enable) msb_enable.layout((x_enable, y0)) msb_enable.update_aspect() volume_slider("op%d_amp" % n,x_enable+24,y0+50,height=100) env_parameters = [] for s in ("attack","decay1","decay2","release", "breakpoint","sustain","env_mode"): p = "op%d_%s" % (n,s) env_parameters.append(p) enved = ADDSREditor(canvas,n,(x_env,y_env), (800,350), env_parameters, editor, MAX_ENV_SEGMENT) self.add_child_editor("OP%dENV" % n, enved) enved.sync() y_extra = y_env+30 x_extra = x0 + 800 if n==3: # Add exgtra noise controls count = len(NOISE_BANDWIDTHS) msb = MSB(canvas,"nse3_bw",editor,count) for i,v in enumerate(NOISE_BANDWIDTHS): d = {"fill" : CFILL, "foreground" : CFOREGROUND, "outline" : COUTLINE, "value" : v, "text" : str(v)} msb.define_aspect(i,v,d) self.add_control("nse3_bw",msb) msb.layout((x_extra,y_extra)) msb.update_aspect() norm_slider("nse3_mix",x_extra+24, y_extra+75) if n==4: # Add buzz controls x_n = x_extra+16 x_env = x_n+60 x_lfo = x_env+60 x_lag = x_env x_mix = x_lag+60 linear_slider("bzz4_n",(1,128),x_n,y_extra) linear_slider("bzz4_env",(-128,128),x_env,y_extra) linear_slider("bzz4_lfo2",(0,128),x_lfo,y_extra) norm_slider("bzz4_lag",x_lag,y_extra+200, height=100) norm_slider("bzz4_mix",x_mix,y_extra+200, height=100)
def __init__(self, editor): name = "Misc" image_file = "resources/Corvus/editor_misc.png" tab_file = "resources/Tabs/misc.png" frame = editor.create_tab(name,tab_file) frame.config(background=factory.bg()) canvas = factory.canvas(frame, 1000, 750,image_file) canvas.pack() self.canvas = canvas self.editor = editor TkSubEditor.__init__(self, canvas, editor, name) editor.add_child_editor(name, self) self.op = n y0 = 50 y_msb = 230 x0 = 50 x_port = x0 x_vib = x_port+90 x_vdelay = x_vib+90 x_vsens = x_vdelay+60 x_vdepth = x_vsens+60 x_xpitch = x_vdepth+60 x_lfo1 = x_xpitch+90 x_lfo2 = x_lfo1 + 90 x_amp = x_lfo2 + 90 def norm_slider(param,x,y,height=150): s = cf.normalized_slider(canvas,param,editor) self.add_control(param,s) s.widget().place(x=x,y=y,height=height) return s def volume_slider(param,x,y,height=150): s = cf.volume_slider(canvas,param,editor) self.add_control(param,s) s.widget().place(x=x,y=y,height=height) return s def linear_slider(param,range_,x,y): s = cf.linear_slider(canvas,param,editor,range_=range_) self.add_control(param,s) s.widget().place(x=x,y=y) return s def tumbler(param,digits,scale,x,y): t = Tumbler(canvas,param,editor,digits=digits,scale=scale) self.add_control(param,t) t.layout((x,y)) t.update_aspect() return t def msb_ratio(n,x): param = "lfo%d_ratio" % n count = len(LFO_RATIOS) msb = MSB(canvas,param,editor,count) for i,pair in enumerate(LFO_RATIOS): value,txt = pair d = {"fill" : CFILL, "foreground" : CFOREGROUND, "outline" : COUTLINE, "value" : value, "text" : txt} msb.define_aspect(i,value,d) self.add_control(param, msb) msb.layout((x,y_msb)) msb.update_aspect() return msb norm_slider("port",x_port,y0) tumbler("vfreq",5,0.001,x_vib,y0) linear_slider("vdelay",(0,4),x_vdelay,y0) norm_slider("vsens",x_vsens,y0) norm_slider("vdepth",x_vdepth,y0) norm_slider("xpitch",x_xpitch,y0) linear_slider("lfo1_delay",(0,4),x_lfo1,y0) msb_ratio(1,x_lfo1-22) linear_slider("lfo2_delay",(0,4),x_lfo2,y0) msb_ratio(2,x_lfo2-22) volume_slider("amp",x_amp,y0) y_penv = 375 y_buttons = y_penv+200 x_penv = x0 for a in (0,1,2,3,4): x = x_penv + a*60 linear_slider("pe_a%d" % a, (-1.0,1.0),x,y_penv) x += 60 for t in (1,2,3,4): x = x+60 linear_slider("pe_t%d" % t, (0,MAX_ENV_SEGMENT),x,y_penv) x += 60 x_send = x for i in (1,2,3,4): x += 60 linear_slider("op%d_pe" % i,(-1,1),x,y_penv) count = len(PENV_HOLD_NODES) msb_loop = MSB(canvas,"pe_loop",editor,count) for i,v in enumerate(PENV_LOOP_NODES): d = {"fill" : CFILL, "foreground" : CFOREGROUND, "outline" : COUTLINE, "value" : v, "text" : str(v)} msb_loop.define_aspect(i,v,d) self.add_control("pe_loop",msb_loop) msb_loop.layout((x_penv, y_buttons)) msb_loop.update_aspect() def zero_levels(): for a in (0,1,2,3,4): p = "pe_a%d" % a self.set_value(p,0.0) self.sync() def zero_sends(): for a in (1,2,3,4): p = "op%d_pe" % a self.set_value(p,0.0) self.sync() b1 = factory.button(canvas,"0", command=zero_levels) b1.place(x=x_penv+120,y=y_buttons) b2 = factory.button(canvas,"0",command=zero_sends) b2.place(x=x_send+49,y=y_buttons)
def __init__(self, editor): frame = editor.create_tab(self.NAME,self.TAB_FILE) frame.config(background=factory.bg()) canvas = factory.canvas(frame, 741,700, self.IMAGE_FILE) canvas.pack() self.canvas = canvas self.editor = editor TkSubEditor.__init__(self, canvas, editor, self.NAME) editor.add_child_editor(self.NAME, self) y0 = 50 x0 = 75 xfilter = x0+130 xmod = xfilter+90 xattack = xmod + 90 xrelease = xattack + 60 xdry = xrelease+90 xwet = xdry+60 def norm_slider(param,x): s = cf.normalized_slider(canvas,param,editor) self.add_control(param,s) s.widget().place(x=x,y=y0) return s def volume_slider(param,x): s = cf.volume_slider(canvas,param,editor) self.add_control(param,s) s.widget().place(x=x,y=y0) return s def linear_slider(param,range_,x): s = cf.linear_slider(canvas,param,editor,range_=range_) self.add_control(param,s) s.widget().place(x=x,y=y0) return s t_freq = Tumbler(canvas,"fixedFrequency",editor, digits = 4, scale=0.01) t_track = Tumbler(canvas,"keyTrack",editor, digits=2, scale=1, range_=(0,16)) self.add_control("fixedFrequency",t_freq) self.add_control("keyTrack",t_track) t_freq.layout((x0+25,y0+25)) t_track.layout((x0+40,y0+100)) cfill = 'black' cforeground = 'white' coutline = 'white' msb_filter = MSB(canvas,"inputFilter",editor,len(FILTER_VALUES)) for i,v in enumerate(FILTER_VALUES): k = v/1000 tx = "%dk" % k d = {"fill" : cfill, "foreground" : cforeground, "outline" : coutline, "value" : v, "text" : tx} msb_filter.define_aspect(i,v,d) self.add_control("inputFilter",msb_filter) msb_filter.layout((xfilter,y0+25)) msb_filter.update_aspect() msb_gain = MSB(canvas,"inputGain",editor,MAX_INPUT_GAIN_MAGNITUDE) for i in range(MAX_INPUT_GAIN_MAGNITUDE): j = i+1 v = 10**i tx = "x%d" % j d = {"fill" : cfill, "foreground" : cforeground, "outline" : coutline, "value" : v, "text" : tx} msb_gain.define_aspect(i,v,d) self.add_control("inputGain",msb_gain) msb_gain.layout((xfilter,y0+100)) msb_gain.update_aspect() norm_slider("modDepth",xmod) linear_slider("attack",(0,4),xattack) linear_slider("release",(0,4),xrelease) msb_env = ToggleButton(canvas,"envelopeSelect",editor, text=("Follow","ASR"), values = (0,1), fill=cfill, selected_fill = cfill, foreground=cforeground, selected_foreground=cforeground, outline=coutline) self.add_control("envelopeSelect",msb_env) msb_env.layout((xattack+8,y0+200)) msb_env.update_aspect() volume_slider("dryAmp",xdry) volume_slider("wetAmp",xwet)
def __init__(self, editor): frame = editor.create_tab(self.NAME,self.TAB_FILE) frame.config(background=factory.bg()) canvas = factory.canvas(frame, 760, 708,self.IMAGE_FILE) canvas.pack() self.canvas = canvas self.editor = editor TkSubEditor.__init__(self, canvas, editor, self.NAME) editor.add_child_editor(self.NAME, self) y0 = 50 x0 = 75 xres = x0+75 xenv = xres+90 xattack = xenv+75 xxmod = xattack+208 xout = xxmod+90 def norm_slider(param,x): s = cf.normalized_slider(canvas,param,editor) self.add_control(param,s) s.widget().place(x=x,y=y0) return s def volume_slider(param,x): # auto build indent, mover 1-> s = cf.volume_slider(canvas,param,editor) self.add_control(param,s) s.widget().place(x=x,y=y0) return s def linear_slider(param,range_,x): # auto build indent, mover 1-> s = cf.linear_slider(canvas,param,editor,range_=range_) # auto build missing closing ) self.add_control(param,s) s.widget().place(x=x,y=y0) return s def bipolar_slider(param,x): return linear_slider(param,(-1.0,+1.0),x) cfill = "black" cforeground="#aae1aa" coutline="blue" msb_filter = MSB(canvas,"filterFreq",editor,len(FILTER_FREQUENCIES)) for i,ff in enumerate(FILTER_FREQUENCIES): d = {"value":int(ff), "fill" : cfill, "foreground" : cforeground, "outline" : coutline, "text" : str(ff)} msb_filter.define_aspect(i,ff,d) self.add_control("filterFreq",msb_filter) msb_filter.layout((x0,y0)) msb_filter.update_aspect() msb_gain = MSB(canvas,"pregain",editor,len(GAINS)) for i,g in enumerate(GAINS): val,tx = g d = {"value":float(val), "fill" : cfill, "foreground" : cforeground, "outline" : coutline, "text" : tx} msb_gain.define_aspect(i,float(val),d) self.add_control("pregain",msb_gain) msb_gain.layout((xenv,y0)) msb_gain.update_aspect() norm_slider("res",xres) linear_slider("attack",(0.01,4.0),xattack) linear_slider("release",(0.01,4.0),xattack+60) bipolar_slider("modDepth",xattack+120) bipolar_slider("xmod",xxmod) volume_slider("dryamp",xout) volume_slider("wetamp",xout+60)
def __init__(self, editor): frame = editor.create_tab(self.NAME,self.TAB_FILE) frame.config(background=factory.bg()) canvas = factory.canvas(frame, 700, 250, self.IMAGE_FILE) canvas.pack() self.canvas = canvas self.editor = editor TkSubEditor.__init__(self, canvas, editor, self.NAME) editor.add_child_editor(self.NAME, self) y0 = 100 ymsb = y0 ytumbler = y0 ylag = y0-18 x0 = 75 xwave = x0+25 xpol = xwave + 100 xclip = xpol + 100 xlag = xclip + 100 xscale = xlag + 50 xbias = xscale + 100 cfill = "black" cforeground = "white" coutline = "white" def norm_slider(param,x,y): s = cf.normalized_slider(canvas,param,editor) self.add_control(param,s) s.widget().place(x=x,y=y, width=10, height=75) return s # def volume_slider(param,x): # s = cf.volume_slider(canvas,param,editor) # self.add_control(param,s) # s.widget().place(x=x,y=y0) # return s # def linear_slider(param,range_,x): # s = cf.linear_slider(canvas,param,editor,range_=range_) # self.add_control(param,s) # s.widget().place(x=x,y=y0) # return s def tumbler(param,x,y): t = Tumbler(canvas,param,editor,digits=3,scale = 0.01,sign=True) self.add_control(param,t) t.layout((x,y)) t.update_aspect() return t WAVES = ("off","abs","cube") msb_wave = MSB(canvas,"wave",editor,len(WAVES)) for i,w in enumerate(WAVES): d = {"fill":cfill, "foreground":cforeground, "outline":coutline, "value":i, "text":w} msb_wave.define_aspect(i,i,d) self.add_control("wave",msb_wave) msb_wave.layout((xwave,ymsb)) msb_wave.update_aspect() POLS = ("off","->bipolar","->polar") msb_pol = MSB(canvas,"polarityComp",editor,len(POLS)) for i,w in enumerate(POLS): d = {"fill":cfill, "foreground":cforeground, "outline":coutline, "value":i, "text":w} msb_pol.define_aspect(i,i,d) self.add_control("polarityComp",msb_pol) msb_pol.layout((xpol,ymsb)) msb_pol.update_aspect() tumbler("clipMax",xclip,ytumbler-10) tumbler("clipMin",xclip,ytumbler+14) norm_slider("lag",xlag,ylag) tumbler("scale",xscale,ytumbler) tumbler("bias",xbias,ytumbler)
def __init__(self, editor): name = "Misc" image_file = "resources/Corvus/editor_misc.png" tab_file = "resources/Tabs/misc.png" frame = editor.create_tab(name, tab_file) frame.config(background=factory.bg()) canvas = factory.canvas(frame, 1000, 750, image_file) canvas.pack() self.canvas = canvas self.editor = editor TkSubEditor.__init__(self, canvas, editor, name) editor.add_child_editor(name, self) self.op = n y0 = 50 y_msb = 230 x0 = 50 x_port = x0 x_vib = x_port + 90 x_vdelay = x_vib + 90 x_vsens = x_vdelay + 60 x_vdepth = x_vsens + 60 x_xpitch = x_vdepth + 60 x_lfo1 = x_xpitch + 90 x_lfo2 = x_lfo1 + 90 x_amp = x_lfo2 + 90 def norm_slider(param, x, y, height=150): s = cf.normalized_slider(canvas, param, editor) self.add_control(param, s) s.widget().place(x=x, y=y, height=height) return s def volume_slider(param, x, y, height=150): s = cf.volume_slider(canvas, param, editor) self.add_control(param, s) s.widget().place(x=x, y=y, height=height) return s def linear_slider(param, range_, x, y): s = cf.linear_slider(canvas, param, editor, range_=range_) self.add_control(param, s) s.widget().place(x=x, y=y) return s def tumbler(param, digits, scale, x, y): t = Tumbler(canvas, param, editor, digits=digits, scale=scale) self.add_control(param, t) t.layout((x, y)) t.update_aspect() return t def msb_ratio(n, x): param = "lfo%d_ratio" % n count = len(LFO_RATIOS) msb = MSB(canvas, param, editor, count) for i, pair in enumerate(LFO_RATIOS): value, txt = pair d = { "fill": CFILL, "foreground": CFOREGROUND, "outline": COUTLINE, "value": value, "text": txt } msb.define_aspect(i, value, d) self.add_control(param, msb) msb.layout((x, y_msb)) msb.update_aspect() return msb norm_slider("port", x_port, y0) tumbler("vfreq", 5, 0.001, x_vib, y0) linear_slider("vdelay", (0, 4), x_vdelay, y0) norm_slider("vsens", x_vsens, y0) norm_slider("vdepth", x_vdepth, y0) norm_slider("xpitch", x_xpitch, y0) linear_slider("lfo1_delay", (0, 4), x_lfo1, y0) msb_ratio(1, x_lfo1 - 22) linear_slider("lfo2_delay", (0, 4), x_lfo2, y0) msb_ratio(2, x_lfo2 - 22) volume_slider("amp", x_amp, y0) y_penv = 375 y_buttons = y_penv + 200 x_penv = x0 for a in (0, 1, 2, 3, 4): x = x_penv + a * 60 linear_slider("pe_a%d" % a, (-1.0, 1.0), x, y_penv) x += 60 for t in (1, 2, 3, 4): x = x + 60 linear_slider("pe_t%d" % t, (0, MAX_ENV_SEGMENT), x, y_penv) x += 60 x_send = x for i in (1, 2, 3, 4): x += 60 linear_slider("op%d_pe" % i, (-1, 1), x, y_penv) count = len(PENV_HOLD_NODES) msb_loop = MSB(canvas, "pe_loop", editor, count) for i, v in enumerate(PENV_LOOP_NODES): d = { "fill": CFILL, "foreground": CFOREGROUND, "outline": COUTLINE, "value": v, "text": str(v) } msb_loop.define_aspect(i, v, d) self.add_control("pe_loop", msb_loop) msb_loop.layout((x_penv, y_buttons)) msb_loop.update_aspect() def zero_levels(): for a in (0, 1, 2, 3, 4): p = "pe_a%d" % a self.set_value(p, 0.0) self.sync() def zero_sends(): for a in (1, 2, 3, 4): p = "op%d_pe" % a self.set_value(p, 0.0) self.sync() b1 = factory.button(canvas, "0", command=zero_levels) b1.place(x=x_penv + 120, y=y_buttons) b2 = factory.button(canvas, "0", command=zero_sends) b2.place(x=x_send + 49, y=y_buttons)
def __init__(self, n, editor): name = "OP%d" % n image_file = "resources/Corvus/editor_%d.png" % n tab_file = "resources/Corvus/tab_%d.png" % n frame = editor.create_tab(name, tab_file) frame.config(background=factory.bg()) canvas = factory.canvas(frame, 1053, 663, image_file) canvas.pack() self.canvas = canvas self.editor = editor TkSubEditor.__init__(self, canvas, editor, name) editor.add_child_editor(name, self) self.op = n y0 = 50 y_carrier = y0 y_mod = y_carrier y_env = y0 + 250 x0 = 50 x_fm = x0 x_mod_lfo1 = x_fm + 100 x_mod_lfo2 = x_mod_lfo1 + 60 x_mod_external = x_mod_lfo2 + 60 x_mod_keyscale = x_mod_lfo2 + 100 x_mod_amp = x_mod_keyscale + 87 x_carrier = x_mod_amp + 100 x_ratio = x_carrier x_velocity = x_ratio + 120 x_lfo1 = x_velocity + 60 x_lfo2 = x_lfo1 + 60 x_external = x_lfo2 + 60 x_keyscale = x_external + 60 x_enable = x_keyscale + 90 x_env = x0 - 22 def norm_slider(param, x, y, height=150): s = cf.normalized_slider(canvas, param, editor) self.add_control(param, s) s.widget().place(x=x, y=y, height=height) return s def volume_slider(param, x, y, height=150): s = cf.volume_slider(canvas, param, editor) self.add_control(param, s) s.widget().place(x=x, y=y, height=height) return s def linear_slider(param, range_, x, y): s = cf.linear_slider(canvas, param, editor, range_=range_) self.add_control(param, s) s.widget().place(x=x, y=y) return s def tumbler(param, digits, scale, x, y): t = Tumbler(canvas, param, editor, digits=digits, scale=scale) self.add_control(param, t) t.layout((x, y)) t.update_aspect() return t def msb_keyscale(param, x, y): count = len(KEYSCALES) msb = MSB(canvas, param, editor, count) for i, s in enumerate(KEYSCALES): d = { "fill": CFILL, "foreground": CFOREGROUND, "outline": COUTLINE, "value": s, "text": "%+d" % s } msb.define_aspect(i, s, d) self.add_control(param, msb) msb.layout((x, y)) msb.update_aspect() return msb def msb_keybreak(param, x, y): count = len(KEYBREAK) msb = MSB(canvas, param, editor, count) for i, s in enumerate(KEYBREAK): d = { "fill": CFILL, "foreground": CFOREGROUND, "outline": COUTLINE, "value": s, "text": "%d" % s } msb.define_aspect(i, s, d) self.add_control(param, msb) msb.layout((x, y)) msb.update_aspect() return msb def msb_modscale(param, x, y): count = len(MODSCALES) msb = MSB(canvas, param, editor, count) for i in MODSCALES: j = i + 1 value = 10**i d = { "fill": CFILL, "foreground": CFOREGROUND, "outline": COUTLINE, "value": value, "text": "x%d" % j } msb.define_aspect(i, value, d) self.add_control(param, msb) msb.layout((x, y)) msb.update_aspect() tumbler("fm%d_ratio" % n, 5, 0.001, x_fm, y_mod) norm_slider("fm%d_lfo1" % n, x_mod_lfo1, y_mod) norm_slider("fm%d_lfo2" % n, x_mod_lfo2, y_mod) norm_slider("fm%d_external" % n, x_mod_external, y_mod) msb_keyscale("fm%d_left" % n, x_mod_keyscale, y_mod) msb_keyscale("fm%d_right" % n, x_mod_keyscale, y_mod + 70) msb_modscale("fm%d_modscale" % n, x_mod_amp, y_mod) norm_slider("fm%d_moddepth" % n, x_mod_amp + 24, y_mod + 50, height=100) norm_slider("fm%d_lag" % n, x_fm + 30, y_mod + 75, height=75) tumbler("op%d_ratio" % n, 5, 0.001, x_ratio + 8, y_carrier) tumbler("op%d_bias" % n, 6, 0.001, x_ratio, y_carrier + 75) norm_slider("op%d_velocity" % n, x_velocity, y0) norm_slider("op%d_lfo1" % n, x_lfo1, y0) norm_slider("op%d_lfo2" % n, x_lfo2, y0) norm_slider("op%d_external" % n, x_external, y0) msb_keyscale("op%d_left" % n, x_keyscale, y0) msb_keyscale("op%d_right" % n, x_keyscale, y0 + 70) msb_keybreak("op%d_key" % n, x_keyscale, y0 + 140) penable = "op%d_enable" % n msb_enable = ToggleButton(canvas, penable, editor, fill=CFILL, foreground=CFOREGROUND, outline=COUTLINE, text=["Off", "Enabled"]) self.add_control(penable, msb_enable) msb_enable.layout((x_enable, y0)) msb_enable.update_aspect() volume_slider("op%d_amp" % n, x_enable + 24, y0 + 50, height=100) env_parameters = [] for s in ("attack", "decay1", "decay2", "release", "breakpoint", "sustain", "env_mode"): p = "op%d_%s" % (n, s) env_parameters.append(p) enved = ADDSREditor(canvas, n, (x_env, y_env), (800, 350), env_parameters, editor, MAX_ENV_SEGMENT) self.add_child_editor("OP%dENV" % n, enved) enved.sync() y_extra = y_env + 30 x_extra = x0 + 800 if n == 3: # Add exgtra noise controls count = len(NOISE_BANDWIDTHS) msb = MSB(canvas, "nse3_bw", editor, count) for i, v in enumerate(NOISE_BANDWIDTHS): d = { "fill": CFILL, "foreground": CFOREGROUND, "outline": COUTLINE, "value": v, "text": str(v) } msb.define_aspect(i, v, d) self.add_control("nse3_bw", msb) msb.layout((x_extra, y_extra)) msb.update_aspect() norm_slider("nse3_mix", x_extra + 24, y_extra + 75) if n == 4: # Add buzz controls x_n = x_extra + 16 x_env = x_n + 60 x_lfo = x_env + 60 x_lag = x_env x_mix = x_lag + 60 linear_slider("bzz4_n", (1, 128), x_n, y_extra) linear_slider("bzz4_env", (-128, 128), x_env, y_extra) linear_slider("bzz4_lfo2", (0, 128), x_lfo, y_extra) norm_slider("bzz4_lag", x_lag, y_extra + 200, height=100) norm_slider("bzz4_mix", x_mix, y_extra + 200, height=100)
def __init__(self, editor): frame = editor.create_tab(self.NAME,self.TAB_FILE) frame.config(background=factory.bg()) canvas = factory.canvas(frame, 811,700,self.IMAGE_FILE) canvas.pack() TkSubEditor.__init__(self, canvas, editor, self.NAME) editor.add_child_editor(self.NAME, self) y0 = 60 ypan = y0 + 350 ymod = ypan ymute = ymod + 150 yledger = ymute+60 x0 = 120 xmain = x0+500 def fader(chan, x): param = "gain%s" % chan s = cf.volume_slider(canvas, param, editor) self.add_control(param,s) s.widget().place(x=x, y=y0, height=300) def panner(chan, x): param = "pan%s" % chan s = cf.bipolar_slider(canvas,param,editor) self.add_control(param,s) s.widget().place(x=x, y=ypan, height=100) def mod_depth(chan, x): param = "mod%s" % chan s = cf.normalized_slider(canvas, param, editor) self.add_control(param, s) s.widget().place(x=x, y=ymod, height=100) def entry(x): var = StringVar() e = factory.entry(canvas,var) e.place(x=x,y=yledger, width=74) for i,prefix in enumerate("ABCD"): chan = "%s" % prefix x = x0 + i * 120 x_pan = x x_mod = x+60 fader(chan, x+30) panner(chan, x_pan) mod_depth(chan, x_mod) aoff = {'fill' : 'black', 'foreground' : 'gray', 'outline' : 'gray', 'text' : 'Mute'} aon = {'fill' : '#002e00', 'foreground' : 'white', 'outline' : '#096c00', 'text' : 'Mute'} msb_mute = MSB(canvas,"mute%s"%prefix,editor,2) self.add_control("mute%s"%prefix,msb_mute) msb_mute.define_aspect(0,0,aoff) msb_mute.define_aspect(1,1,aon) msb_mute.layout((x+7,ymute)) msb_mute.update_aspect() entry(x) for i in range(2): x = xmain + i*60 fader(str(i+1), x)
def __init__(self, editor): frame = editor.create_tab(self.NAME, self.TAB_FILE) frame.config(background=factory.bg()) canvas = factory.canvas(frame, 1000, 700, self.IMAGE_FILE) canvas.pack() self.canvas = canvas self.editor = editor TkSubEditor.__init__(self, canvas, editor, self.NAME) editor.add_child_editor(self.NAME, self) cfill = "black" cforeground = "#c79fa1" coutline = "blue" csfill = "#005c56" csforeground = "white" y0 = 0 ysliders = y0 + 192 ywave = y0 + 128 yclock = ywave yfilter = yclock yrsenable = y0 + 200 x0 = 75 xgain = x0 + 60 xwave = x0 + 143 xclock = xwave + 100 xfilter = xclock + 100 xefx = xgain + 395 xdry = xgain + 455 def volume_slider(param, x, y): s = cf.volume_slider(canvas, param, editor) self.add_control(param, s) s.widget().place(x=x, y=y) return s def linear_slider(param, range_, x, y): s = cf.linear_slider(canvas, param, editor, range_=range_) self.add_control(param, s) s.widget().place(x=x, y=y) return s linear_slider("gain", (0, 8), xgain, ysliders) msb_wave = MSB(canvas, "wave", editor, 5) for i, tx in enumerate(("Off", "Soft", "Clip", "Fold", "Wrap")): d = { "fill": cfill, "foreground": cforeground, "outline": coutline, "value": i, "text": tx } msb_wave.define_aspect(i, i, d) msb_wave.layout((xwave, ywave)) msb_wave.update_aspect() msb_clock = MSB(canvas, "clockFreq", editor, len(CLOCK_FREQS)) for i, freq in enumerate(CLOCK_FREQS): ad = { "fill": cfill, "foreground": cforeground, "outline": coutline, "text": str(freq), "value": freq } msb_clock.define_aspect(i, freq, ad) self.add_control("clockFreq", msb_clock) msb_clock.layout((xclock, yclock)) msb_clock.update_aspect() msb_filter = MSB(canvas, "low", editor, len(LP_FREQS)) for i, freq in enumerate(LP_FREQS): ad = { "fill": cfill, "foreground": cforeground, "outline": coutline, "text": str(freq), "value": freq } msb_filter.define_aspect(i, freq, ad) self.add_control("low", msb_filter) msb_filter.layout((xfilter, yfilter)) msb_filter.update_aspect() volume_slider("wet", xefx, ysliders) volume_slider("dry", xdry, ysliders) tog_rs_enable = ToggleButton(canvas, "resampleEnable", editor, fill=cfill, foreground=cforeground, outline=coutline, selected_fill=csfill, selected_foreground=csforeground, text=["Off", "On"], values=[0, 1]) self.add_control("resampleEnable", tog_rs_enable) tog_rs_enable.layout((xclock, yrsenable)) tog_rs_enable.update_aspect()