public void ConvertToPCM16Bit(string pathToSourceFile, string pathToDestinationFile) { using (IWaveSource source = CodecFactory.Instance.GetCodec(pathToSourceFile)) { using (IWaveSource destination = source.ToSampleSource().ToWaveSource(16)) { destination.WriteToFile(pathToDestinationFile); } } }
static void StereoToMono(string input, string sDest) { CSCore.DSP.ChannelMatrix cm = CSCore.DSP.ChannelMatrix.StereoToMonoMatrix; var sarasa = CodecFactory.Instance.GetCodec(input); if (sarasa.WaveFormat.Channels == 2) { IWaveSource waveSource = sarasa.AppendSource(x => new CSCore.Streams.CachedSoundSource(x)) .AppendSource(x => new DmoChannelResampler(x, cm)) //append a channelresampler with the channelmatrix .ToSampleSource() .ToWaveSource(16); waveSource.WriteToFile(sDest); } else { sarasa.WriteToFile(sDest); } sarasa.Dispose(); }
public void ConvertToWav(string wavFilePath) { _soundSource.WriteToFile(wavFilePath); }