• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ISampleProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ISampleProvider的典型用法代码示例。如果您正苦于以下问题:C# ISampleProvider类的具体用法?C# ISampleProvider怎么用?C# ISampleProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ISampleProvider类属于命名空间,在下文中一共展示了ISampleProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AudioStreamModifier

        public AudioStreamModifier(ISampleProvider sample, double rateMult, int pitchDelta)
        {
            _sample = sample;
            WaveFormat = _sample.WaveFormat;

            _soundTouch = new SoundTouch<float, double>();

            channelCount = sample.WaveFormat.Channels;
            _soundTouch.SetSampleRate(sample.WaveFormat.SampleRate);
            _soundTouch.SetChannels(channelCount);

            rateMult = (rateMult - 1) * 100;
            _soundTouch.SetTempoChange(rateMult);
            _soundTouch.SetPitchSemiTones(pitchDelta*0.25f);
            _soundTouch.SetRateChange(1.0f);

            _soundTouch.SetSetting(SettingId.UseQuickseek, 1);
            _soundTouch.SetSetting(SettingId.UseAntiAliasFilter, 1);

            _soundTouch.SetSetting(SettingId.SequenceDurationMs, 40);
            _soundTouch.SetSetting(SettingId.SeekwindowDurationMs, 15);
            _soundTouch.SetSetting(SettingId.OverlapDurationMs, 8);

            sourceReadBuffer = new float[(WaveFormat.SampleRate * channelCount * readDurationMilliseconds) / 1000];
            soundTouchReadBuffer = new float[sourceReadBuffer.Length * 10]; // support down to 0.1 speed
        }
开发者ID:GAIPS-INESC-ID,项目名称:FAtiMA-Toolkit,代码行数:26,代码来源:AudioStreamModifier.cs


示例2: AutoDisposeSampleProvider

 public AutoDisposeSampleProvider(ISampleProvider provider,
      IEnumerable<IDisposable> disposables)
 {
     this._provider = provider;
     this._disposables = new CompositeDisposable(disposables);
     this.WaveFormat = provider.WaveFormat;
 }
开发者ID:Kei-Nanigashi,项目名称:StarryEyes,代码行数:7,代码来源:AutoDisposeFileReader.cs


示例3: EnvelopeSampleProvider

 public EnvelopeSampleProvider(ISampleProvider source, List<ExpPoint> envelope, double skipOver)
 {
     this.source = source;
     foreach (var pt in envelope) this.envelope.Add(pt.Clone());
     int skipOverSamples = (int)(skipOver * WaveFormat.SampleRate / 1000);
     ConvertEnvelope(skipOverSamples);
 }
开发者ID:KineticIsEpic,项目名称:OpenUtau,代码行数:7,代码来源:EnvelopeSampleProvider.cs


示例4: AddMixerInput

 /// <summary>
 /// Adds a new mixer input
 /// </summary>
 /// <param name="mixerInput">Mixer input</param>
 public void AddMixerInput(ISampleProvider mixerInput)
 {
     // we'll just call the lock around add since we are protecting against an AddMixerInput at
     // the same time as a Read, rather than two AddMixerInput calls at the same time
     lock (sources)
     {
         if (this.sources.Count >= maxInputs)
         {
             throw new InvalidOperationException("Too many mixer inputs");
         }
         this.sources.Add(mixerInput);
     }
     if (this.waveFormat == null)
     {
         this.waveFormat = mixerInput.WaveFormat;
     }
     else
     {
         if (this.WaveFormat.SampleRate != mixerInput.WaveFormat.SampleRate ||
             this.WaveFormat.Channels != mixerInput.WaveFormat.Channels)
         {
             throw new ArgumentException("All mixer inputs must have the same WaveFormat");
         }
     }
 }
开发者ID:hanistory,项目名称:hasuite,代码行数:29,代码来源:MixingSampleProvider.cs


