当前位置: 首页>>代码示例>>Python>>正文


Python DoubleInPointerFilter.output_sampling_rate方法代码示例

本文整理汇总了Python中ATK.Core.DoubleInPointerFilter.output_sampling_rate方法的典型用法代码示例。如果您正苦于以下问题:Python DoubleInPointerFilter.output_sampling_rate方法的具体用法?Python DoubleInPointerFilter.output_sampling_rate怎么用?Python DoubleInPointerFilter.output_sampling_rate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ATK.Core.DoubleInPointerFilter的用法示例。


在下文中一共展示了DoubleInPointerFilter.output_sampling_rate方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MiddleSide_test

# 需要导入模块: from ATK.Core import DoubleInPointerFilter [as 别名]
# 或者: from ATK.Core.DoubleInPointerFilter import output_sampling_rate [as 别名]
def MiddleSide_test():
  import numpy as np
  from ATK.Core import DoubleInPointerFilter, DoubleOutPointerFilter
  from ATK.Tools import DoubleMiddleSideFilter

  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(2000, dtype=np.float64).reshape(2, -1))

  inputfilter = DoubleInPointerFilter(input, False)
  msfilter = DoubleMiddleSideFilter()
  outputfilter = DoubleOutPointerFilter(output, False)

  inputfilter.output_sampling_rate = 48000
  msfilter.input_sampling_rate = 48000
  outputfilter.input_sampling_rate = 48000

  msfilter.set_input_port(0, inputfilter, 0)
  msfilter.set_input_port(1, inputfilter, 1)
  outputfilter.set_input_port(0, msfilter, 0)
  outputfilter.set_input_port(1, msfilter, 1)

  outputfilter.process(1000)

  assert_almost_equal(input[0]*2, output[0])
  assert_almost_equal(0, output[1])
开发者ID:mbrucher,项目名称:AudioTK,代码行数:30,代码来源:PyATKTools_MiddleSide_test.py

示例2: filter

# 需要导入模块: from ATK.Core import DoubleInPointerFilter [as 别名]
# 或者: from ATK.Core.DoubleInPointerFilter import output_sampling_rate [as 别名]
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
开发者ID:mbrucher,项目名称:AudioTK,代码行数:37,代码来源:PyATKDynamic_attackreleasefilter_test.py

示例3: filter

# 需要导入模块: from ATK.Core import DoubleInPointerFilter [as 别名]
# 或者: from ATK.Core.DoubleInPointerFilter import output_sampling_rate [as 别名]
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
开发者ID:mbrucher,项目名称:AudioTK,代码行数:29,代码来源:PyATKDelay_universalvariabledelay_test.py

示例4: Oversampling_16_test

# 需要导入模块: from ATK.Core import DoubleInPointerFilter [as 别名]
# 或者: from ATK.Core.DoubleInPointerFilter import output_sampling_rate [as 别名]
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.output_sampling_rate = 48000
  oversamplingfilter.input_sampling_rate = 48000
  oversamplingfilter.output_sampling_rate = 768000
  outputfilter.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=1)
开发者ID:mbrucher,项目名称:AudioTK,代码行数:29,代码来源:PyATKTools_Oversampling_test.py

示例5: Sum_test

# 需要导入模块: from ATK.Core import DoubleInPointerFilter [as 别名]
# 或者: from ATK.Core.DoubleInPointerFilter import output_sampling_rate [as 别名]
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.output_sampling_rate = 48000
  sumfilter.input_sampling_rate = 48000
  outputfilter.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])
开发者ID:mbrucher,项目名称:AudioTK,代码行数:28,代码来源:PyATKTools_Sum_test.py

示例6: Volume_test

# 需要导入模块: from ATK.Core import DoubleInPointerFilter [as 别名]
# 或者: from ATK.Core.DoubleInPointerFilter import output_sampling_rate [as 别名]
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.output_sampling_rate = 48000
  volumefilter.input_sampling_rate = 48000
  volumefilter.volume = .5
  outputfilter.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)
开发者ID:mbrucher,项目名称:AudioTK,代码行数:27,代码来源:PyATKTools_Volume_test.py

示例7: Decimation_test

# 需要导入模块: from ATK.Core import DoubleInPointerFilter [as 别名]
# 或者: from ATK.Core.DoubleInPointerFilter import output_sampling_rate [as 别名]
def Decimation_test():
  import numpy as np
  from ATK.Core import DoubleInPointerFilter, DoubleOutPointerFilter
  from ATK.Tools import DoubleDecimationFilter

  from numpy.testing import assert_almost_equal
  
  input = np.sin(np.arange(2000, dtype=np.float64)[None,:] * 1000 * 2 * np.pi / 96000)
  output = np.ascontiguousarray(np.zeros(1000, dtype=np.float64)[None,:])

  inputfilter = DoubleInPointerFilter(input, False)
  decimationfilter = DoubleDecimationFilter(1)
  outputfilter = DoubleOutPointerFilter(output, False)

  inputfilter.output_sampling_rate = 96000
  decimationfilter.input_sampling_rate = 96000
  decimationfilter.output_sampling_rate = 48000
  outputfilter.input_sampling_rate = 48000

  decimationfilter.set_input_port(0, inputfilter, 0)
  outputfilter.set_input_port(0, decimationfilter, 0)

  outputfilter.process(1000)

  assert_almost_equal(input[:,::2], output)
