检查wav格式编码

本文关键字:编码 格式 wav 检查 | 更新日期: 2023-09-27 18:01:09

如何在C#应用程序中获取wav文件格式?我的意思是.wav uLaw用于对wav文件进行mt编码。我该怎么查?

PCM和uLaw都具有相同的比特率值和KiB值。

8000赫兹---8位PCM---64-469
8000 Hz-µ-定律--------64---469

检查wav格式编码

您需要看看这篇文章。

/// <summary>
        /// Ensure any given wave file path that the file matches 
        /// with default or base format [16bit 8kHz Mono]
        /// </summary>
        /// <param name="strPath">Wave file path</param>
        /// <returns>True/False</returns>
        public bool Validate(string strPath)
        {
            if (strPath == null) strPath = "";
            if (strPath == "") return false;
            clsWaveProcessor wa_val = new clsWaveProcessor();
            wa_val.WaveHeaderIN(strPath);
            if (wa_val.BitsPerSample != BIT_PER_SMPL) return false;
            if (wa_val.Channels != CHNL) return false;
            if (wa_val.SampleRate != SMPL_RATE) return false;
            return true;
        }
        /// <summary>
        /// Compare two wave files to ensure both are in same format
        /// </summary>
        /// <param name="Wave1">ref. to processor object</param>
        /// <param name="Wave2">ref. to processor object</param>
        /// <returns>True/False</returns>
        private bool Compare(ref clsWaveProcessor Wave1, ref clsWaveProcessor Wave2)
        {
            if (Wave1.Channels != Wave2.Channels) return false;
            if (Wave1.BitsPerSample != Wave2.BitsPerSample) return false;
            if (Wave1.SampleRate != Wave2.SampleRate) return false;
            return true;
        }

以下是Radiodef关于堆栈溢出的java方面的精彩回答。如何使用Java Sound中的音频样本数据?

以下是字节的排列方式http://www.topherlee.com/software/pcm-tut-wavformat.html

希望能有所帮助!