示例5: SpectrumProvider

		// Constructor, sets the {@link Decoder}, the sample window size and the
		// hop size for the spectra returned. Say the sample window size is 1024
		// samples. To get an overlapp of 50% you specify a hop size of 512 samples,
		// for 25% overlap you specify a hopsize of 256 and so on. Hop sizes are of
		// course not limited to powers of 2.
		// 
		// @param decoder The decoder to get the samples from.
		// @param sampleWindowSize The sample window size.
		// @param hopSize The hop size.
		// @param useHamming Wheter to use hamming smoothing or not.
		public SpectrumProvider(ISampleProvider decoder, int sampleWindowSize, int hopSize, bool useHamming)
		{
			if(decoder == null)
				throw new ArgumentException("Decoder must be != null");

			if(sampleWindowSize <= 0)
				throw new ArgumentException("Sample window size must be > 0");
			if(hopSize <= 0)
				throw new ArgumentException("Hop size must be > 0");

			if(sampleWindowSize < hopSize)
				throw new ArgumentException("Hop size must be <= sampleSize");


			this.decoder = decoder;
			this.samples = new float[sampleWindowSize];
			this.nextSamples = new float[sampleWindowSize];
			this.tempSamples = new float[sampleWindowSize];
			this.hopSize = hopSize;
			fft = new FFT(sampleWindowSize, 44100);

			// calculate averages based on a miminum octave width of 22 Hz
			// split each octave into three bands
			// this should result in 30 averages
			//fft.LogAverages(22, 3);
			
			if(useHamming)
				fft.Window(FFT.HAMMING);

			decoder.Read(samples, 0, samples.Length);
			decoder.Read(nextSamples, 0, nextSamples.Length);
		}
开发者ID:LuckyLuik,项目名称:AudioVSTToolbox,代码行数:42,代码来源:SpectrumProvider.cs


示例6: RemoveMixerInput

 /// <summary>
 /// Removes a mixer input
 /// </summary>
 /// <param name="mixerInput">Mixer input to remove</param>
 public void RemoveMixerInput(ISampleProvider mixerInput)
 {
     lock (sources)
     {
         this.sources.Remove(mixerInput);
     }
 }
开发者ID:hanistory,项目名称:hasuite,代码行数:11,代码来源:MixingSampleProvider.cs


示例7: SampleToWaveProvider

 /// <summary>
 /// Initializes a new instance of the WaveProviderFloatToWaveProvider class
 /// </summary>
 /// <param name="source">Source wave provider</param>
 public SampleToWaveProvider(ISampleProvider source)
 {
     if (source.WaveFormat.Encoding != WaveFormatEncoding.IeeeFloat)
     {
         throw new ArgumentException("Must be already floating point");
     }
     this.source = source;
 }
开发者ID:Shadetheartist,项目名称:Numboard-2.0,代码行数:12,代码来源:SampleToWaveProvider.cs


示例8: MeteringSampleProvider

 /// <summary>
 /// Initialises a new instance of MeteringSampleProvider 
 /// </summary>
 /// <param name="source">source sampler provider</param>
 /// <param name="samplesPerNotification">Number of samples between notifications</param>
 public MeteringSampleProvider(ISampleProvider source, int samplesPerNotification)
 {
     this.source = source;
     this.channels = source.WaveFormat.Channels;
     this.maxSamples = new float[channels];
     this.SamplesPerNotification = samplesPerNotification;
     this.args = new StreamVolumeEventArgs() { MaxSampleValues = this.maxSamples }; // create objects up front giving GC little to do
 }
开发者ID:jayfar,项目名称:NAudio_1.5_Updates,代码行数:13,代码来源:MeteringSampleProvider.cs


示例9: BalanceSampleProvider

 /// <summary>
 /// Initializes a new instance of BalanceSampleProvider
 /// </summary>
 /// <param name="source">Source Sample Provider</param>
 public BalanceSampleProvider(ISampleProvider source)
 {
     if (source.WaveFormat.Channels != 2)
         throw new InvalidOperationException("Input wave format must be stereo!");
     _source = source;
     LeftVolume = 1.0f;
     RightVolume = 1.0f;
 }
开发者ID:OronDF343,项目名称:Sky-Jukebox,代码行数:12,代码来源:BalanceSampleProvider.cs


