检查wav格式编码
Check wav format coding
如何在 C# 应用程序中获取 wav 文件格式?
我的意思是 .wav uLaw 格式编码 wav 文件。我该如何检查?
PCM 和 uLaw 具有相同的比特率值和 KiB 值。
8,000 Hz ---8 位 PCM---64---469
8,000 Hz ---µ-Law--------64---469
这是 Radiodef 在 java 堆栈溢出方面的精彩回答。
How do I use audio sample data from Java Sound?
这是字节的布局方式http://www.topherlee.com/software/pcm-tut-wavformat.html
希望对您有所帮助!
你需要看看这个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;
}
如何在 C# 应用程序中获取 wav 文件格式? 我的意思是 .wav uLaw 格式编码 wav 文件。我该如何检查?
PCM 和 uLaw 具有相同的比特率值和 KiB 值。
8,000 Hz ---8 位 PCM---64---469
8,000 Hz ---µ-Law--------64---469
这是 Radiodef 在 java 堆栈溢出方面的精彩回答。 How do I use audio sample data from Java Sound?
这是字节的布局方式http://www.topherlee.com/software/pcm-tut-wavformat.html
希望对您有所帮助!
你需要看看这个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;
}