public WaveReader(string file) { Riff = new WavRiff(); Fmt = new WavFmt(); Data = new WavData(); reader = new BinaryReader(new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read)); ReadHeader(); }
public WaveWriter(string file, ushort channels, ushort sample_bits, uint sample_rate) { writer = new BinaryWriter(new FileStream(file, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)); Riff = new WavRiff(); Riff.RiffType = "WAVE"; Fmt = new WavFmt(); Fmt.AvgBytesPerSec = 176400; Fmt.BlockAlign =(ushort) (channels * 2); Fmt.FormatTag = 1; Fmt.ChunkSize = 16; // User configuration: Fmt.Channels = channels; Fmt.BitsPerSample = sample_bits; Fmt.SamplesPerSec = sample_rate; Data = new WavData(); Data.NumSamples = 0; }
public WaveWriter(string file, ushort channels, ushort sample_bits, uint sample_rate) { writer = new BinaryWriter(new FileStream(file, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)); Riff = new WavRiff(); Riff.RiffType = "WAVE"; Fmt = new WavFmt(); Fmt.AvgBytesPerSec = 176400; Fmt.BlockAlign = (ushort)(channels * 2); Fmt.FormatTag = 1; Fmt.ChunkSize = 16; // User configuration: Fmt.Channels = channels; Fmt.BitsPerSample = sample_bits; Fmt.SamplesPerSec = sample_rate; Data = new WavData(); Data.NumSamples = 0; }