예제 #1
0
 public void ConvertToPCM16Bit(string pathToSourceFile, string pathToDestinationFile)
 {
     using (IWaveSource source = CodecFactory.Instance.GetCodec(pathToSourceFile))
     {
         using (IWaveSource destination = source.ToSampleSource().ToWaveSource(16))
         {
             destination.WriteToFile(pathToDestinationFile);
         }
     }
 }
예제 #2
0
        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();
        }
예제 #3
0
 public void ConvertToWav(string wavFilePath)
 {
     _soundSource.WriteToFile(wavFilePath);
 }