Beispiel #1
0
    def domodule(self):
        nmm, g2m = self.nmmodule, self.g2module
        nmmp, g2mp = nmm.params, g2m.params

        oclks = [[5, '16', 0], [7, 'T8', 1], [11, '8', 2]]
        clks = oclks[:]
        while len(clks):
            clk = clks.pop(0)
            if len(getattr(nmm.outputs, clk[1]).cables) != 0:
                break
        if len(clks) == 0:
            clk = oclks[0]

        g2m.modes.DivMode.value = 1
        setv(g2mp.Divider, clk[0])
        g2m.name = clk[1]
        self.outputs[clk[2]] = g2m.outputs.Out

        rst, midiclk = g2m.inputs.Rst, g2m.inputs.Clk
        for div, nm, out in clks:
            if len(getattr(nmm.outputs, nm).cables) == 0:
                continue
            clk = self.add_module('ClkDiv', name=nm)
            clk.modes.DivMode.value = 1
            setv(clk.params.Divider, div)
            self.connect(rst, clk.inputs.Rst)
            self.connect(midiclk, clk.inputs.Clk)
            rst, midiclk = clk.inputs.Rst, clk.inputs.Clk
            self.outputs[out] = clk.outputs.Out
Beispiel #2
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])
Beispiel #3
0
    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
Beispiel #4
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]
Beispiel #5
0
  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
Beispiel #6
0
    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
Beispiel #7
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])
Beispiel #8
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]
Beispiel #9
0
  def domodule(self):
    nmm, g2m = self.nmmodule, self.g2module
    nmmp, g2mp = nmm.params, g2m.params

    oclks = [[5, '16', 0], [7, 'T8', 1], [11, '8', 2]]
    clks = oclks[:]
    while len(clks):
      clk = clks.pop(0)
      if len(getattr(nmm.outputs, clk[1]).cables) != 0:
        break
    if len(clks) == 0:
      clk = oclks[0]

    g2m.modes.DivMode.value = 1
    setv(g2mp.Divider, clk[0])
    g2m.name = clk[1]
    self.outputs[clk[2]] = g2m.outputs.Out

    rst, midiclk = g2m.inputs.Rst, g2m.inputs.Clk
    for div, nm, out in clks:
      if len(getattr(nmm.outputs, nm).cables) == 0:
        continue
      clk = self.add_module('ClkDiv', name=nm)
      clk.modes.DivMode.value = 1
      setv(clk.params.Divider, div)
      self.connect(rst, clk.inputs.Rst)
      self.connect(midiclk, clk.inputs.Clk)
      rst, midiclk = clk.inputs.Rst, clk.inputs.Clk
      self.outputs[out] = clk.outputs.Out
Beispiel #10
0
Datei: osc.py Projekt: msg/g2ools
  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
Beispiel #11
0
def handlegate(conv, name='Gate'):
    gate = getattr(conv.nmmodule.inputs, name)
    # if gate source Keyboard, disconnect and set KB
    if not gate or not gate.net or not gate.net.output:
        return
    if gate.net.output.module.type.shortnm == 'Keyboard':
        conv.nmmodule.area.removeconnector(gate)
        setv(conv.g2module.params.KB, 1)
Beispiel #12
0
    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])
Beispiel #13
0
    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)
Beispiel #14
0
Datei: env.py Projekt: msg/g2ools
def handlegate(conv, name='Gate'):
  gate = getattr(conv.nmmodule.inputs, name)
  # if gate source Keyboard, disconnect and set KB
  if not gate or not gate.net or not gate.net.output:
    return
  if gate.net.output.module.type.shortnm == 'Keyboard':
    conv.nmmodule.area.removeconnector(gate)
    setv(conv.g2module.params.KB, 1)
Beispiel #15
0
 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])
Beispiel #16
0
Datei: lfo.py Projekt: msg/g2ools
  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)
Beispiel #17
0
 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)
Beispiel #18
0
    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)
Beispiel #19
0
Datei: lfo.py Projekt: msg/g2ools
  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
Beispiel #20
0
    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)
        setv(g2mp.OutputType, [0, 3][getv(nmmp.Invert)])
        self.inputs[1:3] = handleretrig(self)
Beispiel #21
0
 def domodule(self):
   nmm, g2m = self.nmmodule, self.g2module
   nmmp, g2mp = nmm.params, g2m.params
   
   porttime = [ .5*val for val in g2adsrtime]
   nm1midival = getv(nmmp.Time)
   g2midival = nm2g2val(nm1midival, nm1adsrtime, porttime)
   setv(g2mp.Time, g2midival)
   setv(g2mp.Glide, 0)
Beispiel #22
0
    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
Beispiel #23
0
Datei: env.py Projekt: msg/g2ools
  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)
    setv(g2mp.OutputType, [0, 3][getv(nmmp.Invert)])
    self.inputs[1:3] = handleretrig(self)
Beispiel #24
0
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
Beispiel #25
0
    def domodule(self):
        nmm, g2m = self.nmmodule, self.g2module
        nmmp, g2mp = nmm.params, g2m.params
        handlegate(self, 'Trigger')

        # handle special parameters
        updatevals(g2mp, ['Attack', 'Release'], adsrtime_map)
        if self.options.adsrforad:
            printf('%s\n', g2m.type.shortnm)
            setv(g2mp.Sustain, 0)
            setv(g2mp.Decay, getv(g2mp.Release))
Beispiel #26
0
    def domodule(self):
        nmm, g2m = self.nmmodule, self.g2module
        nmmp, g2mp = nmm.params, g2m.params

        shift = getv(nmmp.Shift)
        if shift:
            conv = self.add_module('LevConv')
            self.connect(conv.outputs.Out, g2m.inputs.Mod)
            setv(conv.params.OutputType, 0)  # Pos
            self.params[0] = conv.params.OutputType
            self.inputs[0] = conv.inputs.In
Beispiel #27
0
Datei: env.py Projekt: msg/g2ools
  def domodule(self):
    nmm, g2m = self.nmmodule, self.g2module
    nmmp, g2mp = nmm.params, g2m.params
    handlegate(self, 'Trigger')

    # handle special parameters
    updatevals(g2mp, ['Attack', 'Release'], adsrtime_map)
    if self.options.adsrforad:
      printf('%s\n', g2m.type.shortnm)
      setv(g2mp.Sustain, 0)
      setv(g2mp.Decay, getv(g2mp.Release))
Beispiel #28
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)
Beispiel #29
0
    def domodule(self):
        nmm, g2m = self.nmmodule, self.g2module
        nmmp, g2mp = nmm.params, g2m.params

        setv(g2mp.FreqMode, [1, 0][nmm.modes[0].value])

        # handle special inputs
        p1, p2 = handledualpitchmod(self, g2m.inputs.PitchVar,
                                    g2m.params.PitchMod, 3, 4)
        self.inputs[:2] = [p1, p2]
        self.outputs[0] = handleoscmasterslv(self, g2m, 44, 64, 69, 103, 42)
Beispiel #30
0
  def domodule(self):
    nmm, g2m = self.nmmodule, self.g2module
    nmmp, g2mp = nmm.params, g2m.params

    shift = getv(nmmp.Shift)
    if shift:
      conv = self.add_module('LevConv')
      self.connect(conv.outputs.Out, g2m.inputs.Mod)
      setv(conv.params.OutputType, 0) # Pos
      self.params[0] = conv.params.OutputType
      self.inputs[0] = conv.inputs.In
Beispiel #31
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)
Beispiel #32
0
Datei: osc.py Projekt: msg/g2ools
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
Beispiel #33
0
Datei: osc.py Projekt: msg/g2ools
  def domodule(self):
    nmm, g2m = self.nmmodule, self.g2module
    nmmp, g2mp = nmm.params, g2m.params

    setv(g2mp.FreqMode, [1, 0][nmm.modes[0].value])

    # handle special inputs
    p1, p2 = handledualpitchmod(self, g2m.inputs.PitchVar, g2m.params.PitchMod,
        3, 4)
    self.inputs[:2] = [p1, p2]
    self.outputs[0] = handleoscmasterslv(self, g2m, 44, 64, 69, 103, 42)
Beispiel #34
0
Datei: seq.py Projekt: msg/g2ools
  def domodule(self):
    nmm, g2m = self.nmmodule, self.g2module
    nmmp, g2mp = nmm.params, g2m.params

    for j in xrange(2):
      for i in xrange(16):
        s = 'Seq%dStep%d' % (j+1, i+1)
        step = getattr(g2mp, s)
        setv(step, getv(getattr(nmmp, s)))
        self.params[4+j*16+i] = step

    self.outputs[3] = handlelength(self)
Beispiel #35
0
Datei: lfo.py Projekt: msg/g2ools
  def domodule(self):
    nmm, g2m = self.nmmodule, self.g2module
    nmmp, g2mp = nmm.params, g2m.params

    # handle special parameters
    g2m.modes.Waveform.value = self.waveform
    if self.waveform != 2:
      setv(g2mp.OutputType, 4) # Bip
    else:
      setv(g2mp.OutputType, 5) # BipInv

    postmst(self, 0)
Beispiel #36
0
    def domodule(self):
        nmm, g2m = self.nmmodule, self.g2module
        nmmp, g2mp = nmm.params, g2m.params

        # handle special parameters
        g2m.modes.Waveform.value = self.waveform
        if self.waveform != 2:
            setv(g2mp.OutputType, 4)  # Bip
        else:
            setv(g2mp.OutputType, 5)  # BipInv

        postmst(self, 0)
Beispiel #37
0
    def domodule(self):
        nmm, g2m = self.nmmodule, self.g2module
        nmmp, g2mp = nmm.params, g2m.params

        for j in xrange(2):
            for i in xrange(16):
                s = 'Seq%dStep%d' % (j + 1, i + 1)
                step = getattr(g2mp, s)
                setv(step, getv(getattr(nmmp, s)))
                self.params[4 + j * 16 + i] = step

        self.outputs[3] = handlelength(self)
Beispiel #38
0
  def domodule(self):
    ConvFilter.domodule(self)
    nmm, g2m = self.nmmodule, self.g2module
    nmmp, g2mp = nmm.params, g2m.params

    setv(g2mp.Active, 1-getv(nmmp.Bypass))
    # handle special inputs
    p1, p2 = fltdualpitchmod(nmm, g2m, self, 3, 4)
    self.inputs[0:2] = p1, p2

    self.kbt = g2mp.Kbt
    handlekbt(self, g2m.inputs.Pitch, 4) # 4=Kbt 100%
Beispiel #39
0
    def domodule(self):
        ConvFilter.domodule(self)
        nmm, g2m = self.nmmodule, self.g2module
        nmmp, g2mp = nmm.params, g2m.params

        setv(g2mp.Active, 1 - getv(nmmp.Bypass))
        # handle special inputs
        p1, p2 = fltdualpitchmod(nmm, g2m, self, 3, 4)
        self.inputs[0:2] = p1, p2

        self.kbt = g2mp.Kbt
        handlekbt(self, g2m.inputs.Pitch, 4)  # 4=Kbt 100%
Beispiel #40
0
Datei: seq.py Projekt: msg/g2ools
  def domodule(self):
    nmm, g2m = self.nmmodule, self.g2module
    nmmp, g2mp = nmm.params, g2m.params

    for i in xrange(16):
      s = 'Seq1Step%d' % (i+1)
      step = getattr(g2mp, s)
      t = 'Ctrl%d' % (i+1)
      setv(step, getv(getattr(nmmp, t)))
      self.params[i] = step

    self.outputs[2] = handlelength(self)
Beispiel #41
0
    def domodule(self):
        nmm, g2m = self.nmmodule, self.g2module
        nmmp, g2mp = nmm.params, g2m.params

        for i in xrange(16):
            s = 'Seq1Step%d' % (i + 1)
            step = getattr(g2mp, s)
            t = 'Ctrl%d' % (i + 1)
            setv(step, getv(getattr(nmmp, t)))
            self.params[i] = step

        self.outputs[2] = handlelength(self)
Beispiel #42
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
Beispiel #43
0
    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
Beispiel #44
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
Beispiel #45
0
  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
Beispiel #46
0
    def domodule(self):
        nmm, g2m = self.nmmodule, self.g2module
        nmmp, g2mp = nmm.params, g2m.params

        setv(g2mp.Pad, [2, 1][getv(getattr(nmmp, '+6Db'))])
        lboost = self.add_module('LevAmp', name='L-Boost')
        setv(lboost.params.Type, 0)  # Lin
        setv(lboost.params.Gain, 96)  # x2.00
        self.connect(g2m.outputs.OutL, lboost.inputs.In)
        self.outputs[0] = lboost.outputs.Out

        rboost = self.add_module('LevAmp', name='R-Boost')
        setv(rboost.params.Type, 0)  # Lin
        setv(rboost.params.Gain, 96)  # x2.00
        self.connect(g2m.outputs.OutR, rboost.inputs.In)
        self.outputs[1] = rboost.outputs.Out
Beispiel #47
0
  def domodule(self):
    nmm, g2m = self.nmmodule, self.g2module
    nmmp, g2mp = nmm.params, g2m.params

    setv(g2mp.Pad, [2, 1][getv(getattr(nmmp, '+6Db'))])
    lboost = self.add_module('LevAmp', name='L-Boost')
    setv(lboost.params.Type, 0) # Lin
    setv(lboost.params.Gain, 96) # x2.00
    self.connect(g2m.outputs.OutL, lboost.inputs.In)
    self.outputs[0] = lboost.outputs.Out

    rboost = self.add_module('LevAmp', name='R-Boost')
    setv(rboost.params.Type, 0) # Lin
    setv(rboost.params.Gain, 96) # x2.00
    self.connect(g2m.outputs.OutR, rboost.inputs.In)
    self.outputs[1] = rboost.outputs.Out
Beispiel #48
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]
Beispiel #49
0
    def domodule(self):
        nmm, g2m = self.nmmodule, self.g2module
        nmmp, g2mp = nmm.params, g2m.params

        # note going to handle this as there is no Active.
        #setv(g2mp.Active, 1-getv(nmmp.Mute))

        level = getv(nmmp.Level)
        if level != 0 or level != 127 or \
          nmmp.Level.knob or nmmp.Level.morph or nmmp.Level.ctrl:
            # add LevAmp module
            mix11a = self.add_module('Mix1-1A')
            self.connect(mix11a.outputs.Out, g2m.inputs.In)
            setv(mix11a.params.On, 1)
            setv(mix11a.params.Lev, modtable[level][0])
            self.params[1] = mix11a.params.Lev
            self.inputs[0] = mix11a.inputs.In
Beispiel #50
0
  def domodule(self):
    nmm, g2m = self.nmmodule, self.g2module
    nmmp, g2mp = nmm.params, g2m.params

    # note going to handle this as there is no Active.
    #setv(g2mp.Active, 1-getv(nmmp.Mute))

    level = getv(nmmp.Level)
    if level != 0 or level != 127 or \
      nmmp.Level.knob or nmmp.Level.morph or nmmp.Level.ctrl:
      # add LevAmp module
      mix11a = self.add_module('Mix1-1A')
      self.connect(mix11a.outputs.Out, g2m.inputs.In)
      setv(mix11a.params.On, 1)
      setv(mix11a.params.Lev, modtable[level][0])
      self.params[1] = mix11a.params.Lev
      self.inputs[0] = mix11a.inputs.In
Beispiel #51
0
    def __init__(self, nmarea, g2area, nmmodule, options):
        '''Convert(nmarea, g2area, nmmodule, options) -> Convert
    create a convert object from a nm1 module in nmarea to g2area.
    '''
        self.nmarea = nmarea
        self.g2area = g2area
        nmm = self.nmmodule = nmmodule
        nmm.conv = self  # to get back here when needed (cables)
        self.options = options
        # use for cabling
        for output in nmmodule.outputs:
            output.conv = self
        for input in nmmodule.inputs:
            input.conv = self
        self.g2modules = []
        self.params = []
        self.outputs = []
        self.inputs = []

        # create main module and setup size requirements
        g2m = self.g2module = g2area.add_module(self.maing2module)
        g2m.name = toascii(nmm.name)
        self.horiz = g2m.horiz = nmm.horiz
        self.height = g2m.type.height

        # setup parameters from parammap static member of convert module class
        self.params = [None] * len(self.parammap)
        for i, param in enumerate(self.parammap):
            if type(param) == type(''):
                setv(getattr(g2m.params, param),
                     getv(getattr(nmm.params, param)))
                self.params[i] = getattr(g2m.params, param)
            elif type(param) == type([]):
                setv(getattr(g2m.params, param[0]),
                     getv(getattr(nmm.params, param[1])))
                self.params[i] = getattr(g2m.params, param[0])
            else:
                self.params[
                    i] = param  # None: placeholder for other parameters

        # setup inputs from inputmap static member of convert module class
        self.inputs = [getattr(g2m.inputs, i, None) for i in self.inputmap]

        # setup outputs from outputmap static member of convert module class
        self.outputs = [getattr(g2m.outputs, o, None) for o in self.outputmap]
Beispiel #52
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]
Beispiel #53
0
    def __init__(self, nmarea, g2area, nmmodule, options):
        """Convert(nmarea, g2area, nmmodule, options) -> Convert
    create a convert object from a nm1 module in nmarea to g2area.
    """
        self.nmarea = nmarea
        self.g2area = g2area
        nmm = self.nmmodule = nmmodule
        nmm.conv = self  # to get back here when needed (cables)
        self.options = options
        # use for cabling
        for output in nmmodule.outputs:
            output.conv = self
        for input in nmmodule.inputs:
            input.conv = self
        self.g2modules = []
        self.params = []
        self.outputs = []
        self.inputs = []

        # create main module and setup size requirements
        g2m = self.g2module = g2area.add_module(self.maing2module)
        g2m.name = toascii(nmm.name)
        self.horiz = g2m.horiz = nmm.horiz
        self.height = g2m.type.height

        # setup parameters from parammap static member of convert module class
        self.params = [None] * len(self.parammap)
        for i, param in enumerate(self.parammap):
            if type(param) == type(""):
                setv(getattr(g2m.params, param), getv(getattr(nmm.params, param)))
                self.params[i] = getattr(g2m.params, param)
            elif type(param) == type([]):
                setv(getattr(g2m.params, param[0]), getv(getattr(nmm.params, param[1])))
                self.params[i] = getattr(g2m.params, param[0])
            else:
                self.params[i] = param  # None: placeholder for other parameters

        # setup inputs from inputmap static member of convert module class
        self.inputs = [getattr(g2m.inputs, i, None) for i in self.inputmap]

        # setup outputs from outputmap static member of convert module class
        self.outputs = [getattr(g2m.outputs, o, None) for o in self.outputmap]
