public HeaderChunk(FormatChunk formatChunk, DataChunk dataChunk) { ChunkId = "RIFF".ToCharArray(); RiffType = "WAVE".ToCharArray(); FormatChunk = formatChunk; DataChunk = dataChunk; ChunkSize = 36 + DataChunk.ChunkSize; }
// Returns a byte array in the Wave file format containing the given // text in morse code public byte[] ConvertToMorse(string text) { DataChunk data = GetText(text.ToLower()); FormatChunk formatChunk = new FormatChunk(); HeaderChunk headerChunk = new HeaderChunk(formatChunk, data); return(headerChunk.ToBytes()); }
public override byte[] ToBytes() { List <byte> bytes = new List <byte>(); bytes.AddRange(Encoding.UTF8.GetBytes(ChunkId)); bytes.AddRange(BitConverter.GetBytes(ChunkSize)); bytes.AddRange(Encoding.UTF8.GetBytes(RiffType)); bytes.AddRange(FormatChunk.ToBytes()); bytes.AddRange(DataChunk.ToBytes()); return(bytes.ToArray <byte>()); }