示例10: AddSource

 public void AddSource(ISampleProvider source, TimeSpan delayBy)
 {
     ISampleProvider _source;
     if (source.WaveFormat.Channels == 1) _source = new MonoToStereoSampleProvider(source);
     else if (source.WaveFormat.Channels == 2) _source = source;
     else return;
     mix.AddMixerInput(new OffsetSampleProvider(_source) { DelayBy = delayBy });
 }
开发者ID:KineticIsEpic,项目名称:OpenUtau,代码行数:8,代码来源:TrackSampleProvider.cs


示例11: FilteredSampleProvider

		public const float StandardBufferSizeSeconds = 0.05f;	// 1/20 second buffer

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="centreFrequency">For BiQuad filters</param>
		/// <param name="q">For BiQuad filters</param>
		public FilteredSampleProvider(ISampleProvider sourceProvider, float centreFrequency, float q) {
			this.sourceProvider = sourceProvider;
			channels = WaveFormat.Channels;
			StandardBufferSize = (int)WaveFormat.SecondsToSamples(StandardBufferSizeSeconds);
			filters = new BiQuadFilter[channels];
			for (int n = 0; n < channels; n++) {
				filters[n] = BiQuadFilter.BandPassFilterConstantPeakGain(WaveFormat.SampleRate, centreFrequency, q);
			}
		}
开发者ID:nikkilocke,项目名称:AlbumRecorder,代码行数:16,代码来源:FilteredSampleProvider.cs


示例12: Equalizer

 public Equalizer(ISampleProvider sourceProvider, EqualizerBand[] bands)
 {
     this.sourceProvider = sourceProvider;
     this.bands = bands;
     channels = sourceProvider.WaveFormat.Channels;
     bandCount = bands.Length;
     filters = new BiQuadFilter[channels, bands.Length];
     CreateFilters();
 }
开发者ID:cplaster,项目名称:RockBox,代码行数:9,代码来源:Equalizer.cs


示例13: MonoToStereoSampleProvider

 /// <summary>
 /// Initializes a new instance of MonoToStereoSampleProvider
 /// </summary>
 /// <param name="source">Source sample provider</param>
 public MonoToStereoSampleProvider(ISampleProvider source)
 {
     if (source.WaveFormat.Channels != 1)
     {
         throw new ArgumentException("Source must be mono");
     }
     this.source = source;
     this.waveFormat = WaveFormat.CreateIeeeFloatWaveFormat(source.WaveFormat.SampleRate, 2);
 }
开发者ID:hanistory,项目名称:hasuite,代码行数:13,代码来源:MonoToStereoSampleProvider.cs


示例14: PanningSampleProvider

 /// <summary>
 /// Initialises a new instance of the PanningSampleProvider
 /// </summary>
 /// <param name="source">Source sample provider, must be mono</param>
 public PanningSampleProvider(ISampleProvider source)
 {
     if (source.WaveFormat.Channels != 1)
     {
         throw new ArgumentException("Source sample provider must be mono");
     }
     this.source = source;
     this.waveFormat = WaveFormat.CreateIeeeFloatWaveFormat(source.WaveFormat.SampleRate, 2);
     this.panStrategy = new SinPanStrategy();
 }
开发者ID:Shadetheartist,项目名称:Numboard-2.0,代码行数:14,代码来源:PanningSampleProvider.cs


示例15: Equalizer

 public Equalizer(ISampleProvider sourceProvider, ObservableCollection<IEqualizerBand> bands)
 {
     _sourceProvider = sourceProvider;
     _bands = bands;
     _channels = sourceProvider.WaveFormat.Channels;
     _lockObj = new object();
     foreach (IEqualizerBand band in _bands) band.PropertyChanged += EqualizerBandPropertyChanged;
     _bands.CollectionChanged += BandsOnCollectionChanged;
     _filters = new List<BiQuadFilter[]>();
     CreateFilters();
 }
开发者ID:OronDF343,项目名称:Sky-Jukebox,代码行数:11,代码来源:Equalizer.cs


