private void Setup(SoundTouch <TSampleType, TLongSampleType> pSoundTouch, int sampleRate, int channels, float TempoDelta, float PitchDelta) { pSoundTouch.SetSampleRate(sampleRate); pSoundTouch.SetChannels(channels); pSoundTouch.SetTempoChange(TempoDelta); pSoundTouch.SetPitchSemiTones(PitchDelta); pSoundTouch.SetRateChange(0); pSoundTouch.SetSetting(SettingId.UseQuickseek, 0); pSoundTouch.SetSetting(SettingId.UseAntiAliasFilter, 1); }
public NAudionSoundComponent(ISampleProvider sourceProvider) { this.sourceProvider = sourceProvider; soundTouch = new SoundTouch(); // Settings soundTouch.SetRate(1.0f); soundTouch.SetPitchOctaves(playbackRate / 10); soundTouch.SetTempo(playbackRate); soundTouch.SetUseAntiAliasing(false); soundTouch.SetUseQuickSeek(false); soundTouch.SetSampleRate(WaveFormat.SampleRate); channelCount = WaveFormat.Channels; soundTouch.SetChannels(channelCount); sourceReadBuffer = new float[(WaveFormat.SampleRate * channelCount * (long)readDurationMilliseconds) / 1000]; soundTouchReadBuffer = new float[sourceReadBuffer.Length * 10]; // support down to 0.1 speed endNotified = false; }