【发布时间】:2015-07-06 14:10:45
【问题描述】:
如何在 C# 应用程序中获取 wav 文件格式? 我的意思是 .wav uLaw foramt 编码 wav 文件。我该如何检查?
PCM 和 uLaw 具有相同的比特率值和 KiB 值。
8,000 Hz ---8 位 PCM---64---469
8,000 Hz ---µ-Law--------64---469
【问题讨论】:
如何在 C# 应用程序中获取 wav 文件格式? 我的意思是 .wav uLaw foramt 编码 wav 文件。我该如何检查?
PCM 和 uLaw 具有相同的比特率值和 KiB 值。
8,000 Hz ---8 位 PCM---64---469
8,000 Hz ---µ-Law--------64---469
【问题讨论】:
你需要看看这个article。
/// <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 方面的精彩回答。 How do I use audio sample data from Java Sound?
这是字节的布局方式http://www.topherlee.com/software/pcm-tut-wavformat.html
希望有帮助!
【讨论】: