1306 lines · 58.4 KB · C#
RawDownload
//******************************************************************************************************
//  WaveFile.cs - Gbtc
//
//  Copyright © 2010, Grid Protection Alliance.  All Rights Reserved.
//
//  Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
//  the NOTICE file distributed with this work for additional information regarding copyright ownership.
//  The GPA licenses this file to you under the Eclipse Public License -v 1.0 (the "License"); you may
//  not use this file except in compliance with the License. You may obtain a copy of the License at:
//
//      http://www.opensource.org/licenses/eclipse-1.0.php
//
//  Unless agreed to in writing, the subject software distributed under the License is distributed on an
//  "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
//  License for the specific language governing permissions and limitations.
//
//  Code Modification History:
//  ----------------------------------------------------------------------------------------------------
//  07/29/2009 - J. Ritchie Carroll
//       Generated original version of source code.
//  08/06/2009 - Josh L. Patterson
//       Edited Comments.
//  09/14/2009 - Stephen C. Wills
//       Added new header and license agreement.
//  10/8/2012 - Danyelle Gilliam
//        Modified Header
//
//******************************************************************************************************


#region [ Contributor License Agreements ]

/**************************************************************************\
   Copyright © 2009 - J. Ritchie Carroll
   All rights reserved.
  
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:
  
      * Redistributions of source code must retain the above copyright
        notice, this list of conditions and the following disclaimer.
       
      * Redistributions in binary form must reproduce the above
        copyright notice, this list of conditions and the following
        disclaimer in the documentation and/or other materials provided
        with the distribution.
  
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
   EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
   OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
\**************************************************************************/

#endregion

using GSF.Parsing;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Media;

namespace GSF.Media
{
    #region [ Enumerations ]

    /// <summary>
    /// Typical samples rates supported by wave files.
    /// </summary>
    /// <remarks>
    /// <para>
    /// Quantization of the analog waveform, or signal, is a real-time process operating over a continuous
    /// time-period which produces a “stream” of digital values. In order for the process to work you must
    /// define the rate at which new digital values are measured, or sampled, from the analog signal. The
    /// rate at which new values are measured is called the “sampling rate” (a.k.a., the sampling frequency).
    /// </para>
    /// <para>
    /// Audio based Compact Discs use a sampling rate of 44,100 Hz; this means the the Nyquist frequency is
    /// 22,050 Hz (i.e., the upper bound on the highest frequency that the digital data can clearly represent
    /// without aliasing). This sample rate selection was no accident as the range of hearing for a healthy
    /// young person is approximately 20 to 20,000 Hz.
    /// </para>
    /// <para>
    /// In plain English, higher sampling rates will equate to higher quality sound reproduction but anything
    /// above 44,100 Hz will not be perceived as better quality by normal human beings.
    /// </para>
    /// </remarks>
    public enum SampleRate
    {
        /// <summary>8000 samples per second</summary>
        Hz8000 = 8000,
        /// <summary>11025 samples per second</summary>
        Hz11025 = 11025,
        /// <summary>12000 samples per second</summary>
        Hz12000 = 12000,
        /// <summary>16000 samples per second</summary>
        Hz16000 = 16000,
        /// <summary>22050 samples per second</summary>
        Hz22050 = 22050,
        /// <summary>24000 samples per second</summary>
        Hz24000 = 24000,
        /// <summary>32000 samples per second</summary>
        Hz32000 = 32000,
        /// <summary>44100 samples per second</summary>
        /// <remarks>This is the standard setting for CD audio quality</remarks>
        Hz44100 = 44100,
        /// <summary>48000 samples per second</summary>
        Hz48000 = 48000
    }

    /// <summary>
    /// Typical bit sizes supported by wave files.
    /// </summary>
    /// <remarks>
    /// Strictly speaking, “bits-per-sample” describes the total number of bits used
    /// to encode the amplitude (or volume) of a sampled signal.  The following table
    /// describes a few typical bit ranges and their possible resolution:
    /// <list type="table">
    /// <listheader>
    ///     <term>Bit range</term>
    ///     <description>Resolution</description>
    /// </listheader>
    /// <item>
    ///     <term>8-bits (1 Byte)</term>
    ///     <description>0 to 255</description>
    /// </item>
    /// <item>
    ///     <term>16-bits (2 Bytes)</term>
    ///     <description>-32,768 to 32,767</description>
    /// </item>
    /// <item>
    ///     <term>24-bits (3 Bytes)</term>
    ///     <description>-8,388,608 to 8,388,607</description>
    /// </item>
    /// <item>
    ///     <term>32-bits (4 Bytes)</term>
    ///     <description>-2,147,483,648 to 2,147,483,647</description>
    /// </item>
    /// </list>
    /// The net result is that more bits you use, the more resolution you can achieve in
    /// amplitude; hence “more bits = better sound quality” however you have to compromise
    /// for technical constraints because “more bits = more required space”.
    /// </remarks>
    public enum BitsPerSample : short
    {
        /// <summary>8-bits per sample</summary>
        Bits8 = 8,
        /// <summary>16-bits per sample</summary>
        /// <remarks>This is the standard setting for CD audio quality</remarks>
        Bits16 = 16,
        /// <summary>24-bits per sample</summary>
        Bits24 = 24,
        /// <summary>32-bits per sample</summary>
        Bits32 = 32
    }

    /// <summary>
    /// Typical number of data channels used by wave files.
    /// </summary>
    /// <remarks>
    /// These are some common number of data channels, but wave files can support any number of data channels.
    /// </remarks>
    public enum DataChannels : short
    {
        /// <summary>Defines a single (monaural) data sample channel</summary>
        Mono = 1,
        /// <summary>Defines two (stereo) data sample channels</summary>
        /// <remarks>This is the standard setting for CD audio quality</remarks>
        Stereo = 2,
        /// <summary>Defines three data sample channels</summary>
        /// <remarks>3.0 Channel Surround (analog matrixed: Dolby Surround)</remarks>
        DolbySurround = 3,
        /// <summary>Defines four data sample channels</summary>
        /// <remarks>4.0 Channel Surround (analog matrixed: Dolby Pro Logic)</remarks>
        DolbyProLogic = 4,
        /// <summary>Defines six data sample channels</summary>
        /// <remarks>5.1 Channel Surround (digital discrete: Dolby Digital, DTS, SDDS)</remarks>
        DolbyDigital = 6
    }

    /// <summary>
    /// Common WAVE audio encoding formats.
    /// </summary>
    /// <remarks>
    /// <para>
    /// Microsoft defines more than 130 different audio encoding formats for WAVE files.  Only the
    /// more common formats are defined here.
    /// </para>
    /// <para>
    /// Note that PCM (i.e., Pulse Code Modulation) is a universal audio encoding format.  It is a
    /// very common method of storing and transmitting uncompressed digital audio. Since it is a
    /// generic format, it can be read by most any audio application similar to the way a plain text
    /// file can be read by any word-processing program. PCM is used by Audio CDs and digital audio
    /// tapes (DATs). PCM is also a very common format for AIFF and WAV files.
    /// </para>
    /// </remarks>
    [CLSCompliant(false)]
    public enum WaveFormat : ushort
    {
        /// <summary>Wave format type is undefined.</summary>
        Unknown = 0x0,
        /// <summary>Standard pulse-code modulation audio format</summary>
        PCM = 0x1,
        /// <summary>Adpative differential pulse-code modulation encoding algorithm</summary>
        ADPCM = 0x2,
        /// <summary>Floating point PCM encoding algorithm</summary>
        IeeeFloat = 0x3,
        /// <summary>A-law encoding algorithm (used in Europe and the rest of the world)</summary>
        ALaw = 0x6,
        /// <summary>μ-law encoding algorithm (used in North America and Japan)</summary>
        MuLaw = 0x7,
        /// <summary>Decode Timestamp encoding algorithm (used in MPEG-coded multimedia)</summary>
        DTS = 0x8,
        /// <summary>Digital Rights Management encoded format (for digital-audio content protected by Microsoft DRM).</summary>
        DRM = 0x9,
        /// <summary>MPEG Audio is a family of open standards for compressed audio that includes MP2, MP3 and AAC.</summary>
        Mpeg = 0x50,
        /// <summary>ISO MPEG-Layer 3 audio format.</summary>
        MpegLayer3 = 0x55,
        /// <summary>Use WAVEFORMATEXTENSIBLE structure.</summary>
        /// <remarks>
        /// This wave file format is used to identify multiple channels in the wave file for spatial positioning
        /// of speakers, see <see cref="WaveFormatExtensible"/> for more details.
        /// </remarks>
        WaveFormatExtensible = 0xFFFE

        #region [ Other Wave Formats ]

        //OKI_ADPCM = 0x10,                    // OKI
        //DVI_ADPCM = 0x11,                    // Intel Corporation
        //IMA_ADPCM = 0x11,                    // Intel Corporation
        //MEDIASPACE_ADPCM = 0x12,             // Videologic
        //SIERRA_ADPCM = 0x13,                 // Sierra Semiconductor Corp
        //G723_ADPCM = 0x14,                   // Antex Electronics Corporation
        //DIGISTD = 0x15,                      // DSP Solutions, Inc.
        //DIGIFIX = 0x16,                      // DSP Solutions, Inc.
        //DIALOGIC_OKI_ADPCM = 0x17,           // Dialogic Corporation
        //MEDIAVISION_ADPCM = 0x18,            // Media Vision, Inc.
        //CU_CODEC = 0x19,                     // Hewlett-Packard Company
        //YAMAHA_ADPCM = 0x20,                 // Yamaha Corporation of America
        //SONARC = 0x21,                       // Speech Compression
        //DSPGROUP_TRUESPEECH = 0x22,          // DSP Group, Inc
        //ECHOSC1 = 0x23,                      // Echo Speech Corporation
        //AUDIOFILE_AF36 = 0x24,               // Virtual Music, Inc.
        //APTX = 0x25,                         // Audio Processing Technology
        //AUDIOFILE_AF10 = 0x26,               // Virtual Music, Inc.
        //PROSODY_1612 = 0x27,                 // Aculab plc
        //LRC = 0x28,                          // Merging Technologies S.A.
        //DOLBY_AC2 = 0x30,                    // Dolby Laboratories
        //GSM610 = 0x31,                       // Microsoft Corporation
        //MSNAUDIO = 0x32,                     // Microsoft Corporation
        //ANTEX_ADPCME = 0x33,                 // Antex Electronics Corporation
        //CONTROL_RES_VQLPC = 0x34,            // Control Resources Limited
        //DIGIREAL = 0x35,                     // DSP Solutions, Inc.
        //DIGIADPCM = 0x36,                    // DSP Solutions, Inc.
        //CONTROL_RES_CR10 = 0x37,             // Control Resources Limited
        //NMS_VBXADPCM = 0x38,                 // Natural MicroSystems
        //CS_IMAADPCM = 0x39,                  // Crystal Semiconductor IMA ADPCM
        //ECHOSC3 = 0x3A,                      // Echo Speech Corporation
        //ROCKWELL_ADPCM = 0x3B,               // Rockwell International
        //ROCKWELL_DIGITALK = 0x3C,            // Rockwell International
        //XEBEC = 0x3D,                        // Xebec Multimedia Solutions Limited
        //G721_ADPCM = 0x40,                   // Antex Electronics Corporation
        //G728_CELP = 0x41,                    // Antex Electronics Corporation
        //MSG723 = 0x42,                       // Microsoft Corporation
        //RT24 = 0x52,                         // InSoft, Inc.
        //PAC = 0x53,                          // InSoft, Inc.
        //LUCENT_G723 = 0x59,                  // Lucent Technologies
        //CIRRUS = 0x60,                       // Cirrus Logic
        //ESPCM = 0x61,                        // ESS Technology
        //VOXWARE = 0x62,                      // Voxware Inc
        //CANOPUS_ATRAC = 0x63,                // Canopus, co., Ltd.
        //G726_ADPCM = 0x64,                   // APICOM
        //G722_ADPCM = 0x65,                   // APICOM
        //DSAT_DISPLAY = 0x67,                 // Microsoft Corporation
        //VOXWARE_BYTE_ALIGNED = 0x69,         // Voxware Inc
        //VOXWARE_AC8 = 0x70,                  // Voxware Inc
        //VOXWARE_AC10 = 0x71,                 // Voxware Inc
        //VOXWARE_AC16 = 0x72,                 // Voxware Inc
        //VOXWARE_AC20 = 0x73,                 // Voxware Inc
        //VOXWARE_RT24 = 0x74,                 // Voxware Inc
        //VOXWARE_RT29 = 0x75,                 // Voxware Inc
        //VOXWARE_RT29HW = 0x76,               // Voxware Inc
        //VOXWARE_VR12 = 0x77,                 // Voxware Inc
        //VOXWARE_VR18 = 0x78,                 // Voxware Inc
        //VOXWARE_TQ40 = 0x79,                 // Voxware Inc
        //SOFTSOUND = 0x80,                    // Softsound, Ltd.
        //VOXWARE_TQ60 = 0x81,                 // Voxware Inc
        //MSRT24 = 0x82,                       // Microsoft Corporation
        //G729A = 0x83,                        // AT&T Labs, Inc.
        //MVI_MVI2 = 0x84,                     // Motion Pixels
        //DF_G726 = 0x85,                      // DataFusion Systems (Pty) (Ltd)
        //DF_GSM610 = 0x86,                    // DataFusion Systems (Pty) (Ltd)
        //ISIAUDIO = 0x88,                     // Iterated Systems, Inc.
        //ONLIVE = 0x89,                       // OnLive! Technologies, Inc.
        //SBC24 = 0x91,                        // Siemens Business Communications Sys
        //DOLBY_AC3_SPDIF = 0x92,              // Sonic Foundry
        //MEDIASONIC_G723 = 0x93,              // MediaSonic
        //PROSODY_8KBPS = 0x94,                // Aculab plc
        //ZYXEL_ADPCM = 0x97,                  // ZyXEL Communications, Inc.
        //PHILIPS_LPCBB = 0x98,                // Philips Speech Processing
        //PACKED = 0x99,                       // Studer Professional Audio AG
        //MALDEN_PHONYTALK = 0xA0,             // Malden Electronics Ltd.
        //RHETOREX_ADPCM = 0x100,              // Rhetorex Inc.
        //IRAT = 0x101,                        // BeCubed Software Inc.
        //VIVO_G723 = 0x111,                   // Vivo Software
        //VIVO_SIREN = 0x112,                  // Vivo Software
        //DIGITAL_G723 = 0x123,                // Digital Equipment Corporation
        //SANYO_LD_ADPCM = 0x125,              // Sanyo Electric Co., Ltd.
        //SIPROLAB_ACEPLNET = 0x130,           // Sipro Lab Telecom Inc.
        //SIPROLAB_ACELP4800 = 0x131,          // Sipro Lab Telecom Inc.
        //SIPROLAB_ACELP8V3 = 0x132,           // Sipro Lab Telecom Inc.
        //SIPROLAB_G729 = 0x133,               // Sipro Lab Telecom Inc.
        //SIPROLAB_G729A = 0x134,              // Sipro Lab Telecom Inc.
        //SIPROLAB_KELVIN = 0x135,             // Sipro Lab Telecom Inc.
        //G726ADPCM = 0x140,                   // Dictaphone Corporation
        //QUALCOMM_PUREVOICE = 0x150,          // Qualcomm, Inc.
        //QUALCOMM_HALFRATE = 0x151,           // Qualcomm, Inc.
        //TUBGSM = 0x155,                      // Ring Zero Systems, Inc.
        //MSAUDIO1 = 0x160,                    // Microsoft Corporation
        //UNISYS_NAP_ADPCM = 0x170,            // Unisys Corp.
        //UNISYS_NAP_ULAW = 0x171,             // Unisys Corp.
        //UNISYS_NAP_ALAW = 0x172,             // Unisys Corp.
        //UNISYS_NAP_16K = 0x173,              // Unisys Corp.
        //CREATIVE_ADPCM = 0x200,              // Creative Labs, Inc
        //CREATIVE_FASTSPEECH8 = 0x202,        // Creative Labs, Inc
        //CREATIVE_FASTSPEECH10 = 0x203,       // Creative Labs, Inc
        //UHER_ADPCM = 0x210,                  // UHER informatic GmbH
        //QUARTERDECK = 0x220,                 // Quarterdeck Corporation
        //ILINK_VC = 0x230,                    // I-link Worldwide
        //RAW_SPORT = 0x240,                   // Aureal Semiconductor
        //ESST_AC3 = 0x241,                    // ESS Technology, Inc.
        //IPI_HSX = 0x250,                     // Interactive Products, Inc.
        //IPI_RPELP = 0x251,                   // Interactive Products, Inc.
        //CS2 = 0x260,                         // Consistent Software
        //SONY_SCX = 0x270,                    // Sony Corp.
        //FM_TOWNS_SND = 0x300,                // Fujitsu Corp.
        //BTV_DIGITAL = 0x400,                 // Brooktree Corporation
        //QDESIGN_MUSIC = 0x450,               // QDesign Corporation
        //VME_VMPCM = 0x680,                   // AT&T Labs, Inc.
        //TPC = 0x681,                         // AT&T Labs, Inc.
        //OLIGSM = 0x1000,                     // Ing C. Olivetti & C., S.p.A.
        //OLIADPCM = 0x1001,                   // Ing C. Olivetti & C., S.p.A.
        //OLICELP = 0x1002,                    // Ing C. Olivetti & C., S.p.A.
        //OLISBC = 0x1003,                     // Ing C. Olivetti & C., S.p.A.
        //OLIOPR = 0x1004,                     // Ing C. Olivetti & C., S.p.A.
        //LH_CODEC = 0x1100,                   // Lernout & Hauspie
        //NORRIS = 0x1400,                     // Norris Communications, Inc.
        //SOUNDSPACE_MUSICOMPRESS = 0x1500,    // AT&T Labs, Inc.
        //DVM = 0x2000                         // FAST Multimedia AG

        #endregion
    }

    #endregion

    /// <summary>
    /// Represents a waveform audio format file (WAV).
    /// </summary>
    public class WaveFile
    {
        #region [ Waveform Format Structure ]

        // /* general waveform format structure (information common to all formats) */
        // typedef struct waveformat_tag {
        //     WORD    wFormatTag;        /* format type */
        //     WORD    nChannels;         /* number of channels (i.e. mono, stereo...) */
        //     DWORD   nSamplesPerSec;    /* sample rate */
        //     DWORD   nAvgBytesPerSec;   /* for buffer estimation */
        //     WORD    nBlockAlign;       /* block size of data */
        // } WAVEFORMAT;

        //Offset  Size  Name             Description
        //--------------------------------------------------------------------------------
        //The canonical WAVE format starts with the RIFF header:

        //0         4   ChunkID          Contains the letters "RIFF" in ASCII form
        //                               (0x52494646 big-endian form).
        //4         4   ChunkSize        36 + SubChunk2Size, or more precisely:
        //                               4 + (8 + SubChunk1Size) + (8 + SubChunk2Size)
        //                               This is the size of the rest of the chunk 
        //                               following this number.  This is the size of the 
        //                               entire file in bytes minus 8 bytes for the
        //                               two fields not included in this count:
        //                               ChunkID and ChunkSize.
        //8         4   Format           Contains the letters "WAVE"
        //                               (0x57415645 big-endian form).

