コード例 #1
0
def filter(input):
  infilter = DoubleInPointerFilter(input)
  infilter.output_sampling_rate = sampling_rate
  
  attackreleasefilter = DoubleAttackReleaseFilter(1)
  attackreleasefilter.input_sampling_rate = sampling_rate
  attackreleasefilter.set_input_port(0, infilter, 0)
  attackreleasefilter.attack = np.exp(-1/(sampling_rate*1e-3))
  attackreleasefilter.release = np.exp(-1/(sampling_rate*10e-3))
  
  outdata = np.zeros(processsize, dtype=np.float64)
  outfilter = DoubleOutPointerFilter(outdata)
  outfilter.input_sampling_rate = sampling_rate
  outfilter.set_input_port(0, attackreleasefilter, 0)
  
  attackreleasefilter2 = DoubleAttackReleaseHysteresisFilter(1)
  attackreleasefilter2.input_sampling_rate = sampling_rate
  attackreleasefilter2.set_input_port(0, infilter, 0)
  attackreleasefilter2.attack = np.exp(-1/(sampling_rate*1e-3))
  attackreleasefilter2.release = np.exp(-1/(sampling_rate*10e-3))
  attackreleasefilter2.release_hysteresis = .5
  attackreleasefilter2.attack_hysteresis = .9
  
  outdata2 = np.zeros(processsize, dtype=np.float64)
  outfilter_hyst = DoubleOutPointerFilter(outdata2)
  outfilter_hyst.input_sampling_rate = sampling_rate
  outfilter_hyst.set_input_port(0, attackreleasefilter2, 0)
  
  pipelineend = PipelineGlobalSinkFilter()
  pipelineend.input_sampling_rate = sampling_rate
  pipelineend.add_filter(outfilter)
  pipelineend.add_filter(outfilter_hyst)
  pipelineend.process(processsize)
  
  return outdata, outdata2
コード例 #2
0
def filter(input):
    infilter = DoubleInPointerFilter(input)
    infilter.output_sampling_rate = sampling_rate

    attackreleasefilter = DoubleAttackReleaseFilter(1)
    attackreleasefilter.input_sampling_rate = sampling_rate
    attackreleasefilter.set_input_port(0, infilter, 0)
    attackreleasefilter.attack = np.exp(-1 / (sampling_rate * 1e-3))
    attackreleasefilter.release = np.exp(-1 / (sampling_rate * 10e-3))

    outdata = np.zeros(processsize, dtype=np.float64)
    outfilter = DoubleOutPointerFilter(outdata)
    outfilter.input_sampling_rate = sampling_rate
    outfilter.set_input_port(0, attackreleasefilter, 0)

    attackreleasefilter2 = DoubleAttackReleaseHysteresisFilter(1)
    attackreleasefilter2.input_sampling_rate = sampling_rate
    attackreleasefilter2.set_input_port(0, infilter, 0)
    attackreleasefilter2.attack = np.exp(-1 / (sampling_rate * 1e-3))
    attackreleasefilter2.release = np.exp(-1 / (sampling_rate * 10e-3))
    attackreleasefilter2.release_hysteresis = .5
    attackreleasefilter2.attack_hysteresis = .9

    outdata2 = np.zeros(processsize, dtype=np.float64)
    outfilter_hyst = DoubleOutPointerFilter(outdata2)
    outfilter_hyst.input_sampling_rate = sampling_rate
    outfilter_hyst.set_input_port(0, attackreleasefilter2, 0)

    pipelineend = PipelineGlobalSinkFilter()
    pipelineend.input_sampling_rate = sampling_rate
    pipelineend.add_filter(outfilter)
    pipelineend.add_filter(outfilter_hyst)
    pipelineend.process(processsize)

    return outdata, outdata2
コード例 #3
0
def filter(input):
    import numpy as np
    output = np.zeros(input.shape, dtype=np.float64)

    infilter = DoubleInPointerFilter(input, False)
    infilter.input_sampling_rate = sample_rate

    powerfilter = DoublePowerFilter(1)
    powerfilter.input_sampling_rate = sample_rate
    powerfilter.set_input_port(0, infilter, 0)
    powerfilter.memory = np.exp(-1 / (sample_rate * 1e-3))

    attackreleasefilter = DoubleAttackReleaseFilter(1)
    attackreleasefilter.input_sampling_rate = sample_rate
    attackreleasefilter.set_input_port(0, powerfilter, 0)
    attackreleasefilter.attack = np.exp(-1 / (sample_rate * 1e-3))
    attackreleasefilter.release = np.exp(-1 / (sample_rate * 100e-3))

    gainfilter = DoubleGainCompressorFilter(1)
    gainfilter.input_sampling_rate = sample_rate
    gainfilter.set_input_port(0, attackreleasefilter, 0)
    gainfilter.threshold = 0.5
    gainfilter.ratio = 4
    gainfilter.softness = 1

    applygainfilter = DoubleApplyGainFilter(1)
    applygainfilter.input_sampling_rate = sample_rate
    applygainfilter.set_input_port(0, gainfilter, 0)
    applygainfilter.set_input_port(1, infilter, 0)

    outfilter = DoubleOutPointerFilter(output, False)
    outfilter.input_sampling_rate = sample_rate
    outfilter.set_input_port(0, applygainfilter, 0)
    outfilter.process(input.shape[1])

    return output
コード例 #4
0
def filter(input):
  import numpy as np
  output = np.zeros(input.shape, dtype=np.float64)

  infilter = DoubleInPointerFilter(input, False)
  infilter.input_sampling_rate = sample_rate

  powerfilter = DoublePowerFilter(1)
  powerfilter.input_sampling_rate = sample_rate
  powerfilter.set_input_port(0, infilter, 0)
  powerfilter.memory = np.exp(-1/(sample_rate*1e-3))

  attackreleasefilter = DoubleAttackReleaseFilter(1)
  attackreleasefilter.input_sampling_rate = sample_rate
  attackreleasefilter.set_input_port(0, powerfilter, 0)
  attackreleasefilter.attack = np.exp(-1/(sample_rate*1e-3))
  attackreleasefilter.release = np.exp(-1/(sample_rate*100e-3))

  gainfilter = DoubleGainCompressorFilter(1)
  gainfilter.input_sampling_rate = sample_rate
  gainfilter.set_input_port(0, attackreleasefilter, 0)
  gainfilter.threshold = 0.5
  gainfilter.ratio = 4
  gainfilter.softness = 1

  applygainfilter = DoubleApplyGainFilter(1)
  applygainfilter.input_sampling_rate = sample_rate
  applygainfilter.set_input_port(0, gainfilter, 0)
  applygainfilter.set_input_port(1, infilter, 0)

  outfilter = DoubleOutPointerFilter(output, False)
  outfilter.input_sampling_rate = sample_rate
  outfilter.set_input_port(0, applygainfilter, 0)
  outfilter.process(input.shape[1])

  return output