//########################################################################################################################################################################################################## /// <summary> /// Save all samples to a new WAV file /// </summary> /// <param name="filepath">filepath of the new WAV file</param> public void SaveFile(string filepath) { if (Samples == null || format == null) { return; } if (!File.Exists(filepath)) { FileStream stream = File.Create(filepath); stream.Close(); } else { File.Delete(filepath); } WaveWriter writer = new WaveWriter(filepath, format); foreach (AudioSample s in Samples) { writer.WriteSample(s.Value); } writer.Dispose(); }