        //The "WAVE" format consists of two subchunks: "fmt " and "data":
        //The "fmt " subchunk describes the sound data's format:

        //12        4   Subchunk1ID      Contains the letters "fmt "
        //                               (0x666d7420 big-endian form).
        //16        4   Subchunk1Size    16 for PCM.  This is the size of the
        //                               rest of the Subchunk which follows this number.
        //20        2   AudioFormat      PCM = 1 (i.e. Linear quantization)
        //                               Values other than 1 indicate some 
        //                               form of compression.
        //22        2   NumChannels      Mono = 1, Stereo = 2, etc.
        //24        4   SampleRate       8000, 44100, etc.
        //28        4   ByteRate         == SampleRate * NumChannels * BitsPerSample/8
        //32        2   BlockAlign       == NumChannels * BitsPerSample/8
        //                               The number of bytes for one sample including
        //                               all channels. I wonder what happens when
        //                               this number isn't an integer?
        //34        2   BitsPerSample    8 bits = 8, 16 bits = 16, etc.
        //          2   ExtraParamSize   if PCM, then doesn't exist
        //          X   ExtraParams      space for extra parameters

        //The "data" subchunk contains the size of the data and the actual sound:

        //36        4   Subchunk2ID      Contains the letters "data"
        //                               (0x64617461 big-endian form).
        //40        4   Subchunk2Size    == NumSamples * NumChannels * BitsPerSample/8
        //                               This is the number of bytes in the data.
        //                               You can also think of this as the size
        //                               of the read of the subchunk following this 
        //                               number.
        //44        *   Data             The actual sound data.

        #endregion

        #region [ Members ]

        // Fields
        private RiffHeaderChunk m_waveHeader;
        private WaveFormatChunk m_waveFormat;
        private WaveDataChunk m_waveData;
        private ListInfoChunk m_listInfo;

        #endregion

        #region [ Constructors ]

        /// <summary>
        /// Creates a new empty in-memory wave file using standard CD quality settings.
        /// </summary>
        public WaveFile()
        {
            m_waveHeader = new RiffHeaderChunk("WAVE");
            m_waveFormat = new WaveFormatChunk(44100, 16, 2, 0x1);
            m_waveData = new WaveDataChunk(m_waveFormat);
        }

        /// <summary>
        /// Creates a new empty in-memory wave file in Pulse Code Modulation (PCM) audio format.
        /// </summary>
        /// <param name="sampleRate">Desired sample rate.</param>
        /// <param name="bitsPerSample">Desired bits-per-sample.</param>
        /// <param name="channels">Desired data channels.</param>
        public WaveFile(SampleRate sampleRate, BitsPerSample bitsPerSample, DataChannels channels)
            : this((int)sampleRate, (short)bitsPerSample, (short)channels, (ushort)WaveFormat.PCM)
        {
        }

        /// <summary>
        /// Creates a new empty in-memory wave file in specified audio format.
        /// </summary>
        /// <param name="sampleRate">Desired sample rate.</param>
        /// <param name="bitsPerSample">Desired bits-per-sample.</param>
        /// <param name="channels">Desired data channels.</param>
        /// <param name="audioFormat">Desired audio format.</param>
        /// <remarks>Consumer will need to apply appropriate data compression for non-PCM data formats.</remarks>
        [CLSCompliant(false)]
        public WaveFile(SampleRate sampleRate, BitsPerSample bitsPerSample, DataChannels channels, WaveFormat audioFormat)
            : this((int)sampleRate, (short)bitsPerSample, (short)channels, (ushort)audioFormat)
        {
        }

        /// <summary>
        /// Creates a new empty in-memory wave file in Pulse Code Modulation (PCM) audio format.
        /// </summary>
        /// <param name="sampleRate">Desired sample rate (e.g., 44100).</param>
        /// <param name="bitsPerSample">Desired bits-per-sample (e.g., 16).</param>
        /// <param name="channels">Desired data channels (e.g., 2 for stereo).</param>
        public WaveFile(int sampleRate, short bitsPerSample, short channels)
            : this(sampleRate, bitsPerSample, channels, (ushort)WaveFormat.PCM)
        {
        }

        /// <summary>
        /// Creates a new empty in-memory wave file in specified audio format.
        /// </summary>
        /// <param name="sampleRate">Desired sample rate (e.g., 44100).</param>
        /// <param name="bitsPerSample">Desired bits-per-sample (e.g., 16).</param>
        /// <param name="channels">Desired data channels (e.g., 2 for stereo).</param>
        /// <param name="audioFormat">Desired audio format (e.g., 0x1 for Pulse Code Modulation).</param>
        /// <remarks>
        /// Consumer will need to apply appropriate data compression for non-PCM data formats.
        /// </remarks>

Lines 1–500 of 1306.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t