Example #1
0
 public HeaderChunk(FormatChunk formatChunk, DataChunk dataChunk)
 {
     ChunkId = "RIFF".ToCharArray();
     RiffType = "WAVE".ToCharArray();
     FormatChunk = formatChunk;
     DataChunk = dataChunk;
     ChunkSize = 36 + DataChunk.ChunkSize;
 }
Example #2
0
        // Return a string (lower case text only, unrecognized characters
        // throw an exception -- see Characters.cs for the list of recognized
        // characters) as a waveform wrapped in a DataChunk, ready to by added
        // to a wave file.
        private DataChunk GetText(string text)
        {
            List<short> data = new List<short>();

            string[] words = text.Split(' ');

            for (int i = 0; i < words.Length; i++)
            {
                if (i > 0)
                    data.AddRange(GetInterWordSpace());
                data.AddRange(GetWord(words[i]));
            }

            // Pad the end with a little bit of silence. Otherwise the last
            // character may sound funny in some media players.
            data.AddRange(GetInterCharSpace());

            DataChunk dataChunk = new DataChunk(data.ToArray<short>());

            return dataChunk;
        }