public void RecodeFileToMonoWave(string pathToFile, string pathToRecodedFile, int sampleRate) { using (var stream = naudioFactory.GetStream(pathToFile)) { using (var resampler = naudioFactory.GetResampler(stream, sampleRate, Mono)) { naudioFactory.CreateWaveFile(pathToRecodedFile, resampler); } } }
public void RecodeFileToMonoWave(string source, string destination, int sampleRate) { using (var stream = factory.GetStream(source)) { using (var resampler = factory.GetResampler(stream, sampleRate, Mono)) { factory.CreateWaveFile(destination, resampler); } } }
public float[] ReadMonoFromSource(string source, int sampleRate, double secondsToRead, double startAtSecond) { using (var stream = naudioFactory.GetStream(source)) { SeekToSecondInCaseIfRequired(startAtSecond, stream); using (var resampler = naudioFactory.GetResampler(stream, sampleRate, Mono)) { var waveToSampleProvider = new WaveToSampleProvider(resampler); return(samplesAggregator.ReadSamplesFromSource(new NAudioSamplesProviderAdapter(waveToSampleProvider), secondsToRead, sampleRate)); } } }