开发者ID:mbrucher,项目名称:AudioTK,代码行数:27,代码来源:PyATKTools_Decimation_test.py

示例8: DoubleBandPassCoefficientsIIRFilter_test

# 需要导入模块: from ATK.Core import DoubleInPointerFilter [as 别名]
# 或者: from ATK.Core.DoubleInPointerFilter import output_sampling_rate [as 别名]
def DoubleBandPassCoefficientsIIRFilter_test():
  import numpy as np
  from ATK.Core import DoubleInPointerFilter, DoubleOutPointerFilter
  from ATK.EQ import DoubleSecondOrderBandPassFilter

  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)
  EQfilter = DoubleSecondOrderBandPassFilter()
  outputfilter = DoubleOutPointerFilter(output, False)

  inputfilter.output_sampling_rate = 48000
  EQfilter.input_sampling_rate = 48000
  EQfilter.Q = 1
  EQfilter.cut_frequency = 1000
  outputfilter.input_sampling_rate = 48000

  EQfilter.set_input_port(0, inputfilter, 0)
  outputfilter.set_input_port(0, EQfilter, 0)

  outputfilter.process(1000)

  assert_almost_equal(input[0,500:], input[0,500] / output[0,500] * output[0,500:])
开发者ID:mbrucher,项目名称:AudioTK,代码行数:28,代码来源:PyATKEQ_test.py

示例9: DoublePointerFilter2_new_test

# 需要导入模块: from ATK.Core import DoubleInPointerFilter [as 别名]
# 或者: from ATK.Core.DoubleInPointerFilter import output_sampling_rate [as 别名]
def DoublePointerFilter2_new_test():
  import numpy as np
  from ATK.Core import DoubleInPointerFilter, DoubleOutPointerFilter
  from numpy.testing import assert_equal
  input = np.arange(1000, dtype=np.float64)
  output = np.zeros(1000, dtype=np.float64)
  inputfilter = DoubleInPointerFilter(input)
  outputfilter = DoubleOutPointerFilter(output)
  outputfilter.set_input_port(0, inputfilter, 0)
  inputfilter.output_sampling_rate = 48000
  outputfilter.input_sampling_rate = 48000
  outputfilter.process(1000)
  assert_equal(input, output)
开发者ID:mbrucher,项目名称:AudioTK,代码行数:15,代码来源:PyATKPointer_test.py

示例10: PipelineGlobalSinkFilter_usage_test

# 需要导入模块: from ATK.Core import DoubleInPointerFilter [as 别名]
# 或者: from ATK.Core.DoubleInPointerFilter import output_sampling_rate [as 别名]
def PipelineGlobalSinkFilter_usage_test():
  import numpy as np
  from ATK.Core import DoubleInPointerFilter, DoubleOutPointerFilter, PipelineGlobalSinkFilter
  from numpy.testing import assert_equal
  input = np.ascontiguousarray(np.arange(1000, dtype=np.float64)[None,:])
  output = np.ascontiguousarray(np.zeros(1000, dtype=np.float64)[None,:])
  inputfilter = DoubleInPointerFilter(input, False)
  outputfilter = DoubleOutPointerFilter(output, False)
  outputfilter.set_input_port(0, inputfilter, 0)
  inputfilter.output_sampling_rate = 48000
  outputfilter.input_sampling_rate = 48000
  sink = PipelineGlobalSinkFilter()
  sink.add_filter(outputfilter)
  sink.input_sampling_rate = 48000
  sink.process(1000)
  assert_equal(input, output)
开发者ID:mbrucher,项目名称:AudioTK,代码行数:18,代码来源:PyATKPipelineGlobalSinkFilter_test.py

示例11: DoubleConvertFilter_new_test

# 需要导入模块: from ATK.Core import DoubleInPointerFilter [as 别名]
# 或者: from ATK.Core.DoubleInPointerFilter import output_sampling_rate [as 别名]
def DoubleConvertFilter_new_test():
  import numpy as np
  from ATK.Core import DoubleRealToComplexFilter
  from ATK.Core import DoubleInPointerFilter, ComplexDoubleOutPointerFilter
  
  from numpy.testing import assert_equal
  input = np.ascontiguousarray(np.arange(1000, dtype=np.float64))
  output = np.ascontiguousarray(np.zeros(1000, dtype=np.complex128))
  
  inputfilter = DoubleInPointerFilter(input)
  convertFilter = DoubleRealToComplexFilter()
  outputfilter = ComplexDoubleOutPointerFilter(output)
  
  convertFilter.set_input_port(0, inputfilter, 0)
  convertFilter.set_input_port(1, inputfilter, 0)
  outputfilter.set_input_port(0, convertFilter, 0)
  
  inputfilter.output_sampling_rate = 48000
  convertFilter.input_sampling_rate = 48000
  outputfilter.input_sampling_rate = 48000
  
  outputfilter.process(1000)
  assert_equal(input + 1j * input, output)
开发者ID:mbrucher,项目名称:AudioTK,代码行数:25,代码来源:PyATKConvert_test.py


注:本文中的ATK.Core.DoubleInPointerFilter.output_sampling_rate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。