本文整理汇总了Python中ATK.Core.DoubleInPointerFilter类的典型用法代码示例。如果您正苦于以下问题:Python DoubleInPointerFilter类的具体用法?Python DoubleInPointerFilter怎么用?Python DoubleInPointerFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DoubleInPointerFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: filter_32
def filter_32(input):
import numpy as np
output = np.zeros(input.shape, dtype=np.float64)
infilter = DoubleInPointerFilter(input, False)
infilter.set_input_sampling_rate(48000)
overfilter = DoubleOversampling6points5order_32Filter()
overfilter.set_input_sampling_rate(48000)
overfilter.set_output_sampling_rate(48000 * 32)
overfilter.set_input_port(0, infilter, 0)
overdrivefilter = DoubleFollowerTransistorClassAFilter.build_standard_filter()
overdrivefilter.set_input_sampling_rate(48000 * 32)
overdrivefilter.set_input_port(0, overfilter, 0)
lowpassfilter = DoubleButterworthLowPassFilter()
lowpassfilter.set_input_sampling_rate(48000 * 32)
lowpassfilter.set_cut_frequency(48000)
lowpassfilter.set_order(5)
lowpassfilter.set_input_port(0, overdrivefilter, 0)
decimationfilter = DoubleDecimationFilter(1)
decimationfilter.set_input_sampling_rate(48000 * 32)
decimationfilter.set_output_sampling_rate(48000)
decimationfilter.set_input_port(0, lowpassfilter, 0)
outfilter = DoubleOutPointerFilter(output, False)
outfilter.set_input_sampling_rate(48000)
outfilter.set_input_port(0, decimationfilter, 0)
outfilter.process(input.shape[1])
return output
示例2: filter
def filter(input, ingain_ch1=0, ingain_ch2=0, ingain_ch3=0, ingain_ch4=0,
outgain_ch1=0, outgain_ch2=0, outgain_ch3=0, outgain_ch4=0,
feedback_ch1=0, feedback_ch2=0, feedback_ch3=0, feedback_ch4=0):
import numpy as np
output = np.zeros(input.shape, dtype=np.float64)
infilter = DoubleInPointerFilter(input, False)
infilter.input_sampling_rate = sample_rate
delayfilter = DoubleQuadHouseholderFeedbackDelayNetworkFilter(10000)
delayfilter.input_sampling_rate = sample_rate
delayfilter.set_input_port(0, infilter, 0)
delayfilter.set_delay(0, 4800) #50ms
delayfilter.set_delay(1, 3600) #37.5ms
delayfilter.set_delay(2, 2400) #25
delayfilter.set_delay(3, 1200) #12.5ms
delayfilter.set_ingain(0, ingain_ch1)
delayfilter.set_ingain(1, ingain_ch2)
delayfilter.set_ingain(2, ingain_ch3)
delayfilter.set_ingain(3, ingain_ch4)
delayfilter.set_outgain(0, outgain_ch1)
delayfilter.set_outgain(1, outgain_ch2)
delayfilter.set_outgain(2, outgain_ch3)
delayfilter.set_outgain(3, outgain_ch4)
delayfilter.set_feedback(0, feedback_ch1)
delayfilter.set_feedback(1, feedback_ch2)
delayfilter.set_feedback(2, feedback_ch3)
delayfilter.set_feedback(3, feedback_ch4)
outfilter = DoubleOutPointerFilter(output, False)
outfilter.input_sampling_rate = sample_rate
outfilter.set_input_port(0, delayfilter, 0)
outfilter.process(input.shape[1])
return output
示例3: filter
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
示例4: filter
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 = DoubleWhiteNoiseGeneratorFilter()
noisefilter.set_input_sampling_rate(sample_rate)
noisefilter.set_offset(50e-3 * sample_rate)
noisefilter.set_volume(25e-3 * sample_rate)
lownoisefilter = DoubleLowPassCoefficientsIIRFilter()
lownoisefilter.set_input_sampling_rate(sample_rate)
lownoisefilter.set_cut_frequency(5)
lownoisefilter.set_input_port(0, noisefilter, 0)
delayfilter = DoubleUniversalVariableDelayLineFilter(5000)
delayfilter.set_input_sampling_rate(sample_rate)
delayfilter.set_input_port(0, infilter, 0)
delayfilter.set_input_port(1, lownoisefilter, 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
示例5: process
def process(input_l, input_r):
# Populate the outputs
output_l = np.zeros(size, dtype=np.float64)
output_r = np.zeros(size, dtype=np.float64)
# Create the inputs of the pipeline from the numpy arrays
infilter_l = DoubleInPointerFilter(input_l, False)
infilter_l.input_sampling_rate = sample_rate
infilter_r = DoubleInPointerFilter(input_r, False)
infilter_r.input_sampling_rate = sample_rate
# Create the intermediate buffer and connect it to the inputs
buffer = DoubleBufferFilter(2)
buffer.input_sampling_rate = sample_rate
buffer.set_input_port(0, infilter_l, 0)
buffer.set_input_port(1, infilter_r, 0)
# Create the outputs and connect them to the buffer
outfilter_l = DoubleOutPointerFilter(output_l, False)
outfilter_l.input_sampling_rate = sample_rate
outfilter_l.set_input_port(0, buffer, 1)
outfilter_r = DoubleOutPointerFilter(output_r, False)
outfilter_r.input_sampling_rate = sample_rate
outfilter_r.set_input_port(0, buffer, 0)
# Create the sink of the pipeline
sink = PipelineGlobalSinkFilter()
sink.input_sampling_rate = sample_rate
sink.add_filter(outfilter_l)
sink.add_filter(outfilter_r)
# Process the pipeline
sink.process(size)
return (output_l, output_r)
示例6: filter_4
def filter_4(input):
import numpy as np
output = np.zeros(input.shape, dtype=np.float64)
inputfilter = DoubleInPointerFilter(input, False)
inputfilter.input_sampling_rate = sample_rate
overfilter = DoubleOversampling6points5order_4Filter()
overfilter.input_sampling_rate = sample_rate
overfilter.output_sampling_rate = sample_rate * 4
overfilter.set_input_port(0, inputfilter, 0)
overdrivefilter = DoubleSD1OverdriveFilter()
overdrivefilter.input_sampling_rate = sample_rate * 4
overdrivefilter.set_input_port(0, overfilter, 0)
overdrivefilter.drive = 0.9
lowpassfilter = DoubleButterworthLowPassFilter()
lowpassfilter.input_sampling_rate = sample_rate * 4
lowpassfilter.cut_frequency = sample_rate
lowpassfilter.order = 5
lowpassfilter.set_input_port(0, overdrivefilter, 0)
decimationfilter = DoubleDecimationFilter(1)
decimationfilter.input_sampling_rate = sample_rate * 4
decimationfilter.output_sampling_rate = sample_rate
decimationfilter.set_input_port(0, lowpassfilter, 0)
outfilter = DoubleOutPointerFilter(output, False)
outfilter.input_sampling_rate = sample_rate
outfilter.set_input_port(0, decimationfilter, 0)
outfilter.process(input.shape[1])
return output
示例7: filter_4
def filter_4(input):
import numpy as np
output = np.zeros(input.shape, dtype=np.float64)
infilter = DoubleInPointerFilter(input, False)
infilter.input_sampling_rate = 48000
overfilter = DoubleOversampling6points5order_4Filter()
overfilter.input_sampling_rate = 48000
overfilter.output_sampling_rate = 48000 * 4
overfilter.set_input_port(0, infilter, 0)
overdrivefilter = DoubleEnhancedKorenTriodeFilter.build_standard_filter()
overdrivefilter.input_sampling_rate = 48000 * 4
overdrivefilter.set_input_port(0, overfilter, 0)
lowpassfilter = DoubleButterworthLowPassFilter()
lowpassfilter.input_sampling_rate = 48000 * 4
lowpassfilter.cut_frequency = 48000
lowpassfilter.order = 5
lowpassfilter.set_input_port(0, overdrivefilter, 0)
decimationfilter = DoubleDecimationFilter(1)
decimationfilter.input_sampling_rate = 48000 * 4
decimationfilter.output_sampling_rate = 48000
decimationfilter.set_input_port(0, lowpassfilter, 0)
outfilter = DoubleOutPointerFilter(output, False)
outfilter.input_sampling_rate = 48000
outfilter.set_input_port(0, decimationfilter, 0)
outfilter.process(input.shape[1])
return output
示例8: filter_32
def filter_32(input):
import numpy as np
output = np.zeros(input.shape, dtype=np.float64)
infilter = DoubleInPointerFilter(input, False)
infilter.input_sampling_rate = 48000
overfilter = DoubleOversampling6points5order_32Filter()
overfilter.input_sampling_rate = 48000
overfilter.output_sampling_rate = 48000 * 32
overfilter.set_input_port(0, infilter, 0)
overdrivefilter = DoubleDiodeClipperFilter()
overdrivefilter.input_sampling_rate = 48000 * 32
overdrivefilter.set_input_port(0, overfilter, 0)
lowpassfilter = DoubleButterworthLowPassFilter()
lowpassfilter.input_sampling_rate = 48000 * 32
lowpassfilter.cut_frequency = 48000
lowpassfilter.order = 5
lowpassfilter.set_input_port(0, overdrivefilter, 0)
decimationfilter = DoubleDecimationFilter(1)
decimationfilter.input_sampling_rate = 48000 * 32
decimationfilter.output_sampling_rate = 48000
decimationfilter.set_input_port(0, lowpassfilter, 0)
outfilter = DoubleOutPointerFilter(output, False)
outfilter.input_sampling_rate = 48000
outfilter.set_input_port(0, decimationfilter, 0)
outfilter.process(input.shape[1])
return output
示例9: filter_4
def filter_4(input):
import numpy as np
output = np.zeros(input.shape, dtype=np.float64)
infilter = DoubleInPointerFilter(input, False)
infilter.set_input_sampling_rate(48000)
overfilter = DoubleOversampling6points5order_4Filter()
overfilter.set_input_sampling_rate(48000)
overfilter.set_output_sampling_rate(48000 * 4)
overfilter.set_input_port(0, infilter, 0)
overdrivefilter = DoubleSimpleOverdriveFilter()
overdrivefilter.set_input_sampling_rate(48000 * 4)
overdrivefilter.set_input_port(0, overfilter, 0)
lowpassfilter = DoubleButterworthLowPassFilter()
lowpassfilter.set_input_sampling_rate(48000 * 4)
lowpassfilter.set_cut_frequency(48000)
lowpassfilter.set_order(5)
lowpassfilter.set_input_port(0, overdrivefilter, 0)
decimationfilter = DoubleDecimationFilter(1)
decimationfilter.set_input_sampling_rate(48000 * 4)
decimationfilter.set_output_sampling_rate(48000)
decimationfilter.set_input_port(0, lowpassfilter, 0)
outfilter = DoubleOutPointerFilter(output, False)
outfilter.set_input_sampling_rate(48000)
outfilter.set_input_port(0, decimationfilter, 0)
outfilter.process(input.shape[1])
return output
示例10: Oversampling_16_test
def Oversampling_16_test():
import numpy as np
from ATK.Core import DoubleInPointerFilter, DoubleOutPointerFilter
from ATK.Tools import DoubleOversampling6points5order_16Filter
from numpy.testing import assert_almost_equal
ref = np.sin(np.arange(16000, dtype=np.float64)[None,:] * 1000 * 2 * np.pi / 768000)
input = np.ascontiguousarray(ref[:, ::16])
output = np.ascontiguousarray(np.zeros(16000, dtype=np.float64)[None,:])
inputfilter = DoubleInPointerFilter(input, False)
oversamplingfilter = DoubleOversampling6points5order_16Filter()
outputfilter = DoubleOutPointerFilter(output, False)
inputfilter.set_output_sampling_rate(48000)
oversamplingfilter.set_input_sampling_rate(48000)
oversamplingfilter.set_output_sampling_rate(768000)
outputfilter.set_input_sampling_rate(768000)
oversamplingfilter.set_input_port(0, inputfilter, 0)
outputfilter.set_input_port(0, oversamplingfilter, 0)
outputfilter.process(16000)
assert_almost_equal(ref[:,952:-48], output[:,1000:], decimal=2)
示例11: Pan_linear_left_test
def Pan_linear_left_test():
import numpy as np
from ATK.Core import DoubleInPointerFilter, DoubleOutPointerFilter
from ATK.Tools import DoublePanFilter
from numpy.testing import assert_almost_equal
t = np.arange(1000, dtype=np.float64)[None, :]
input = np.sin(t * 1000 * 2 * np.pi / 48000)
output = np.ascontiguousarray(np.zeros(2000, dtype=np.float64).reshape(2, -1))
inputfilter = DoubleInPointerFilter(input, False)
panfilter = DoublePanFilter()
outputfilter = DoubleOutPointerFilter(output, False)
inputfilter.set_output_sampling_rate(48000)
panfilter.set_input_sampling_rate(48000)
panfilter.set_pan_law(DoublePanFilter.LINEAR_TAPER)
panfilter.set_pan(-1)
outputfilter.set_input_sampling_rate(48000)
panfilter.set_input_port(0, inputfilter, 0)
outputfilter.set_input_port(0, panfilter, 0)
outputfilter.set_input_port(1, panfilter, 1)
outputfilter.process(1000)
assert_almost_equal(input[0], output[0])
assert_almost_equal(0, output[1])
示例12: Volume_test
def Volume_test():
import numpy as np
from ATK.Core import DoubleInPointerFilter, DoubleOutPointerFilter
from ATK.Tools import DoubleVolumeFilter
from numpy.testing import assert_almost_equal
input = np.sin(np.arange(1000, dtype=np.float64)[None,:] * 1000 * 2 * np.pi / 48000)
output = np.ascontiguousarray(np.zeros(1000, dtype=np.float64)[None,:])
inputfilter = DoubleInPointerFilter(input, False)
volumefilter = DoubleVolumeFilter()
outputfilter = DoubleOutPointerFilter(output, False)
inputfilter.set_output_sampling_rate(48000)
volumefilter.set_input_sampling_rate(48000)
volumefilter.set_volume(.5)
outputfilter.set_input_sampling_rate(48000)
volumefilter.set_input_port(0, inputfilter, 0)
outputfilter.set_input_port(0, volumefilter, 0)
outputfilter.process(1000)
assert_almost_equal(.5 * input, output)
示例13: filter
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.output_sampling_rate = sample_rate
generator = DoubleSinusGeneratorFilter()
generator.output_sampling_rate = sample_rate
generator.frequency = 1
generator.volume = 1e-3*sample_rate
generator.offset = 1.5e-3*sample_rate
delayfilter = DoubleUniversalVariableDelayLineFilter(5000)
delayfilter.input_sampling_rate = sample_rate
delayfilter.set_input_port(0, infilter, 0)
delayfilter.set_input_port(1, generator, 0)
delayfilter.blend = blend
delayfilter.feedback = feedback
delayfilter.feedforward = feedforward
outfilter = DoubleOutPointerFilter(output, False)
outfilter.input_sampling_rate = sample_rate
outfilter.set_input_port(0, delayfilter, 0)
outfilter.process(input.shape[1])
return output
示例14: Oversampling_32_test
def Oversampling_32_test():
import numpy as np
from ATK.Core import DoubleInPointerFilter, DoubleOutPointerFilter
from ATK.Tools import DoubleOversampling6points5order_32Filter
from numpy.testing import assert_almost_equal
ref = np.sin(np.arange(32000, dtype=np.float64)[None,:] * 1000 * 2 * np.pi / (2*768000))
input = np.ascontiguousarray(ref[:, ::32])
output = np.ascontiguousarray(np.zeros(32000, dtype=np.float64)[None,:])
inputfilter = DoubleInPointerFilter(input, False)
oversamplingfilter = DoubleOversampling6points5order_32Filter()
outputfilter = DoubleOutPointerFilter(output, False)
inputfilter.output_sampling_rate = 48000
oversamplingfilter.input_sampling_rate = 48000
oversamplingfilter.output_sampling_rate = 32*48000
outputfilter.input_sampling_rate = 32*48000
oversamplingfilter.set_input_port(0, inputfilter, 0)
outputfilter.set_input_port(0, oversamplingfilter, 0)
outputfilter.process(32000)
assert_almost_equal(ref[:,904:-96], output[:,1000:], decimal=1)
示例15: Sum_test
def Sum_test():
import numpy as np
from ATK.Core import DoubleInPointerFilter, DoubleOutPointerFilter
from ATK.Tools import DoubleSumFilter
from numpy.testing import assert_almost_equal
t = np.arange(1000, dtype=np.float64)
input = np.sin(np.array((t, t)) * 1000 * 2 * np.pi / 48000)
output = np.ascontiguousarray(np.zeros(1000, dtype=np.float64)[None,:])
inputfilter = DoubleInPointerFilter(input, False)
sumfilter = DoubleSumFilter()
outputfilter = DoubleOutPointerFilter(output, False)
inputfilter.set_output_sampling_rate(48000)
sumfilter.set_input_sampling_rate(48000)
outputfilter.set_input_sampling_rate(48000)
sumfilter.set_input_port(0, inputfilter, 0)
sumfilter.set_input_port(1, inputfilter, 1)
outputfilter.set_input_port(0, sumfilter, 0)
outputfilter.process(1000)
assert_almost_equal(2*input[0], output[0])