示例16: EffectStream

			public EffectStream(ISampleProvider stream, int length, float factor)
			{
				this.SourceStream = stream;
				this.EchoLength = length;
				this.EchoFactor = factor;
				this.samples = new Queue<float>();

				for (int i = 0; i < length; i++) {
					this.samples.Enqueue(0f);
				}
			}
开发者ID:sebllll,项目名称:VVVV.Audio,代码行数:11,代码来源:NAudio_FXEchoNode.cs


示例17: AdsrSampleProvider

 /// <summary>
 /// Creates a new AdsrSampleProvider with default values
 /// </summary>
 public AdsrSampleProvider(ISampleProvider source)
 {
     if (source.WaveFormat.Channels > 1) throw new ArgumentException("Currently only supports mono inputs");
     this.source = source;
     adsr = new EnvelopeGenerator();
     AttackSeconds = 0.01f;
     adsr.SustainLevel = 1.0f;
     adsr.DecayRate = 0.0f * WaveFormat.SampleRate;
     ReleaseSeconds = 0.3f;
     adsr.Gate(true);
 }
开发者ID:EnergonV,项目名称:BestCS,代码行数:14,代码来源:AdsrSampleProvider.cs


示例18: StereoToMonoSampleProvider

 /// <summary>
 /// Creates a new mono ISampleProvider based on a stereo input
 /// </summary>
 /// <param name="sourceProvider">Stereo 16 bit PCM input</param>
 public StereoToMonoSampleProvider(ISampleProvider sourceProvider)
 {
     LeftVolume = 0.5f;
     RightVolume = 0.5f;
     if (sourceProvider.WaveFormat.Channels != 2)
     {
         throw new ArgumentException("Source must be stereo");
     }
     this.sourceProvider = sourceProvider;
     WaveFormat = new WaveFormat(sourceProvider.WaveFormat.SampleRate, 1);
 }
开发者ID:ActivePHOENiX,项目名称:NAudio,代码行数:15,代码来源:StereoToMonoSampleProvider.cs


示例19: SampleToWaveProvider16

        /// <summary>
        /// Creates a new SampleToWaveProvider16
        /// </summary>
        /// <param name="sourceProvider">the source provider</param>
        public SampleToWaveProvider16(ISampleProvider sourceProvider)
        {
            if (sourceProvider.WaveFormat.Encoding != WaveFormatEncoding.IeeeFloat)
                throw new ApplicationException("Only PCM supported");
            if (sourceProvider.WaveFormat.BitsPerSample != 32)
                throw new ApplicationException("Only 32 bit audio supported");

            waveFormat = new WaveFormat(sourceProvider.WaveFormat.SampleRate, 16, sourceProvider.WaveFormat.Channels);

            this.sourceProvider = sourceProvider;
            this.volume = 1.0f;
        }
开发者ID:jithuin,项目名称:infogeezer,代码行数:16,代码来源:SampleToWaveProvider16.cs


示例20: SampleToWaveProvider16

        /// <summary>
        /// Converts from an ISampleProvider (IEEE float) to a 16 bit PCM IWaveProvider.
        /// Number of channels and sample rate remain unchanged.
        /// </summary>
        /// <param name="sourceProvider">The input source provider</param>
        public SampleToWaveProvider16(ISampleProvider sourceProvider)
        {
            if (sourceProvider.WaveFormat.Encoding != WaveFormatEncoding.IeeeFloat)
                throw new ArgumentException("Input source provider must be IEEE float", "sourceProvider");
            if (sourceProvider.WaveFormat.BitsPerSample != 32)
                throw new ArgumentException("Input source provider must be 32 bit", "sourceProvider");

            waveFormat = new WaveFormat(sourceProvider.WaveFormat.SampleRate, 16, sourceProvider.WaveFormat.Channels);

            this.sourceProvider = sourceProvider;
            this.volume = 1.0f;
        }
开发者ID:EnergonV,项目名称:BestCS,代码行数:17,代码来源:SampleToWaveProvider16.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ISandbox类代码示例发布时间:2022-05-24
下一篇:
C# ISampleGrabber类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap