def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params setv(g2mp.Bandwidth, 0) setv(g2mp.Active, 1-getv(nmmp.Bypass)) setv(g2mp.Level, modtable[getv(nmmp.Level)][0])
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params if self.maing2module == 'Sw4-1': # add a LevAmp and reorient inputs for i in xrange(1, 5): level = getv(getattr(nmmp, 'Level%d' % i)) if level == 0 or level == 127: continue if len(nmm.inputs[i-1].cables): mix11a = self.add_module('Mix1-1A') self.connect(mix11a.outputs.Out, getattr(g2m.inputs, 'In%d' % i)) setv(mix11a.params.On, 1) setv(mix11a.params.Lev, modtable[level][0]) self.params[i] = mix11a.params.Lev self.inputs[i-1] = mix11a.inputs.In else: sel = getv(nmmp.Sel) for i in xrange(1, 5): level = getv(getattr(nmmp, 'Level%d' % i)) lev = getattr(g2mp, 'Lev%d' % i) setv(lev, modtable[level][0]) setv(getattr(g2mp, 'On%d' % i), sel == i-1) self.params[i] = lev
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params pattern = (getv(nmmp.Pattern) + 64) % 128 setv(g2mp.PatternA, pattern) bank = (getv(nmmp.Bank) + 64) % 128 setv(g2mp.PatternB, bank) # PatternA and PatternB receive same input if len(getattr(nmm.inputs, 'Pattern&Bank').cables): self.connect(g2m.inputs.A, g2m.inputs.B) lowdelta = getv(nmmp.LowDelta) if lowdelta: notequant = self.add_module('NoteQuant') self.connect(g2m.outputs.Out, notequant.inputs.In) setv(notequant.params.Range, 77) setv(notequant.params.Notes, 1) self.outputs[0] = notequant.outputs.Out stepprob, add = 55, 75 setv(g2mp.StepProb, 55) else: stepprob, add = 127, 74 setv(g2mp.StepProb, stepprob) levadd = self.add_module('LevAdd') self.connect(self.outputs[0], levadd.inputs.In) setv(levadd.params.Level, add) self.outputs[0] = levadd.outputs.Out
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params if self.maing2module == 'Mix1-1A': setv(g2mp.On, 1) setv(g2mp.ExpLin, 2) setv(g2mp.Lev, modtable[getv(nmmp.Level)][0]) out2 = self.add_module('2-Out') lev = g2m.params.Lev else: out2 = g2m lev = None dest = getv(nmmp.Destination) setv(out2.params.Destination, dest/2) setv(out2.params.Active, 1-getv(nmmp.Mute)) inp = [out2.inputs.InL, out2.inputs.InR][dest % 2] if self.maing2module == 'Mix1-1A': self.connect(g2m.outputs.Out, inp) else: self.inputs = [inp] self.params = [lev, out2.params.Destination, out2.params.Active]
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params setv(g2mp.Bandwidth, 0) setv(g2mp.Active, 1 - getv(nmmp.Bypass)) setv(g2mp.Level, modtable[getv(nmmp.Level)][0])
def handleslv(conv): global modindex conv.nonslaves = [] conv.slaves = [] nmm, g2m = conv.nmmodule, conv.g2module if len(nmm.outputs.Slv.cables): # add a masterosc master = conv.add_module('OscMaster', name='SlvOut%d' % modindex.slvout) setv(g2m.params.Kbt, 0) conv.kbt = master.params.Kbt conv.connect(master.outputs.Out, g2m.inputs.Pitch) setv(master.params.FreqCoarse, getv(g2m.params.FreqCoarse)) setv(master.params.FreqFine, getv(g2m.params.FreqFine)) setv(master.params.FreqMode, getv(g2m.params.FreqMode)) setv(master.params.PitchMod, getv(g2m.params.PitchMod)) setv(g2m.params.FreqCoarse, 64) setv(g2m.params.FreqFine, 64) out = handleoscmasterslv(conv, master, 44, 64, 69, 103, 42) if out: return out, master else: return g2m.inputs.Pitch, master else: conv.kbt = g2m.params.Kbt return None, g2m
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params # handle special special parameters setv(g2mp.Active, 1-getv(nmmp.Mute)) setv(g2mp.FreqMode, [1, 0][nmm.modes[0].value]) setv(g2mp.Shape, 0) if getv(g2mp.Waveform) == 3: pwmod = handlepw(self, 64, 0, -1, 7) if pwmod: notequant = self.add_module('NoteQuant', name='BlueRate') self.connect(notequant.outputs.Out, pwmod) setv(notequant.params.Range, 127) setv(notequant.params.Notes, 0) self.inputs[3] = notequant.inputs.In # handle special inputs self.outputs[1], inputmod = handleslv(self) self.inputmod = inputmod inp = inputmod.params self.params[:3] = inp.FreqCoarse, inp.FreqFine, inp.Kbt p1, p2 = handledualpitchmod(self, inputmod.inputs.PitchVar, inputmod.params.PitchMod, 4, 5) self.inputs[1:3] = p1, p2 self.inputs[0] = handlefm(self, g2m.inputs.FmMod, g2mp.FmAmount, fmamod) handlekbt(self, self.inputmod.inputs.Pitch, 1) # 0=off, 1=on
def domodule(self): global modindex nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params # handle special parameters setv(g2mp.Active, 1 - getv(nmmp.Mute)) setv(g2mp.Kbt, 0) setv(g2mp.FreqMode, [1, 0][nmm.modes[0].value]) # add AM if needed if len(nmm.inputs.Am.cables): sh = self.add_module('S&H', name='Amp In') levmult = self.add_module('LevMult', name='Out') self.connect(g2m.inputs.Trig, sh.inputs.Ctrl) self.connect(g2m.outputs.Out, levmult.inputs.In) self.connect(sh.outputs.Out, levmult.inputs.Mod) self.inputs[1] = sh.inputs.In self.outputs[0] = levmult.outputs.Out # add pitchmod if needed if len(nmm.inputs.PitchMod.cables): adj = self.add_module('Mix2-1B', name='PitchAdj1-%d' % modindex.pitchmod) self.connect(adj.outputs.Out, g2m.inputs.PitchVar) self.connect(adj.inputs.Chain, adj.inputs.In1) self.connect(adj.inputs.In1, adj.inputs.In2) pmod = getv(nmm.params.PitchMod) setv(g2mp.PitchMod, modtable[pmod][0]) setv(adj.params.Inv2, 1) setv(adj.params.Lev1, modtable[pmod][1]) setv(adj.params.Lev2, modtable[pmod][2]) self.inputs[2] = adj.inputs.Chain
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params setv(g2mp.Kbt, 0) setv(g2mp.Active, 1-getv(nmmp.Mute)) setv(g2mp.FreqMode, [2, 3, 1][nmm.modes[0].value]) g2m.modes.Waveform.value = self.waveform # must happen after handle mst to get Range if getv(getattr(nmmp, '-3Oct')): freqmode = getv(g2mp.FreqMode) nm1freqcoarse = getv(nmmp.DetuneCoarse) g2freqcoarse = getv(g2mp.FreqCoarse) if freqmode == 3: # Part offset = 8 else: offset = 36 if g2freqcoarse - offset < 0: constswt = self.add_module('ConstSwT', name='Offset') setv(constswt.params.On, 1) constswt.params.On.labels = ['Offset'] setv(constswt.params.Lev, g2freqcoarse-offset) setv(g2mp.PitchVar, 127) self.connect(constswt.outputs.Out, g2m.inputs.PitchVar) else: setv(g2mp.FreqCoarse, g2freqcoarse-offset) self.inputs[1] = handlefm(self, g2m.inputs.PhaseMod, g2mp.PhaseMod, fmbmod) sinepostmst(self, 0)
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params if self.maing2module == 'Sw4-1': # add a LevAmp and reorient inputs for i in xrange(1, 5): level = getv(getattr(nmmp, 'Level%d' % i)) if level == 0 or level == 127: continue if len(nmm.inputs[i - 1].cables): mix11a = self.add_module('Mix1-1A') self.connect(mix11a.outputs.Out, getattr(g2m.inputs, 'In%d' % i)) setv(mix11a.params.On, 1) setv(mix11a.params.Lev, modtable[level][0]) self.params[i] = mix11a.params.Lev self.inputs[i - 1] = mix11a.inputs.In else: sel = getv(nmmp.Sel) for i in xrange(1, 5): level = getv(getattr(nmmp, 'Level%d' % i)) lev = getattr(g2mp, 'Lev%d' % i) setv(lev, modtable[level][0]) setv(getattr(g2mp, 'On%d' % i), sel == i - 1) self.params[i] = lev
def domodule(self): global modindex nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params # handle special parameters setv(g2mp.Active, 1-getv(nmmp.Mute)) setv(g2mp.Kbt, 0) setv(g2mp.FreqMode, [1, 0][nmm.modes[0].value]) # add AM if needed if len(nmm.inputs.Am.cables): sh = self.add_module('S&H', name='Amp In') levmult = self.add_module('LevMult', name='Out') self.connect(g2m.inputs.Trig, sh.inputs.Ctrl) self.connect(g2m.outputs.Out, levmult.inputs.In) self.connect(sh.outputs.Out, levmult.inputs.Mod) self.inputs[1] = sh.inputs.In self.outputs[0] = levmult.outputs.Out # add pitchmod if needed if len(nmm.inputs.PitchMod.cables): adj = self.add_module('Mix2-1B', name='PitchAdj1-%d' % modindex.pitchmod) self.connect(adj.outputs.Out, g2m.inputs.PitchVar) self.connect(adj.inputs.Chain, adj.inputs.In1) self.connect(adj.inputs.In1, adj.inputs.In2) pmod = getv(nmm.params.PitchMod) setv(g2mp.PitchMod, modtable[pmod][0]) setv(adj.params.Inv2, 1) setv(adj.params.Lev1, modtable[pmod][1]) setv(adj.params.Lev2, modtable[pmod][2]) self.inputs[2] = adj.inputs.Chain
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params # handle special special parameters setv(g2mp.Active, 1 - getv(nmmp.Mute)) setv(g2mp.FreqMode, [1, 0][nmm.modes[0].value]) setv(g2mp.Shape, 0) if getv(g2mp.Waveform) == 3: pwmod = handlepw(self, 64, 0, -1, 7) if pwmod: notequant = self.add_module('NoteQuant', name='BlueRate') self.connect(notequant.outputs.Out, pwmod) setv(notequant.params.Range, 127) setv(notequant.params.Notes, 0) self.inputs[3] = notequant.inputs.In # handle special inputs self.outputs[1], inputmod = handleslv(self) self.inputmod = inputmod inp = inputmod.params self.params[:3] = inp.FreqCoarse, inp.FreqFine, inp.Kbt p1, p2 = handledualpitchmod(self, inputmod.inputs.PitchVar, inputmod.params.PitchMod, 4, 5) self.inputs[1:3] = p1, p2 self.inputs[0] = handlefm(self, g2m.inputs.FmMod, g2mp.FmAmount, fmamod) handlekbt(self, self.inputmod.inputs.Pitch, 1) # 0=off, 1=on
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params g2mp.Sel.labels = ['In', 'SideAct'] setv(g2mp.Sel, getv(nmmp.Act)) self.params[6] = g2mp.Sel envfollow = self.add_module('EnvFollow') setv(envfollow.params.Attack, getv(nmmp.Attack)) setv(envfollow.params.Release, getv(nmmp.Release)) self.params[:2] = envfollow.params.Attack, envfollow.params.Release ratio = self.add_module('ShpExp', name='Ratio/Thresh') setv(ratio.params.Curve, 2) # x4 setv(ratio.params.Amount, getv(nmmp.Ratio)) self.params[3] = ratio.params.Amount left = self.add_module('LevMult', name='Left') right = self.add_module('LevMult', name='Right') # MISSING Gate, Hold, Mon, and Bypass parameters self.connect(g2m.inputs.In1, left.inputs.In) self.connect(g2m.outputs.Out, envfollow.inputs.In) self.connect(envfollow.outputs.Out, ratio.inputs.In) self.connect(ratio.outputs.Out, left.inputs.Mod) self.connect(left.inputs.Mod, right.inputs.Mod) self.inputs[:] = left.inputs.In, right.inputs.In, g2m.inputs.In2 self.outputs = left.outputs.Out, right.outputs.Out
def handlelength(conv): nmm, g2m = conv.nmmodule, conv.g2module nmmp, g2mp = nmm.params, g2m.params length = getv(nmmp.Length) if getv(nmmp.Loop) == 0 and length > 15: link = g2m.outputs.Link setv(g2mp.Length, 16) for l in xrange(16, length, 16): seq = conv.add_module(g2m.type.shortnm) if l + 16 > length: setv(seq.params.Length, length - l) else: setv(seq.params.Length, 16) setv(seq.params.Loop, 0) # Once conv.connect(g2m.inputs.Rst, seq.inputs.Park) conv.connect(link, seq.inputs.Rst) conv.connect(g2m.inputs.Clk, seq.inputs.Clk) link = seq.outputs.Link return link if length > 16: clkdiv = conv.add_module('ClkDiv') clkdiv.modes.DivMode.value = 0 setv(clkdiv.params.Divider, length) conv.connect(clkdiv.outputs.Out, g2m.inputs.Rst) conv.connect(clkdiv.inputs.Clk, g2m.inputs.Clk) conv.inputs[1] = clkdiv.inputs.Rst setv(g2mp.Loop, 0) # Once return g2m.outputs.Link
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params setv(g2mp.Kbt, 0) setv(g2mp.Active, 1 - getv(nmmp.Mute)) setv(g2mp.FreqMode, [2, 3, 1][nmm.modes[0].value]) g2m.modes.Waveform.value = self.waveform # must happen after handle mst to get Range if getv(getattr(nmmp, '-3Oct')): freqmode = getv(g2mp.FreqMode) nm1freqcoarse = getv(nmmp.DetuneCoarse) g2freqcoarse = getv(g2mp.FreqCoarse) if freqmode == 3: # Part offset = 8 else: offset = 36 if g2freqcoarse - offset < 0: constswt = self.add_module('ConstSwT', name='Offset') setv(constswt.params.On, 1) constswt.params.On.labels = ['Offset'] setv(constswt.params.Lev, g2freqcoarse - offset) setv(g2mp.PitchVar, 127) self.connect(constswt.outputs.Out, g2m.inputs.PitchVar) else: setv(g2mp.FreqCoarse, g2freqcoarse - offset) self.inputs[1] = handlefm(self, g2m.inputs.PhaseMod, g2mp.PhaseMod, fmbmod) sinepostmst(self, 0)
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params if self.maing2module == 'Mix1-1A': setv(g2mp.On, 1) setv(g2mp.ExpLin, 2) setv(g2mp.Lev, modtable[getv(nmmp.Level)][0]) out2 = self.add_module('2-Out') lev = g2m.params.Lev else: out2 = g2m lev = None dest = getv(nmmp.Destination) setv(out2.params.Destination, dest / 2) setv(out2.params.Active, 1 - getv(nmmp.Mute)) inp = [out2.inputs.InL, out2.inputs.InR][dest % 2] if self.maing2module == 'Mix1-1A': self.connect(g2m.outputs.Out, inp) else: self.inputs = [inp] self.params = [lev, out2.params.Destination, out2.params.Active]
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params setv(g2mp.InputType, 0) # Pos mode = getv(nmmp.Mode) inv = getv(nmmp.Inv) setv(g2mp.OutputType, [4, 2, 0, 5, 3, 1][inv*3+mode])
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params setv(g2mp.Bits, getv(nmmp.Bits)) # becuase it's also used for QuantOff quantoff = getv(nmmp.QuantOff) if quantoff: setv(g2mp.Bits, 12) setv(g2mp.Active, 1-getv(nmmp.SamplingOff))
def handledualpitchmod(conv, modinput, modinputparam, mod1param, mod2param): global modindex nmm, g2m = conv.nmmodule, conv.g2module p1 = p2 = None mix21b = None pmod1 = getv(nmm.params.PitchMod1) pmod2 = getv(nmm.params.PitchMod2) if len(nmm.inputs.PitchMod1.cables) and len(nmm.inputs.PitchMod2.cables): setv(modinputparam, 127) mix21b = conv.add_module('Mix2-1B', name='PitchMod%d' % modindex.pitchmod) conv.connect(mix21b.outputs.Out, modinput) if pmod1 == 0 or pmod1 == 127: setv(mix21b.params.Lev1, pmod1) p1 = mix21b.inputs.In1 elif pmod1: p1 = pitchadj(conv, mix21b.params.Lev1, mix21b.inputs.In1, modtable[pmod1]) else: p1 = mix21b.inputs.In1 if pmod2 == 0 or pmod2 == 127: setv(mix21b.params.Lev2, pmod2) p2 = mix21b.inputs.In2 elif pmod2: p2 = pitchadj(conv, mix21b.params.Lev2, mix21b.inputs.In2, modtable[pmod2]) conv.params[mod1param] = mix21b.params.Lev1 conv.params[mod2param] = mix21b.params.Lev2 elif len(nmm.inputs.PitchMod1.cables): if pmod1 == 0 or pmod1 == 127: setv(modinputparam, pmod1) p1 = modinput else: p1 = pitchadj(conv, modinputparam, modinput, modtable[pmod1]) conv.params[mod1param] = modinputparam elif len(nmm.inputs.PitchMod2.cables): if pmod2 == 0 or pmod2 == 127: setv(modinputparam, pmod2) p2 = modinput else: p2 = pitchadj(conv, modinputparam, modinput, modtable[pmod2]) conv.params[mod2param] = modinputparam return p1, p2
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params handlegate(self) setv(g2mp.SustainMode, [3, 0, 1, 2, 3][getv(nmmp.Sustain)]) setv(g2mp.Shape, [3, 2, 1][getv(nmmp.Curve)]) # handle special parameters updatevals(g2mp, ['Time%d' % i for i in xrange(1, 5)]+['NR'], adsrtime_map) # if L4 is sustain, deal with it. sustain = getv(nmmp.Sustain) if sustain == 4: adsr = self.add_module('EnvADSR') setv(adsr.params.Shape, [3, 2, 1][getv(nmmp.Curve)]) setv(adsr.params.KB, getv(g2mp.KB)) setv(adsr.params.Attack, 0) setv(adsr.params.Decay, 0) setv(adsr.params.Sustain, 127) setv(adsr.params.Release, getv(nmmp.Time5)) updatevals(adsr.params, ['Release'], adsrtime_map) self.connect(g2m.inputs.Gate, adsr.inputs.Gate) self.connect(adsr.outputs.Env, g2m.inputs.AM) self.inputs[2] = adsr.inputs.AM return elif sustain == 3 and getv(nmmp.Time5) <= 16: # 16=5.3ms pass time = nm1adsrtime[getv(nmmp.Time4)]+nm1adsrtime[getv(nmmp.Time5)] setv(g2mp.Time4, self.closesttime(time)) setv(g2mp.Level4, 0)
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params handlegate(self) setv(g2mp.SustainMode, [3, 0, 1, 2, 3][getv(nmmp.Sustain)]) setv(g2mp.Shape, [3, 2, 1][getv(nmmp.Curve)]) # handle special parameters updatevals(g2mp, ['Time%d' % i for i in xrange(1, 5)] + ['NR'], adsrtime_map) # if L4 is sustain, deal with it. sustain = getv(nmmp.Sustain) if sustain == 4: adsr = self.add_module('EnvADSR') setv(adsr.params.Shape, [3, 2, 1][getv(nmmp.Curve)]) setv(adsr.params.KB, getv(g2mp.KB)) setv(adsr.params.Attack, 0) setv(adsr.params.Decay, 0) setv(adsr.params.Sustain, 127) setv(adsr.params.Release, getv(nmmp.Time5)) updatevals(adsr.params, ['Release'], adsrtime_map) self.connect(g2m.inputs.Gate, adsr.inputs.Gate) self.connect(adsr.outputs.Env, g2m.inputs.AM) self.inputs[2] = adsr.inputs.AM return elif sustain == 3 and getv(nmmp.Time5) <= 16: # 16=5.3ms pass time = nm1adsrtime[getv(nmmp.Time4)] + nm1adsrtime[getv(nmmp.Time5)] setv(g2mp.Time4, self.closesttime(time)) setv(g2mp.Level4, 0)
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params levamp = self.add_module('LevAmp', name='LevAmp') setv(levamp.params.Type, 1) setv(levamp.params.Gain, 68) self.connect(g2m.outputs.Out, levamp.inputs.In) self.outputs[0] = levamp.outputs.Out # if sync connected, use OscC, otherwise use OscD if len(nmm.inputs.Sync.cables): osctype = 'OscC' else: osctype = 'OscD' oscs = [] for i in xrange(6, 0, -1): # 6 Sine Osc # if osc muted, don't addit if getv(getattr(nmmp, 'Osc%dMute' % i)) == 0: if len(getattr(nmm.inputs, 'Osc%dAm'%i).cables) == 0 and \ len(nmm.inputs.Sync.cables) == 0 and \ len(nmm.inputs.Mst.cables) == 0: continue osc = self.add_module(osctype, name='Osc%d' % i) oscs.append(osc) setv(osc.params.Kbt, 0) setv(osc.params.FreqCoarse, getv(getattr(nmmp, 'Osc%dCoarse' % i))) self.params[(i - 1) * 3] = osc.params.FreqCoarse setv(osc.params.FreqFine, getv(getattr(nmmp, 'Osc%dFine' % i))) self.params[(i - 1) * 3 + 1] = osc.params.FreqFine setv(osc.params.FreqMode, 2) l = getattr(g2mp, 'Lev%d' % i) setv(l, getv(getattr(nmmp, 'Osc%dLevel' % i))) self.params[(i - 1) * 3 + 2] = l setv(osc.params.Active, 1 - getv(getattr(nmmp, 'Osc%dMute' % i))) self.params[(i - 1) + 18] = osc.params.Active if len(getattr(nmm.inputs, 'Osc%dAm' % i).cables): mod = self.add_module('LevMult', name='Am%d' % i) self.connect(osc.outputs.Out, mod.inputs.In) self.connect(mod.outputs.Out, getattr(g2m.inputs, 'In%d' % i)) self.inputs[2 + i] = mod.inputs.Mod else: self.connect(osc.outputs.Out, getattr(g2m.inputs, 'In%d' % i)) if len(nmm.inputs.Sync.cables): self.inputs[2] = oscs[0].inputs.Sync if len(oscs) > 1: for i in xrange(1, len(oscs)): self.connect(oscs[i - 1].inputs.Sync, oscs[i].inputs.Sync) if len(nmm.inputs.Mst.cables): self.inputs[0] = oscs[0].inputs.Pitch if len(oscs) > 1: for i in xrange(1, len(oscs)): self.connect(oscs[i - 1].inputs.Pitch, oscs[i].inputs.Pitch) self.oscs = oscs sinepostmst(self, 0)
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params levamp = self.add_module('LevAmp', name='LevAmp') setv(levamp.params.Type, 1) setv(levamp.params.Gain, 68) self.connect(g2m.outputs.Out, levamp.inputs.In) self.outputs[0] = levamp.outputs.Out # if sync connected, use OscC, otherwise use OscD if len(nmm.inputs.Sync.cables): osctype = 'OscC' else: osctype = 'OscD' oscs = [] for i in xrange(6, 0, -1): # 6 Sine Osc # if osc muted, don't addit if getv(getattr(nmmp, 'Osc%dMute'%i))==0: if len(getattr(nmm.inputs, 'Osc%dAm'%i).cables) == 0 and \ len(nmm.inputs.Sync.cables) == 0 and \ len(nmm.inputs.Mst.cables) == 0: continue osc = self.add_module(osctype, name='Osc%d' % i) oscs.append(osc) setv(osc.params.Kbt, 0) setv(osc.params.FreqCoarse, getv(getattr(nmmp, 'Osc%dCoarse'%i))) self.params[(i-1)*3] = osc.params.FreqCoarse setv(osc.params.FreqFine, getv(getattr(nmmp, 'Osc%dFine'%i))) self.params[(i-1)*3+1] = osc.params.FreqFine setv(osc.params.FreqMode, 2) l = getattr(g2mp, 'Lev%d' % i) setv(l, getv(getattr(nmmp, 'Osc%dLevel'%i))) self.params[(i-1)*3+2] = l setv(osc.params.Active, 1-getv(getattr(nmmp, 'Osc%dMute'%i))) self.params[(i-1)+18] = osc.params.Active if len(getattr(nmm.inputs, 'Osc%dAm'%i).cables): mod = self.add_module('LevMult', name='Am%d' % i) self.connect(osc.outputs.Out, mod.inputs.In) self.connect(mod.outputs.Out, getattr(g2m.inputs, 'In%d'%i)) self.inputs[2+i] = mod.inputs.Mod else: self.connect(osc.outputs.Out, getattr(g2m.inputs, 'In%d'%i)) if len(nmm.inputs.Sync.cables): self.inputs[2] = oscs[0].inputs.Sync if len(oscs) > 1: for i in xrange(1, len(oscs)): self.connect(oscs[i-1].inputs.Sync, oscs[i].inputs.Sync) if len(nmm.inputs.Mst.cables): self.inputs[0] = oscs[0].inputs.Pitch if len(oscs) > 1: for i in xrange(1, len(oscs)): self.connect(oscs[i-1].inputs.Pitch, oscs[i].inputs.Pitch) self.oscs = oscs sinepostmst(self, 0)
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params if self.maing2module == 'DelayDual': setv(g2mp.Time2, 63) # 2.64mS setv(g2mp.Time1, (getv(nmmp.Time) + 1) / 2) setv(g2mp.Time1Mod, (getv(nmmp.Modulation) + 1) / 2) else: setv(g2mp.Time, (getv(nmmp.Time) + 1) / 2) setv(g2mp.TimeMod, (getv(nmmp.Modulation) + 1) / 2)
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params if self.maing2module == 'DelayDual': setv(g2mp.Time2, 63) # 2.64mS setv(g2mp.Time1, (getv(nmmp.Time)+1)/2) setv(g2mp.Time1Mod, (getv(nmmp.Modulation)+1)/2) else: setv(g2mp.Time, (getv(nmmp.Time)+1)/2) setv(g2mp.TimeMod, (getv(nmmp.Modulation)+1)/2)
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params setv(g2mp.Kbt, 0) l = getv(nmmp.LeftGain) r = getv(nmmp.RightGain) velsens = getv(nmmp.VelocitySensitivity) external = 0 for paramnm in ['VelocitySensitivity', 'LeftGain', 'RightGain']: param = getattr(nmmp, paramnm) for checknm in ['knob', 'ctrl', 'morph']: if getattr(param, checknm) != None: external = 1 less8db = (abs(l-24) <= 8 and abs(r-24) <= 8) velinp = len(nmm.inputs.Velocity.cables) != 0 setv(g2mp.L, notescale[l][1]) setv(g2mp.R, notescale[r][1]) if not external and less8db and not velinp and velsens == 0 : return if not less8db: setv(g2mp.Kbt, 0) setv(g2mp.L, notescale[l][0]) setv(g2mp.R, notescale[r][0]) levmult1 = self.add_module('LevMult', name='24db') self.connect(g2m.outputs.Level, g2m.inputs.In) self.connect(g2m.outputs.Level, levmult1.inputs.Mod) self.connect(g2m.outputs.Out, levmult1.inputs.In) out = levmult1.outputs.Out if not velinp and velsens == 0: self.outputs[0] = levmult1.outputs.Out return else: out = g2m.outputs.Level mix21b = self.add_module('Mix2-1B', name='Vel') setv(mix21b.params.Inv2, 1) setv(mix21b.params.Lev1, 88) setv(mix21b.params.Lev2, 16) self.connect(mix21b.inputs.Chain, mix21b.inputs.In1) self.connect(mix21b.inputs.In1, mix21b.inputs.In2) levmult2 = self.add_module('LevMult', name='') xfade = self.add_module('X-Fade', name='VelSens') setv(xfade.params.LogLin, 1) # Lin self.connect(mix21b.outputs.Out, levmult2.inputs.Mod) self.connect(out, levmult2.inputs.In) self.connect(levmult2.inputs.In, xfade.inputs.In1) self.connect(levmult2.outputs.Out, xfade.inputs.In2) setv(xfade.params.Mix, velsens) self.params[0] = xfade.params.Mix self.inputs[0] = mix21b.inputs.Chain self.outputs[0] = xfade.outputs.Out
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params shpexp = self.add_module('ShpExp') setv(shpexp.params.Curve, 2) # x4 setv(shpexp.params.Amount, 127) constswt = self.add_module('ConstSwT') setv(constswt.params.On, 1) setv(constswt.params.Lev, getv(nmmp.Gain)) setv(constswt.params.BipUni, getv(nmmp.Unipolar)) self.connect(shpexp.outputs.Out, g2m.inputs.Mod) self.connect(constswt.outputs.Out, shpexp.inputs.In) self.params = constswt.params.Lev, constswt.params.BipUni
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params waveform = getv(nmmp.Waveform) setv(g2mp.Waveform, [0, 1, 2, 2, 3][waveform]) if waveform != 3: setv(g2mp.OutputType, 5) # BipInv setv(g2mp.Active, 1 - getv(nmmp.Mute)) self.kbt = g2m.params.Kbt ratemodin, rateparam, slv, kbt = handleslv(self, g2m.inputs.RateVar, g2mp.RateMod) self.inputs[0], self.outputs[1], kbt = ratemodin, slv, kbt
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params waveform = getv(nmmp.Waveform) setv(g2mp.Waveform, [0, 1, 2, 2, 3][waveform]) if waveform != 3: setv(g2mp.OutputType, 5) # BipInv setv(g2mp.Active, 1-getv(nmmp.Mute)) self.kbt = g2m.params.Kbt ratemodin, rateparam, slv, kbt = handleslv(self, g2m.inputs.RateVar, g2mp.RateMod) self.inputs[0], self.outputs[1], kbt = ratemodin, slv, kbt
def handlepw(conv, pw, haspw, shape, shapemod): nmm, g2m = conv.nmmodule, conv.g2module nmmp, g2mp = nmm.params, g2m.params # add mix2-1b so input can be doubled/inverted pwmod = None if haspw: pw = getv(nmmp.PulseWidth) else: pw = 0 if len(nmm.inputs.PwMod.cables): clip = conv.add_module('Clip', name='PWLimit') setv(clip.params.Shape, 1) # Sym mix11a = conv.add_module('Mix1-1A', name='ShapeMod') setv(mix11a.params.ExpLin, 1) # Lin setv(mix11a.params.On, 1) mix11a.params.On.labels = ['Mod'] if haspw and pw != 64: constswt = conv.add_module('ConstSwT', name='Shape') setv(constswt.params.On, 1) constswt.params.On.labels = ['Shape'] mix21b = conv.add_module('Mix2-1B', name='ModIn') conv.connect(clip.outputs.Out, g2m.inputs.ShapeMod) conv.connect(mix11a.outputs.Out, clip.inputs.In) if haspw and pw != 64: conv.connect(constswt.outputs.Out, mix11a.inputs.Chain) conv.connect(mix21b.outputs.Out, mix11a.inputs.In) setv(constswt.params.Lev, pw) else: conv.connect(mix21b.outputs.Out, mix11a.inputs.In) conv.connect(mix21b.inputs.In1, mix21b.inputs.In2) setv(clip.params.ClipLev, 2) setv(mix21b.params.Lev1, 126) setv(mix21b.params.Lev2, 127) setv(g2mp.Shape, 0) setv(g2mp.ShapeMod, 127) setv(mix11a.params.Lev, getv(nmmp.PwMod)) conv.params[shapemod] = mix11a.params.Lev if shape > -1 and pw != 64: conv.params[shape] = constswt.params.Lev return mix21b.inputs.In1 elif haspw and pw != 64: constswt = conv.add_module('ConstSwT', name='Shape') setv(constswt.params.On, 1) constswt.params.On.labels = ['Shape'] setv(constswt.params.Lev, pw) setv(g2mp.Shape, 0) setv(g2mp.ShapeMod, 126) conv.connect(constswt.outputs.Out, g2m.inputs.ShapeMod) return pwmod
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params # handle special parameters waveform = getv(nmmp.Waveform) setv(g2mp.Waveform, [0, 1, 2, 2, 3][waveform]) if waveform != 3: setv(g2mp.OutputType, 5) # BipInv else: # 180 phase setv(g2mp.Phase, (range(64, 128) + range(64))[getv(nmmp.Phase)]) setv(g2mp.Active, 1 - getv(nmmp.Mute)) postmst(self, 0)
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params # handle special parameters waveform = getv(nmmp.Waveform) setv(g2mp.Waveform, [0, 1, 2, 2, 3][waveform]) if waveform != 3: setv(g2mp.OutputType, 5) # BipInv else: # 180 phase setv(g2mp.Phase, (range(64, 128)+range(64))[getv(nmmp.Phase)]) setv(g2mp.Active, 1-getv(nmmp.Mute)) postmst(self, 0)
def updatevals(g2mp, params, nm1g2_map): '''updatevals(g2mp, params, nm1g2_map) -> None change the time values of g2 module based on tables in ./units.py. ''' for param in params: midival = getv(getattr(g2mp, param)) setv(getattr(g2mp, param), nm1g2_map[midival])
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params handlegate(self) # handle special parameters updatevals(g2mp, ['Attack', 'Decay', 'Release'], adsrtime_map) if len(nmm.inputs.AttackMod.cables): levconv = self.add_module('LevConv', name='Attack') setv(levconv.params.InputType, 0) # Bip setv(levconv.params.OutputType, 5) # BipInv self.connect(levconv.outputs.Out, g2m.inputs.AttackMod) self.inputs[2] = levconv.inputs.In if len(nmm.inputs.DecayMod.cables): levconv = self.add_module('LevConv', name='Decay') setv(levconv.params.InputType, 0) # Bip setv(levconv.params.OutputType, 5) # BipInv self.connect(levconv.outputs.Out, g2m.inputs.DecayMod) self.inputs[3] = levconv.inputs.In if len(nmm.inputs.ReleaseMod.cables): levconv = self.add_module('LevConv', name='Release') setv(levconv.params.InputType, 0) # Bip setv(levconv.params.OutputType, 5) # BipInv self.connect(levconv.outputs.Out, g2m.inputs.ReleaseMod) self.inputs[5] = levconv.inputs.In setv(g2mp.OutputType, [0, 3][getv(nmmp.Invert)]) self.inputs[:2] = handleretrig(self)
def handlekbt(conv, input, kbt100, addalways=False): """handlekbt(conv, input, kbt100, addalways=False) -> input """ nmm, g2m = conv.nmmodule, conv.g2module nmmp, g2mp = nmm.params, g2m.params kbt = getv(nmmp.Kbt) if addalways: pass elif kbt == 0: setv(conv.kbt, kbt) return None elif kbt == 64: setv(conv.kbt, kbt100) return None if not g2m.area.keyboard: g2m.area.keyboard = conv.add_module("Keyboard") keyboard = g2m.area.keyboard setv(conv.kbt, 0) mix21b = conv.add_module("Mix2-1B", name="Kbt") conv.connect(keyboard.outputs.Note, mix21b.inputs.In1) conv.connect(mix21b.inputs.In1, mix21b.inputs.In2) conv.connect(mix21b.outputs.Out, input) setv(mix21b.params.ExpLin, 1) # Lin setv(mix21b.params.Lev1, kbttable[kbt][0]) setv(mix21b.params.Lev2, kbttable[kbt][1]) return input
def handlekbt(conv, input, kbt100, addalways=False): '''handlekbt(conv, input, kbt100, addalways=False) -> input ''' nmm, g2m = conv.nmmodule, conv.g2module nmmp, g2mp = nmm.params, g2m.params kbt = getv(nmmp.Kbt) if addalways: pass elif kbt == 0: setv(conv.kbt, kbt) return None elif kbt == 64: setv(conv.kbt, kbt100) return None if not g2m.area.keyboard: g2m.area.keyboard = conv.add_module('Keyboard') keyboard = g2m.area.keyboard setv(conv.kbt, 0) mix21b = conv.add_module('Mix2-1B', name='Kbt') conv.connect(keyboard.outputs.Note, mix21b.inputs.In1) conv.connect(mix21b.inputs.In1, mix21b.inputs.In2) conv.connect(mix21b.outputs.Out, input) setv(mix21b.params.ExpLin, 1) # Lin setv(mix21b.params.Lev1, kbttable[kbt][0]) setv(mix21b.params.Lev2, kbttable[kbt][1]) return input
def __init__(self, nmarea, g2area, nmmodule, options): # use mixer if knobs, morphs, or midi cc's assigned and connected usemixer = False for i in xrange(1, 5): level = getattr(nmmodule.params, 'Level%d' % i) innet = getattr(nmmodule.inputs, 'In%d' % i).net if not innet: continue if level.knob or level.morph or level.ctrl: usemixer = True if getv(level) != 127 and getv(level) != 0: usemixer = True if usemixer: self.maing2module = 'Mix4-1C' self.parammap[0] = None super(Conv4_1Switch, self).__init__(nmarea, g2area, nmmodule, options)
def updatevals(g2mp, params, nm1g2_map): """updatevals(g2mp, params, nm1g2_map) -> None change the time values of g2 module based on tables in ./units.py. """ for param in params: midival = getv(getattr(g2mp, param)) setv(getattr(g2mp, param), nm1g2_map[midival])
def __init__(self, nmarea, g2area, nmmodule, options): lev = nmmodule.params.Level if getv(lev) == 127 and not lev.knob and not lev.morph and not lev.ctrl: self.maing2module = '2-Out' if len(filter(isxoutput, nmarea.modules)) < 2: self.maing2module = '2-Out' Convert.__init__(self, nmarea, g2area, nmmodule, options)
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params if getv(nmmp.Color) == 1: setv(g2mp.StepProb, 43) else: setv(g2mp.StepProb, 127)
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params mode = getv(nmmp.Mode) setv(g2mp.Mode, [0, 1, 0, 2, 3][mode]) if mode == 2: setv(g2mp.Active, 0)
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params g2m.name = 'KbdSplit' # now lets create the structure struct = [ ['Constant', 'Upper'], ['CompLev', 'Lower'], ['CompSig', '<=Upper'], ['Gate', 'Gate'], ] for mod, nm in struct: self.add_module(mod, name=nm) u, l, lu, g = self.g2modules setv(u.params.Level, getv(nmmp.Upper)) setv(l.params.C, getv(nmmp.Lower)) self.connect(u.outputs.Out, lu.inputs.A) self.connect(l.inputs.In, lu.inputs.B) self.connect(l.outputs.Out, g.inputs.In1_1) self.connect(lu.outputs.Out, g.inputs.In1_2) self.connect(g.outputs.Out1, g.inputs.In2_2) gout = g.outputs.Out2 nout = None if len(nmm.outputs.Note.cables): n = self.add_module('DlyClock', name='Note') self.connect(gout, n.inputs.Clk) self.connect(lu.inputs.B, n.inputs.In) gout = n.inputs.Clk nout = n.outputs.Out vin = vout = None if len(nmm.outputs.Vel.cables) or len(nmm.inputs.Vel.cables): v = self.add_module('DlyClock', name='Vel') self.connect(gout, v.inputs.Clk) vin = v.inputs.In vout = v.outputs.Out self.params = [l.params.C, u.params.Level] self.outputs = [nout, g.outputs.Out2, vout] self.inputs = [l.inputs.In, g.inputs.In2_1, vin]
def __init__(self, nmarea, g2area, nmmodule, options): lev = nmmodule.params.Level if getv(lev ) == 127 and not lev.knob and not lev.morph and not lev.ctrl: self.maing2module = '2-Out' if len(filter(isxoutput, nmarea.modules)) < 2: self.maing2module = '2-Out' Convert.__init__(self, nmarea, g2area, nmmodule, options)
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params setv(g2mp.Active, 1-getv(nmmp.Bypass)) setv(g2mp.FBMod, getv(nmmp.Depth)) setv(g2mp.Type, 3) setv(g2mp.Level, modtable[getv(nmmp.Level)][0]) if len(nmm.inputs.FreqMod.cables): # add mixer mix = self.add_module('Mix2-1B', name='FreqMod') self.connect(mix.outputs.Out, g2m.inputs.PitchVar) modinp = mix.inputs.In1 self.inputs[1] = mix.inputs.In2 setv(g2mp.PitchMod, 127) setv(mix.params.Lev1, getv(nmmp.FreqMod)) depthparam = mix.params.Lev1 else: modinp = g2m.inputs.PitchVar depthparam = g2mp.PitchMod lfo = self.add_module('LfoC') setv(lfo.params.Rate, getv(nmmp.Rate)) self.params[0] = lfo.params.Rate setv(lfo.params.Active, getv(nmmp.Lfo)) self.params[1] = lfo.params.Active self.connect(lfo.outputs.Out, modinp) setv(depthparam, getv(nmmp.Depth)) self.params[9] = depthparam
def domodule(self): nmm, g2m = self.nmmodule, self.g2module nmmp, g2mp = nmm.params, g2m.params setv(g2mp.StepProb, 96) lfoc = self.add_module('LfoC', name='Clk') self.connect(lfoc.outputs.Out, g2m.inputs.Clk) setv(lfoc.params.Rate, getv(nmmp.Density)) self.params[0] = lfoc.params.Rate