Beispiel #54
0
def pitchadj(conv, pitchparam, pitchinput, tableentry):
    global modindex
    setv(pitchparam, tableentry[0])
    if tableentry[1] == 0 and tableentry[2] == 0:
        return pitchinput
    adj1 = conv.add_module('Mix2-1B', name='PitchAdj%d' % modindex.pitchadj)
    conv.connect(adj1.inputs.Chain, adj1.inputs.In1)
    conv.connect(adj1.inputs.In1, adj1.inputs.In2)
    conv.connect(adj1.outputs.Out, pitchinput)
    setv(adj1.params.Inv2, 1)
    setv(adj1.params.Lev1, tableentry[1])
    setv(adj1.params.Lev2, tableentry[2])
    return adj1.inputs.Chain
Beispiel #55
0
Datei: osc.py Projekt: msg/g2ools
def pitchadj(conv, pitchparam, pitchinput, tableentry):
  global modindex
  setv(pitchparam, tableentry[0])
  if tableentry[1] == 0 and tableentry[2] == 0:
    return pitchinput
  adj1 = conv.add_module('Mix2-1B', name='PitchAdj%d' % modindex.pitchadj)
  conv.connect(adj1.inputs.Chain, adj1.inputs.In1)
  conv.connect(adj1.inputs.In1, adj1.inputs.In2)
  conv.connect(adj1.outputs.Out, pitchinput)
  setv(adj1.params.Inv2, 1)
  setv(adj1.params.Lev1, tableentry[1])
  setv(adj1.params.Lev2, tableentry[2])
  return adj1.inputs.Chain
Beispiel #56
0
  def convert(self):
    # loop through each module
    #   determine and store separation from module above >= 0
    #   if mod in convertion table
    #     call convertion table module function
    # loop through each cable
    #   if source and dest in convertion table
    #     create new connection
    # update midi controller assignments
    # update knob assignments (on pags A1:1, A1:2 and A1:3)
    # update morph assignments
    # reorder modules top to bottom, left to right
    # relocate modules top to bottom, left to right based on separation
    # add name bar with my name and convertion info
    # add name bar with errors/comments etc.
    # save g2 file

    # other ideas:
    # create patch equal function
    # create patch merge function that updates variations
    #   of one patch from another.
    g2patch, nmpatch = self.g2patch, self.nmpatch

    setv(g2patch.settings.patchvol, 127)
    for color in ['red', 'blue', 'yellow', 'green', 'purple']:
      setattr(g2patch.description, color, getattr(nmpatch.header, color))
    if nmpatch.header.voices > 1:
      g2patch.description.monopoly = 0
      g2patch.description.voices = nmpatch.header.voices - 1
    setv(g2patch.settings.glide, nmpatch.header.porta)
    setv(g2patch.settings.glidetime, nmpatch.header.portatime)
    setv(g2patch.settings.octaveshift, nmpatch.header.octshift)

    self.log.info('--- area voice: ---')
    self.voiceconverters = self.doarea(nmpatch.voice, g2patch.voice)
    self.log.info('--- area fx: ---')
    self.fxconverters = self.doarea(nmpatch.fx, g2patch.fx)

    self.domorphs()
    self.doknobs()
    self.domidiccs()
    self.docurrentnotes()
    self.dofinalize()

    # handle text pad
    self.pch2.patch.textpad = self.pch.patch.textpad

    self.dotitleblock()

    self.log.info('Writing patch "%s2"' % (self.pch.filename))
    self.pch2.write(self.pch.filename+'2')
Beispiel #57
0
    def convert(self):
        # loop through each module
        #   determine and store separation from module above >= 0
        #   if mod in convertion table
        #     call convertion table module function
        # loop through each cable
        #   if source and dest in convertion table
        #     create new connection
        # update midi controller assignments
        # update knob assignments (on pags A1:1, A1:2 and A1:3)
        # update morph assignments
        # reorder modules top to bottom, left to right
        # relocate modules top to bottom, left to right based on separation
        # add name bar with my name and convertion info
        # add name bar with errors/comments etc.
        # save g2 file

        # other ideas:
        # create patch equal function
        # create patch merge function that updates variations
        #   of one patch from another.
        g2patch, nmpatch = self.g2patch, self.nmpatch

        setv(g2patch.settings.patchvol, 127)
        for color in ['red', 'blue', 'yellow', 'green', 'purple']:
            setattr(g2patch.description, color, getattr(nmpatch.header, color))
        if nmpatch.header.voices > 1:
            g2patch.description.monopoly = 0
            g2patch.description.voices = nmpatch.header.voices - 1
        setv(g2patch.settings.glide, nmpatch.header.porta)
        setv(g2patch.settings.glidetime, nmpatch.header.portatime)
        setv(g2patch.settings.octaveshift, nmpatch.header.octshift)

        self.log.info('--- area voice: ---')
        self.voiceconverters = self.doarea(nmpatch.voice, g2patch.voice)
        self.log.info('--- area fx: ---')
        self.fxconverters = self.doarea(nmpatch.fx, g2patch.fx)

        self.domorphs()
        self.doknobs()
        self.domidiccs()
        self.docurrentnotes()
        self.dofinalize()

        # handle text pad
        self.pch2.patch.textpad = self.pch.patch.textpad

        self.dotitleblock()

        self.log.info('Writing patch "%s2"' % (self.pch.filename))
        self.pch2.write(self.pch.filename + '2')
Beispiel #58
0
Datei: lfo.py Projekt: msg/g2ools
  def domodule(self):
    nmm, g2m = self.nmmodule, self.g2module
    nmmp, g2mp = nmm.params, g2m.params

    setv(g2mp.Active, getv(getattr(nmmp, 'On/Off')))
    setv(g2mp.Source, 0)  # Internal
    if len(nmm.outputs.Sync.cables) != 0:
      pulse = self.add_module('Pulse')
      setv(pulse.params.Time, 32)
      self.connect(g2m.outputs.ClkActive, pulse.inputs.In)
      self.outputs[3] = pulse.outputs.Out
    
    #handle Slv connections
    if len(nmm.outputs.Slv.cables):
      zerocnt = self.add_module('ZeroCnt', name='96th In')
      oscmaster = self.add_module('OscMaster', name='26-241 BPM')
      setv(oscmaster.params.FreqCoarse, 9) # -55 semi
      setv(oscmaster.params.Kbt, 0) # off
      self.connect(getattr(g2m.outputs, '1/96'), zerocnt.inputs.In)
      self.connect(zerocnt.outputs.Out, oscmaster.inputs.Pitch)
      self.outputs[2] = oscmaster.outputs.Out
Beispiel #59
0
    def domodule(self):
        nmm, g2m = self.nmmodule, self.g2module
        nmmp, g2mp = nmm.params, g2m.params

        setv(g2mp.Active, getv(getattr(nmmp, 'On/Off')))
        setv(g2mp.Source, 0)  # Internal
        if len(nmm.outputs.Sync.cables) != 0:
            pulse = self.add_module('Pulse')
            setv(pulse.params.Time, 32)
            self.connect(g2m.outputs.ClkActive, pulse.inputs.In)
            self.outputs[3] = pulse.outputs.Out

        #handle Slv connections
        if len(nmm.outputs.Slv.cables):
            zerocnt = self.add_module('ZeroCnt', name='96th In')
            oscmaster = self.add_module('OscMaster', name='26-241 BPM')
            setv(oscmaster.params.FreqCoarse, 9)  # -55 semi
            setv(oscmaster.params.Kbt, 0)  # off
            self.connect(getattr(g2m.outputs, '1/96'), zerocnt.inputs.In)
            self.connect(zerocnt.outputs.Out, oscmaster.inputs.Pitch)
            self.outputs[2] = oscmaster.outputs.Out