def mixer(slot, name, chanA = [-99, 0.0, 0.0, 0], # [gain(db), mod-depth, pan, mute] chanB = [-99, 0.0, 0.0, 0], chanC = [-99, 0.0, 0.0, 0], chanD = [-99, 0.0, 0.0, 0], main = [0,0]): program=Mixer(name) def fill_channel_list(lst): acc = [] for i,dflt in enumerate([-99.0, 0.0, 0.0, 0]): try: acc.append(float(lst[i])) except (IndexError,ValueError,TypeError): acc.append(dflt) return acc def set_channel_params(prefix,chanlist): program["gain%s" % prefix] = db_to_amp(chanlist[0]) program["mod%s" % prefix] = chanlist[1] program["pan%s" % prefix] = chanlist[2] program["mute%s" % prefix] = chanlist[3] set_channel_params("A", fill_channel_list(chanA)) set_channel_params("B", fill_channel_list(chanB)) set_channel_params("C", fill_channel_list(chanC)) set_channel_params("D", fill_channel_list(chanD)) program["gain1"]=float(db_to_amp(main[0])) program["gain2"]=float(db_to_amp(main[1])) program_bank[slot] = program return program
def asplit(slot, name, gainA=0, gainB=0, gainC=0, gainD=0, gain=0, unmuteA=1, unmuteB=1, unmuteC=1, unmuteD=1, unmute=1): p = ASplit(name) p["gainA"] = float(db_to_amp(gainA)) p["gainB"] = float(db_to_amp(gainB)) p["gainC"] = float(db_to_amp(gainC)) p["gainD"] = float(db_to_amp(gainD)) p['gain'] = float(db_to_amp(gain)) p['unmuteA'] = int(unmuteA) p['unmuteB'] = int(unmuteB) p['unmuteC'] = int(unmuteC) p['unmuteD'] = int(unmuteD) p['unmute'] = int(unmute) program_bank[slot] = p return p
def mix(osc1=0, osc2=0, osc3=0, noise=-99, osc1Env1 = 0.0, osc2Env1 = 0.0, osc3Env1 = 0.0, noiseEnv1 = 0.0): return {"osc1Amp" : db_to_amp(osc1), "osc2Amp" : db_to_amp(osc2), "osc3Amp" : db_to_amp(osc3), "noiseAmp" : db_to_amp(noise), "osc1Amp_env1" : nclip(osc1Env1), "osc2Amp_env1" : nclip(osc2Env1), "osc3Amp_env1" : nclip(osc3Env1), "noiseAmp_env1" : nclip(noiseEnv1)}
def volume_aspect_to_amp(va): """ Convwerts controller aspect to gain factor. Used with slider like volume controls. The response has several distinct regions: 199 - +6db 181 to 198 - +3db 179 to 180 - 0db 81 to 178 - -12db to 0db 1 to 80 - -48db to -12db 0 - -infinity db """ if 191 <= va: db = 6 elif 181 <= va: db = 3 elif 171 <= va: db = 0 elif 81 <= va: db = int(0.135 * va -23) elif 1 <= va: db = int(0.462 * va -48.462) else: return 0.0 amp = float(db_to_amp(db)) return amp
def flngr(slot, name, amp=0, delay=0.5, modDepth=0.5, modFreq=1.0, feedback=0.5, loweq=10000, higheq=10, efxMix=0.5, xmodDepth=0, xmixScale=0): p = Flngr(name) p["delay"] = clip(float(delay), 0, 1) p["imodDepth"] = clip(float(modDepth), 0, 1) p["imodFreq"] = abs(float(modFreq)) p["feedback"] = clip(float(feedback), -1, 1) p["feedbackLowpass"] = clip(int(loweq), 20, 20000) p["feedbackHighpass"] = clip(int(higheq), 20, 20000) p["efxMix"] = clip(float(efxMix), 0, 1) p["xmodDepth"] = clip(float(xmodDepth), 0, 1) p["xmixScale"] = clip(float(xmixScale), 0, 1) p["amp"] = float(db_to_amp(amp)) program_bank[slot] = p return p
def carnal(slot, name, amp=-12, delayTime = 0.125, xDelay = 0.0, wow = 0.0, wowFreq = 1.0, flutter = 0, feedback = 0.5, gain = 1.0, threshold = 1.0, eq = [10000, 100], # [lowpass, highpass] wetMix = 0.5, xWetMix = 0.0): p = CarnalDelay(name) p["delayTime"] = float(clip(delayTime, 0, MAX_DELAY)) p["wow"] = float(clip(wow, 0, 1)) p["wowFreq"] = float(clip(wowFreq, 0.1, 5)) p["flutter"] = float(clip(flutter, 0, 1)) p["xDelayMod"] = float(clip(xDelay, 0, 1)) p["feedback"] = float(clip(feedback, 0, 1)) p["gain"] = float(clip(gain, 0.5, 2)) p["threshold"] = float(clip(threshold, 0, 1)) p["lowcut"] = int(clip(eq[0], 20, 20000)) p["highcut"] = int(clip(eq[1], 20, 20000)) p["efxMix"] = float(clip(wetMix, 0, 1)) p["xEfxMix"] = float(clip(xWetMix, 0, 1)) p["amp"] = float(clip(db_to_amp(amp), 0, 2)) program_bank[slot] = p return p
def carnal( slot, name, amp=-12, delayTime=0.125, xDelay=0.0, wow=0.0, wowFreq=1.0, flutter=0, feedback=0.5, gain=1.0, threshold=1.0, eq=[10000, 100], # [lowpass, highpass] wetMix=0.5, xWetMix=0.0): p = CarnalDelay(name) p["delayTime"] = float(clip(delayTime, 0, MAX_DELAY)) p["wow"] = float(clip(wow, 0, 1)) p["wowFreq"] = float(clip(wowFreq, 0.1, 5)) p["flutter"] = float(clip(flutter, 0, 1)) p["xDelayMod"] = float(clip(xDelay, 0, 1)) p["feedback"] = float(clip(feedback, 0, 1)) p["gain"] = float(clip(gain, 0.5, 2)) p["threshold"] = float(clip(threshold, 0, 1)) p["lowcut"] = int(clip(eq[0], 20, 20000)) p["highcut"] = int(clip(eq[1], 20, 20000)) p["efxMix"] = float(clip(wetMix, 0, 1)) p["xEfxMix"] = float(clip(xWetMix, 0, 1)) p["amp"] = float(clip(db_to_amp(amp), 0, 2)) program_bank[slot] = p return p
def mix_aspect_to_amp(va): if va == 0: return 0 elif va <= 99: a,b = 0.398,-48.4 else: a,b = 0.091,-18.11 return db_to_amp(min(a*va+b, 0))
def mix_aspect_to_amp(va): if va == 0: return 0 elif va <= 99: a, b = 0.398, -48.4 else: a, b = 0.091, -18.11 return db_to_amp(min(a * va + b, 0))
def orgn( slot, name, amp=-12, cenv=[0.00, 0.00, 1.00, 0.00], # ADSR menv=[0.00, 0.00, 1.00, 0.00], op1=[1.00, 0], # freq-ratio, amp(db) op2=[1.00, 0], # freq-ratio, modulation-depth op3=[2.00, -99], # freq-ratio, amp(db) op4=[2.00, 0], # freq-ratio, modulation-depth vibrato=[5.00, 0.00, 0.00, 0.00], # freq, delay, depth, x->pitch chorus=[0.00, 0.00], # delay, depth mod_depth=[1.0, 0.0]): # [depth, x->depth] cenv = _fill(cenv, [0.0, 0.0, 1.0, 0.0]) menv = _fill(menv, [0.0, 0.0, 1.0, 0.0]) op1 = _fill(op1, [1.0, 0]) op2 = _fill(op2, [1.0, 0.0]) op3 = _fill(op3, [2.0, -99]) op4 = _fill(op4, [2.0, 0.0]) vibrato = _fill(vibrato, [5.0, 0.0, 0.0, 0.0]) chorus = _fill(chorus, [0.0, 0.0]) mod_depth = _fill(mod_depth, [1.0, 0.0]) p = Orgn(name) p.performance = performance() p["amp"] = db_to_amp(amp) for i, param in enumerate(("cattack", "cdecay", "csustain", "crelease")): p[param] = float(cenv[i]) for i, param in enumerate(("mattack", "mdecay", "msustain", "mrelease")): p[param] = float(menv[i]) p["r1"] = float(op1[0]) p["r2"] = float(op2[0]) p["r3"] = float(op3[0]) p["r4"] = float(op4[0]) p["amp1"] = float(db_to_amp(op1[1])) p["amp2"] = float(op2[1]) p["amp3"] = float(db_to_amp(op3[1])) p["amp4"] = float(op4[1]) for i, param in enumerate(("vfreq", "vdelay", "vdepth", "xToPitch")): v = float(vibrato[i]) p[param] = v p["chorusDelay"] = float(chorus[0]) p["chorus"] = float(chorus[1]) p["modulationDepth"] = float(mod_depth[0]) p["xToModulationDepth"] = float(mod_depth[1]) program_bank[slot] = p return p
def mix(osc1=0, osc2=0, osc3=0, noise=-99, osc1Env1=0.0, osc2Env1=0.0, osc3Env1=0.0, noiseEnv1=0.0): return { "osc1Amp": db_to_amp(osc1), "osc2Amp": db_to_amp(osc2), "osc3Amp": db_to_amp(osc3), "noiseAmp": db_to_amp(noise), "osc1Amp_env1": nclip(osc1Env1), "osc2Amp_env1": nclip(osc2Env1), "osc3Amp_env1": nclip(osc3Env1), "noiseAmp_env1": nclip(noiseEnv1) }
def orgn(slot, name, amp=-12, cenv = [0.00, 0.00, 1.00, 0.00], # ADSR menv = [0.00, 0.00, 1.00, 0.00], op1 = [1.00, 0], # freq-ratio, amp(db) op2 = [1.00, 0], # freq-ratio, modulation-depth op3 = [2.00, -99], # freq-ratio, amp(db) op4 = [2.00, 0], # freq-ratio, modulation-depth vibrato = [5.00, 0.00, 0.00, 0.00], # freq, delay, depth, x->pitch chorus = [0.00, 0.00], # delay, depth mod_depth = [1.0, 0.0]): # [depth, x->depth] cenv = _fill(cenv, [0.0, 0.0, 1.0, 0.0]) menv = _fill(menv, [0.0, 0.0, 1.0, 0.0]) op1 = _fill(op1, [1.0, 0]) op2 = _fill(op2, [1.0, 0.0]) op3 = _fill(op3, [2.0, -99]) op4 = _fill(op4, [2.0, 0.0]) vibrato = _fill(vibrato, [5.0, 0.0, 0.0, 0.0]) chorus = _fill(chorus, [0.0, 0.0]) mod_depth = _fill(mod_depth, [1.0, 0.0]) p = Orgn(name) p.performance = performance() p["amp"] = db_to_amp(amp) for i,param in enumerate(("cattack","cdecay","csustain","crelease")): p[param] = float(cenv[i]) for i,param in enumerate(("mattack","mdecay","msustain","mrelease")): p[param] = float(menv[i]) p["r1"] = float(op1[0]) p["r2"] = float(op2[0]) p["r3"] = float(op3[0]) p["r4"] = float(op4[0]) p["amp1"] = float(db_to_amp(op1[1])) p["amp2"] = float(op2[1]) p["amp3"] = float(db_to_amp(op3[1])) p["amp4"] = float(op4[1]) for i,param in enumerate(("vfreq","vdelay","vdepth","xToPitch")): v = float(vibrato[i]) p[param] = v p["chorusDelay"] = float(chorus[0]) p["chorus"] = float(chorus[1]) p["modulationDepth"] = float(mod_depth[0]) p["xToModulationDepth"] = float(mod_depth[1]) program_bank[slot] = p return p
def rdrum(slot, name, amp=-12, a = {"ratio" : 1.000, "attack" : 0.000, "decay" : 0.750, "bend" : 0.0, "tone" : 0.0, "amp" : 0, "velocity" : 0.0}, b = {"ratio" : 1.000, "attack" : 0.000, "decay" : 0.375, "bend" : 0.000, "tune" : 1.000, "amp" : 0, "velocity" : 0.0}, noise = {"ratio" : 6.0, "bias" : 0, "attack" : 0.001, "decay" : 0.500, "res" : 0.50, "bend" : 0.00, "amp" : -99, "velocity" : 0.0}, remarks = ""): p = Rdrum(name) p.remarks = remarks p.performance = performance() p["amp"] = db_to_amp(amp) p["aRatio"] = _freq_ratio(a, "ratio", 1.0) p["aAttack"] = _envTime(a, "attack", 0.001) p["aDecay"] = _envTime(a, "decay", 0.75) p["aBend"] = _bend(a, "bend") p["aTone"] = _norm(a, "bend", 0) p["aAmp"] = _db(a, "amp") p["aVelocity"] = _norm(a, "velocity", 0) p["bRatio"] = _freq_ratio(b, "ratio", 1.0) p["bAttack"] = _envTime(b, "attack", 0.001) p["bDecay"] = _envTime(b, "decay", 0.75) p["bBend"] = _bend(b, "bend") p["bTune"] = clip(float(b.get("tune", 0)), 0, 4) p["bAmp"] = _db(b, "amp") p["bVelocity"] = _norm(b, "velocity", 0) p["noiseRatio"] = _freq_ratio(noise, "ratio", 6) p["noiseBias"] = int(clip(noise.get("bias", 0), 0, 9999)) p["noiseAttack"] = _envTime(noise, "attack", 0.001) p["noiseDecay"] = _envTime(noise, "decay", 0.5) p["noiseBend"] = _bend(noise, "bend") p["noiseRes"] = _norm(noise, "res", 0) p["noiseAmp"] = _db(noise, "amp") p["noiseVelocity"] = _norm(noise, "velocity", 0) program_bank[slot] = p return p
def trem(slot, name, amp=0, lfo = [5.0, 0.0], # [freq, amp] xtern = [0.0, 0.0, 0.0], # [modDepth, x->lfoFreq, x->lfoAmp] limit = 1): p = Tremolo(name) p["lfoFreq"] = abs(float(lfo[0])) p["modDepth"] = clip(abs(float(lfo[1])), 0, 2) p["limit"] = abs(float(limit)) p["amp"] = clip(abs(float(db_to_amp(amp))), 0, 2) p["xDepth"] = float(xtern[0]) p["xLfoFreq"] = float(xtern[1]) p["xLfoAmp"] = float(xtern[2]) program_bank[slot] = p return p
def rumklang(slot, name, delay = 0.0, roomSize = 0.5, damp = 0.5, eq = [16000, 20], # [lp hp] in Hz gatted = 0, modDepth = 0.0, # external wet signal modulation wet = [0, 0.25], # [db, pan] dry = [0, 0.75]): # [db, pan] p = Rumklang(name) p["preDelay"] = float(min(abs(delay),MAX_DELAY)) p["roomSize"] = float(roomSize) p["damp"] = float(damp) p["lpcutoff"] = int(eq[0]) p["hpcutoff"] = int(max(eq[1],20)) p["gatted"] = int(gatted) p["modDepth"] = float(modDepth) p["wetAmp"] = int(db_to_amp(wet[0])) p["wetPan"] = float(wet[1]) p["dryAmp"] = int(db_to_amp(dry[0])) p["dryPan"] = float(dry[1]) program_bank[slot] = p return p
def volume_aspect_to_amp(va): if 191 <= va: db = 6 elif 181 <= va: db = 3 elif 171 <= va: db = 0 elif 81 <= va: db = int(0.135 * va - 23) elif 1 <= va: db = int(0.462 * va - 48.462) else: return 0.0 amp = float(db_to_amp(db)) return amp
def volume_aspect_to_amp(va): if 191 <= va: db = 6 elif 181 <= va: db = 3 elif 171 <= va: db = 0 elif 81 <= va: db = int(0.135 * va -23) elif 1 <= va: db = int(0.462 * va -48.462) else: return 0.0 amp = float(db_to_amp(db)) return amp
def mix_aspect_to_amp(va): """ Converts slider position, an int between 0 and 199, to gain factor. Used with slider like gain controls. The response is divided into several distinct regions. 199 - 0db 100 to 198 - -9db to 0db 1 to 99 - -48db to -9db 0 - -infinity """ if va == 0: return 0 elif va <= 99: a,b = 0.398,-48.4 else: a,b = 0.091,-18.11 return db_to_amp(min(a*va+b, 0))
def panner( slot, name, amp=0, # db pos=0.0, # pan position (-1..+1) lfoFreq=1.0, # Hertz lfoDepth=0.0, # (0..1) xscale=0.0, # external signal scale xbias=0.0): p = Panner(name) p["amp"] = float(db_to_amp(amp)) p["pos"] = float(clip(pos, -1, 1)) p["lfoFreq"] = float(abs(lfoFreq)) p["lfoDepth"] = float(clip(lfoDepth, -1, 1)) p["xscale"] = float(xscale) p["xbias"] = float(xbias) program_bank[slot] = p return p
def saw3(slot, name, amp=-12, vibrato=vibrato(5.0), lfo=lfo(5.0), env1=adsr1(0.0, 0.0, 1.0, 0.0), env2=adsr2(0.0, 0.0, 1.0, 0.0), osc1=osc1(0.5), osc2=osc2(1.0), osc3=osc3(0.5), noise=noise(1.0), mixer=mix(), filter_=filter_(), res=res(0.5), filter_mix=filter_mix(0), port=0.0, externalToPitch=0.0): acc = { "amp": db_to_amp(amp), "xToPitch": float(clip(externalToPitch, 0, 1)), "port": float(max(port, 0)) } acc.update(vibrato) acc.update(env1) acc.update(env2) acc.update(lfo) acc.update(osc1) acc.update(osc2) acc.update(osc3) acc.update(noise) acc.update(mixer) acc.update(filter_) acc.update(res) acc.update(filter_mix) p = Saw3(name) for k, v in acc.items(): p[k] = v p.performance = performance() program_bank[slot] = p return p
def masa(slot, name, amp=-12, xbus = {"bias" : 1.0, "scale" : 0.5, "freq" : 0.0}, vibrato = {"freq" : 5.0, "delay" : 0.0, "sens" : 0.1, "depth" : 0.0}, env = [0.01, 0.20], # [attack, decay] amps = [0.00, 0.00, 1.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00], xtrem = [0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00], perc = [0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00]): p = Masa(name) p.performance = performance() _fill_xbus(p, xbus) _fill_vibrato(p, vibrato) _fill_amps(p, amps) _fill_xtrem(p, xtrem) _fill_perc(p, perc) p["amp"] = db_to_amp(amp) program_bank[slot] = p return p
def flngr(slot, name, amp=0, delay = 0.5, modDepth = 0.5, modFreq = 1.0, feedback = 0.5, loweq = 10000, higheq = 10, efxMix = 0.5, xmodDepth = 0, xmixScale = 0): p = Flngr(name) p["delay"] = clip(float(delay), 0, 1) p["imodDepth"] = clip(float(modDepth), 0, 1) p["imodFreq"] = abs(float(modFreq)) p["feedback"] = clip(float(feedback), -1, 1) p["feedbackLowpass"] = clip(int(loweq), 20, 20000) p["feedbackHighpass"] = clip(int(higheq), 20, 20000) p["efxMix"] = clip(float(efxMix), 0, 1) p["xmodDepth"] = clip(float(xmodDepth), 0, 1) p["xmixScale"] = clip(float(xmixScale), 0, 1) p["amp"] = float(db_to_amp(amp)) program_bank[slot] = p return p
def saw3(slot, name, amp = -12, vibrato = vibrato(5.0), lfo = lfo(5.0), env1 = adsr1(0.0, 0.0, 1.0, 0.0), env2 = adsr2(0.0, 0.0, 1.0, 0.0), osc1 = osc1(0.5), osc2 = osc2(1.0), osc3 = osc3(0.5), noise = noise(1.0), mixer = mix(), filter_ = filter_(), res = res(0.5), filter_mix = filter_mix(0), port = 0.0, externalToPitch = 0.0): acc = {"amp" : db_to_amp(amp), "xToPitch" : float(clip(externalToPitch, 0, 1)), "port" : float(max(port, 0))} acc.update(vibrato) acc.update(env1) acc.update(env2) acc.update(lfo) acc.update(osc1) acc.update(osc2) acc.update(osc3) acc.update(noise) acc.update(mixer) acc.update(filter_) acc.update(res) acc.update(filter_mix) p = Saw3(name) for k,v in acc.items(): p[k] = v p.performance = performance() program_bank[slot] = p return p
def _fill_op1_params(d): rs = _fill_common_op_params(1, d) rs.update(_fill_envelope_params(1, d)) rs["amp"] = int(db_to_amp(d.get("amp", 0))) return rs
def klstr(slot, name, amp=-12, lfo = {"freq" : 1.00, "ratio" : 1.00, "xmod" : 0.00, "delay" : 0.00, "depth" : 1.00, "vibrato" : 0.00}, env = {"gated" : True, "attack" : 0.00, "decay" : 0.00, "sustain" : 1.00, "release" : 0.00}, spread = {"depth" : 0.0, "lfo" : 0.0, "env" : 0.0}, cluster = {"depth" : 1.0, "lfo" : 0.0, "env" : 0.0, "lag" : 0.0}, filter_ = {"freq" : 100, "lfo" : 0, "env" : 7000, "lag" : 0.0, "res" : 0.5, "mix" : 1.0}, external = {"spread" : 0.0, "noise" : 0.0, "filter" : 0.0, "scale" : 1.0, "bias" : 0.0}, pw = 0.5, pwLfo = 0.0, noise = -99, remarks = ""): p = Klstr(name) p.performance = performance() p["amp"] = db_to_amp(amp) p["lfoFreq"] = float(clip(lfo.get("freq", 1.0), 0.01, 100)) p["lfo2FreqRatio"] = float(clip(lfo.get("lfo2FreqRatio", 1.0),0.01, 100)) p["lfoXMod"] = float(clip(lfo.get("xmod", 0), 0, 100)) p["lfoDelay"] = float(clip(lfo.get("delay", 0), 0, 8)) p["vibrato"] = float(clip(lfo.get("vibrato",0), 0, 1)) p["pw"] = float(clip(pw, 0, 1)) p["pwLfo"] = float(clip(pwLfo, 0, 1)) p["attack"] = float(clip(env.get("attack", 0), 0, 32)) p["decay"] = float(clip(env.get("decay", 0), 0, 32)) p["release"] = float(clip(env.get("release", 0), 0, 32)) p["sustain"] = float(clip(env.get("sustain", 0), 0, 1)) if env.get("gatted", True): env_mode = 0 else: env_mode = 1 p["envMode"] = env_mode p["spread"] = float(clip(spread.get("depth"), 0, 4)) p["spreadLfo"] = float(clip(spread.get("lfo"), 0, 4)) p["spreadEnv"] = float(clip(spread.get("env"), 0, 4)) p["cluster"] = float(clip(cluster.get("depth"), 0, 16)) p["clusterLfo"] = float(clip(cluster.get("lfo"), 0, 16)) p["clusterEnv"] = float(clip(cluster.get("env"), -16, 16)) p["cluserLag"] = float(clip(cluster.get("lag"), 0, 1)) p["filterFreq"] = int(clip(filter_.get("freq",100), 100, 16000)) p["filterLfo"] = int(clip(filter_.get("lfo", 0), -9999, 9999)) p["filterEnv"] = int(clip(filter_.get("env", 7000), -9999, 9999)) p["filterLag"] = float(clip(filter_.get("lag"), 0, 1)) p["res"] = float(clip(filter_.get("res"),0,1)) p["filterMix"] = float(clip(filter_.get("mix", 1.0),0,1)) p["noise"] = db_to_amp(noise) p["xScale"] = float(clip(external.get("scale", 1.0),0,4)) p["xBias"] = float(clip(external.get("bias", 0.0),-4, +4)) p["xToSpread"] = float(clip(external.get("spread", 0), 0, 1)) p["xToNoise"] = float(clip(external.get("noise", 0), 0, 1)) p["xToFilter"] = float(clip(external.get("filter", 0), 0, 1)) p.remarks = remarks program_bank[slot] = p return p
def fm2(slot, name, amp=-12, port=0.0, external = {"scale" : 1.0, "bias" : 0.0, "pitch" : 0.0, "mod" : 0.0}, lfo = {"freq" : 5.0, "delay" : 0.0, "vsens" : 0.1, "vdepth" : 0.0}, efx = {"attack" : 0.00, "decay1" : 0.00, "decay2" : 0.00, "release" : 0.00, "breakPoinit" : 1.0, "sustain" : 1.0, "env-cycle" : False, "lfo-ratio" : 1.0, "flanger-delay" : 0.05, "flanger-feedback" : 0.0, "flanger-lfo-depth" : 0.0, "ps-ratio" : 2.0, "ps-pitch-dispersion" : 0.0, "ps-time-dispersion" : 0.0, "ps-lfo-depth" : 0.0, "efx-mix" : 0.0, "efx-amp" : 0.0}, op1 = {"enable" : True, "ratio" : 1.0, "bias" : 0.0, "amp" : 0, # in DB "attack" : 0.0, "decay1" : 0.0, "decay2" : 0.0, "release" : 0.0, "breakpoint" : 1.0, "sustain" : 1.0, "env-cycle" : False, "break-key" : 60, "left-scale" : 0, "right-scale" : 0, "lfo" : 0.0, "velocity" : 0.0}, op2 = {"enable" : True, "ratio" : 1.0, "bias" : 0.0, "amp" : 0.0, # modulation depth "modRange" : 1, # powers of 10 "attack" : 0.0, "decay1" : 0.0, "decay2" : 0.0, "release" : 0.0, "breakpoint" : 1.0, "sustain" : 1.0, "env-cycle" : False, "break-key" : 60, "left-scale" : 0, "right-scale" : 0, "lfo" : 0.0, "velocity" : 0.0, "feedback" : 0.0}): p = FM2(name) p["amp"] = int(db_to_amp(amp)) p["port"] = float(port) acc = _fill_external_params(external) acc.update(_fill_lfo_params(lfo)) acc.update(_fill_efx(efx)) acc.update(_fill_op1_params(op1)) acc.update(_fill_op2_params(op2)) for param,value in acc.items(): p[param] = value program_bank[slot] = p return p
def set_channel_params(prefix,chanlist): program["gain%s" % prefix] = db_to_amp(chanlist[0]) program["mod%s" % prefix] = chanlist[1] program["pan%s" % prefix] = chanlist[2] program["mute%s" % prefix] = chanlist[3]
def _db(d, param): v = clip(int(db_to_amp(d.get(param, 0))), 0, 2) return v
def fm2( slot, name, amp=-12, port=0.0, external={ "scale": 1.0, "bias": 0.0, "pitch": 0.0, "mod": 0.0 }, lfo={ "freq": 5.0, "delay": 0.0, "vsens": 0.1, "vdepth": 0.0 }, efx={ "attack": 0.00, "decay1": 0.00, "decay2": 0.00, "release": 0.00, "breakPoinit": 1.0, "sustain": 1.0, "env-cycle": False, "lfo-ratio": 1.0, "flanger-delay": 0.05, "flanger-feedback": 0.0, "flanger-lfo-depth": 0.0, "ps-ratio": 2.0, "ps-pitch-dispersion": 0.0, "ps-time-dispersion": 0.0, "ps-lfo-depth": 0.0, "efx-mix": 0.0, "efx-amp": 0.0 }, op1={ "enable": True, "ratio": 1.0, "bias": 0.0, "amp": 0, # in DB "attack": 0.0, "decay1": 0.0, "decay2": 0.0, "release": 0.0, "breakpoint": 1.0, "sustain": 1.0, "env-cycle": False, "break-key": 60, "left-scale": 0, "right-scale": 0, "lfo": 0.0, "velocity": 0.0 }, op2={ "enable": True, "ratio": 1.0, "bias": 0.0, "amp": 0.0, # modulation depth "modRange": 1, # powers of 10 "attack": 0.0, "decay1": 0.0, "decay2": 0.0, "release": 0.0, "breakpoint": 1.0, "sustain": 1.0, "env-cycle": False, "break-key": 60, "left-scale": 0, "right-scale": 0, "lfo": 0.0, "velocity": 0.0, "feedback": 0.0 }): p = FM2(name) p["amp"] = int(db_to_amp(amp)) p["port"] = float(port) acc = _fill_external_params(external) acc.update(_fill_lfo_params(lfo)) acc.update(_fill_efx(efx)) acc.update(_fill_op1_params(op1)) acc.update(_fill_op2_params(op2)) for param, value in acc.items(): p[param] = value program_bank[slot] = p return p
def klstr( slot, name, amp=-12, lfo={ "freq": 1.00, "ratio": 1.00, "xmod": 0.00, "delay": 0.00, "depth": 1.00, "vibrato": 0.00 }, env={ "gated": True, "attack": 0.00, "decay": 0.00, "sustain": 1.00, "release": 0.00 }, spread={ "depth": 0.0, "lfo": 0.0, "env": 0.0 }, cluster={ "depth": 1.0, "lfo": 0.0, "env": 0.0, "lag": 0.0 }, filter_={ "freq": 100, "lfo": 0, "env": 7000, "lag": 0.0, "res": 0.5, "mix": 1.0 }, external={ "spread": 0.0, "noise": 0.0, "filter": 0.0, "scale": 1.0, "bias": 0.0 }, pw=0.5, pwLfo=0.0, noise=-99, remarks=""): p = Klstr(name) p.performance = performance() p["amp"] = db_to_amp(amp) p["lfoFreq"] = float(clip(lfo.get("freq", 1.0), 0.01, 100)) p["lfo2FreqRatio"] = float(clip(lfo.get("lfo2FreqRatio", 1.0), 0.01, 100)) p["lfoXMod"] = float(clip(lfo.get("xmod", 0), 0, 100)) p["lfoDelay"] = float(clip(lfo.get("delay", 0), 0, 8)) p["vibrato"] = float(clip(lfo.get("vibrato", 0), 0, 1)) p["pw"] = float(clip(pw, 0, 1)) p["pwLfo"] = float(clip(pwLfo, 0, 1)) p["attack"] = float(clip(env.get("attack", 0), 0, 32)) p["decay"] = float(clip(env.get("decay", 0), 0, 32)) p["release"] = float(clip(env.get("release", 0), 0, 32)) p["sustain"] = float(clip(env.get("sustain", 0), 0, 1)) if env.get("gatted", True): env_mode = 0 else: env_mode = 1 p["envMode"] = env_mode p["spread"] = float(clip(spread.get("depth"), 0, 4)) p["spreadLfo"] = float(clip(spread.get("lfo"), 0, 4)) p["spreadEnv"] = float(clip(spread.get("env"), 0, 4)) p["cluster"] = float(clip(cluster.get("depth"), 0, 16)) p["clusterLfo"] = float(clip(cluster.get("lfo"), 0, 16)) p["clusterEnv"] = float(clip(cluster.get("env"), -16, 16)) p["cluserLag"] = float(clip(cluster.get("lag"), 0, 1)) p["filterFreq"] = int(clip(filter_.get("freq", 100), 100, 16000)) p["filterLfo"] = int(clip(filter_.get("lfo", 0), -9999, 9999)) p["filterEnv"] = int(clip(filter_.get("env", 7000), -9999, 9999)) p["filterLag"] = float(clip(filter_.get("lag"), 0, 1)) p["res"] = float(clip(filter_.get("res"), 0, 1)) p["filterMix"] = float(clip(filter_.get("mix", 1.0), 0, 1)) p["noise"] = db_to_amp(noise) p["xScale"] = float(clip(external.get("scale", 1.0), 0, 4)) p["xBias"] = float(clip(external.get("bias", 0.0), -4, +4)) p["xToSpread"] = float(clip(external.get("spread", 0), 0, 1)) p["xToNoise"] = float(clip(external.get("noise", 0), 0, 1)) p["xToFilter"] = float(clip(external.get("filter", 0), 0, 1)) p.remarks = remarks program_bank[slot] = p return p