def filter(input, blend=0, feedback=0, feedforward=1): import numpy as np output = np.zeros(input.shape, dtype=np.float64) infilter = DoubleInPointerFilter(input, False) infilter.set_output_sampling_rate(sample_rate) generator = DoubleCachedSinusGeneratorFilter(1, 1) generator.set_output_sampling_rate(sample_rate) generator.set_volume(1e-3 * sample_rate) generator.set_offset(1.5e-3 * sample_rate) delayfilter = DoubleUniversalVariableDelayLineFilter(5000) delayfilter.set_input_sampling_rate(sample_rate) delayfilter.set_input_port(0, infilter, 0) delayfilter.set_input_port(1, generator, 0) delayfilter.set_blend(blend) delayfilter.set_feedback(feedback) delayfilter.set_feedforward(feedforward) outfilter = DoubleOutPointerFilter(output, False) outfilter.set_input_sampling_rate(sample_rate) outfilter.set_input_port(0, delayfilter, 0) outfilter.process(input.shape[1]) return output
def filter(input, blend=0, feedback=0, feedforward=1): import numpy as np output = np.zeros(input.shape, dtype=np.float64) infilter = DoubleInPointerFilter(input, False) infilter.set_output_sampling_rate(sample_rate) generator = DoubleCachedSinusGeneratorFilter(1, 1) generator.set_output_sampling_rate(sample_rate) generator.set_volume(1e-3 * sample_rate) generator.set_offset(1.5e-3 * sample_rate) delayfilter = DoubleUniversalVariableDelayLineFilter(5000) delayfilter.set_input_sampling_rate(sample_rate) delayfilter.set_input_port(0, infilter, 0) delayfilter.set_input_port(1, generator, 0) delayfilter.set_blend(blend) delayfilter.set_feedback(feedback) delayfilter.set_feedforward(feedforward) outfilter = DoubleOutPointerFilter(output, False) outfilter.set_input_sampling_rate(sample_rate) outfilter.set_input_port(0, delayfilter, 0) outfilter.process(input.shape[1]) return output
def filter(input, blend=0, feedback=0, feedforward=1): import numpy as np output = np.zeros(input.shape, dtype=np.float64) infilter = DoubleInPointerFilter(input, False) infilter.set_input_sampling_rate(sample_rate) noisefilter = DoubleCachedSinusGeneratorFilter(1, 2) noisefilter.set_input_sampling_rate(sample_rate) noisefilter.set_offset(10000) noisefilter.set_volume(2000) lowfilter = DoubleTimeVaryingBandPassCoefficientsIIRFilter() lowfilter.set_input_sampling_rate(sample_rate) lowfilter.set_Q(1) lowfilter.set_min_frequency(8000) lowfilter.set_max_frequency(12000) lowfilter.set_number_of_steps(10001) lowfilter.set_input_port(0, infilter, 0) lowfilter.set_input_port(1, noisefilter, 0) outfilter = DoubleOutPointerFilter(output, False) outfilter.set_input_sampling_rate(sample_rate) outfilter.set_input_port(0, lowfilter, 0) outfilter.process(input.shape[1]) return output
def filter(input): import numpy as np output = np.zeros(input.shape, dtype=np.float64) infilter = DoubleInPointerFilter(input, False) infilter.set_input_sampling_rate(sample_rate) sinusfilter = DoubleCachedSinusGeneratorFilter(20, 5) sinusfilter.set_input_sampling_rate(sample_rate) sinusfilter.set_offset(0.5) sinusfilter.set_volume(0.5) gainfilter = DoubleApplyGainFilter(1) gainfilter.set_input_sampling_rate(sample_rate) gainfilter.set_input_port(0, infilter, 0) gainfilter.set_input_port(1, sinusfilter, 0) outfilter = DoubleOutPointerFilter(output, False) outfilter.set_input_sampling_rate(sample_rate) outfilter.set_input_port(0, gainfilter, 0) outfilter.process(input.shape[1]) return output
def filter(input): import numpy as np output = np.zeros(input.shape, dtype=np.float64) infilter = DoubleInPointerFilter(input, False) infilter.set_input_sampling_rate(sample_rate) sinusfilter = DoubleCachedSinusGeneratorFilter(20, 5) sinusfilter.set_input_sampling_rate(sample_rate) sinusfilter.set_offset(0.5) sinusfilter.set_volume(0.5) gainfilter = DoubleApplyGainFilter(1) gainfilter.set_input_sampling_rate(sample_rate) gainfilter.set_input_port(0, infilter, 0) gainfilter.set_input_port(1, sinusfilter, 0) outfilter = DoubleOutPointerFilter(output, False) outfilter.set_input_sampling_rate(sample_rate) outfilter.set_input_port(0, gainfilter, 0) outfilter.process(input.shape[1]) return output
def filter(input, blend=0, feedback=0, feedforward=1): import numpy as np output1 = np.zeros(input.shape, dtype=np.float64) output2 = np.zeros(input.shape, dtype=np.float64) infilter = DoubleInPointerFilter(input, False) infilter.set_input_sampling_rate(sample_rate) allpass1filter = DoubleCustomIIRFilter() allpass1filter.set_input_sampling_rate(sample_rate) allpass1filter.set_input_port(0, infilter, 0) allpass1filter.set_coefficients_in( (0.0000, 0.3855, 0.0000, 1.3313, 0.0000, 1.0000)[::-1]) allpass1filter.set_coefficients_out( (-0.0000, -1.3313, 0.0000, -0.3855, 0)[::-1]) allpass2filter = DoubleCustomIIRFilter() allpass2filter.set_input_sampling_rate(sample_rate) allpass2filter.set_input_port(0, infilter, 0) allpass2filter.set_coefficients_in( (0.0947, 0.0000, 0.8335, 0.0000, 1.0000)[::-1]) allpass2filter.set_coefficients_out( (0.0000, -0.8335, 0.0000, -0.0947)[::-1]) sinusfilter = DoubleCachedSinusGeneratorFilter(100, 1) sinusfilter.set_input_sampling_rate(sample_rate) cosinusfilter = DoubleCachedCosinusGeneratorFilter(100, 1) cosinusfilter.set_input_sampling_rate(sample_rate) applygainFilter = DoubleApplyGainFilter(2) applygainFilter.set_input_sampling_rate(sample_rate) applygainFilter.set_input_port(0, allpass1filter, 0) applygainFilter.set_input_port(1, sinusfilter, 0) applygainFilter.set_input_port(2, allpass2filter, 0) applygainFilter.set_input_port(3, cosinusfilter, 0) volumeFilter = DoubleVolumeFilter() volumeFilter.set_input_sampling_rate(sample_rate) volumeFilter.set_volume(-1) volumeFilter.set_input_port(0, applygainFilter, 1) sum1Filter = DoubleSumFilter() sum1Filter.set_input_sampling_rate(sample_rate) sum1Filter.set_input_port(0, applygainFilter, 0) sum1Filter.set_input_port(1, volumeFilter, 0) sum2Filter = DoubleSumFilter() sum2Filter.set_input_sampling_rate(sample_rate) sum2Filter.set_input_port(0, applygainFilter, 0) sum2Filter.set_input_port(1, applygainFilter, 1) out1filter = DoubleOutPointerFilter(output1, False) out1filter.set_input_sampling_rate(sample_rate) out1filter.set_input_port(0, sum1Filter, 0) out2filter = DoubleOutPointerFilter(output2, False) out2filter.set_input_sampling_rate(sample_rate) out2filter.set_input_port(0, sum2Filter, 0) pipelinesink = PipelineGlobalSinkFilter() pipelinesink.set_input_sampling_rate(sample_rate) pipelinesink.add_filter(out1filter) pipelinesink.add_filter(out2filter) pipelinesink.process(input.shape[1]) return output1, output2
def filter(input, blend=0, feedback=0, feedforward=1): import numpy as np output1 = np.zeros(input.shape, dtype=np.float64) output2 = np.zeros(input.shape, dtype=np.float64) infilter = DoubleInPointerFilter(input, False) infilter.set_input_sampling_rate(sample_rate) allpass1filter = DoubleCustomIIRFilter() allpass1filter.set_input_sampling_rate(sample_rate) allpass1filter.set_input_port(0, infilter, 0) allpass1filter.set_coefficients_in((0.0000, 0.3855, 0.0000, 1.3313, 0.0000, 1.0000)[::-1]) allpass1filter.set_coefficients_out((-0.0000, -1.3313, 0.0000, -0.3855, 0)[::-1]) allpass2filter = DoubleCustomIIRFilter() allpass2filter.set_input_sampling_rate(sample_rate) allpass2filter.set_input_port(0, infilter, 0) allpass2filter.set_coefficients_in((0.0947, 0.0000, 0.8335, 0.0000, 1.0000)[::-1]) allpass2filter.set_coefficients_out((0.0000, -0.8335, 0.0000, -0.0947)[::-1]) sinusfilter = DoubleCachedSinusGeneratorFilter(100, 1) sinusfilter.set_input_sampling_rate(sample_rate) cosinusfilter = DoubleCachedCosinusGeneratorFilter(100, 1) cosinusfilter.set_input_sampling_rate(sample_rate) applygainFilter = DoubleApplyGainFilter(2) applygainFilter.set_input_sampling_rate(sample_rate) applygainFilter.set_input_port(0, allpass1filter, 0) applygainFilter.set_input_port(1, sinusfilter, 0) applygainFilter.set_input_port(2, allpass2filter, 0) applygainFilter.set_input_port(3, cosinusfilter, 0) volumeFilter = DoubleVolumeFilter() volumeFilter.set_input_sampling_rate(sample_rate) volumeFilter.set_volume(-1) volumeFilter.set_input_port(0, applygainFilter, 1) sum1Filter = DoubleSumFilter() sum1Filter.set_input_sampling_rate(sample_rate) sum1Filter.set_input_port(0, applygainFilter, 0) sum1Filter.set_input_port(1, volumeFilter, 0) sum2Filter = DoubleSumFilter() sum2Filter.set_input_sampling_rate(sample_rate) sum2Filter.set_input_port(0, applygainFilter, 0) sum2Filter.set_input_port(1, applygainFilter, 1) out1filter = DoubleOutPointerFilter(output1, False) out1filter.set_input_sampling_rate(sample_rate) out1filter.set_input_port(0, sum1Filter, 0) out2filter = DoubleOutPointerFilter(output2, False) out2filter.set_input_sampling_rate(sample_rate) out2filter.set_input_port(0, sum2Filter, 0) pipelinesink = PipelineGlobalSinkFilter() pipelinesink.set_input_sampling_rate(sample_rate) pipelinesink.add_filter(out1filter) pipelinesink.add_filter(out2filter) pipelinesink.process(input.shape[1]) return output1, output2