当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - How to change sample rate of wav audio file from any to 8000

问题描述:

I have problem with converting input wave files to wave file with 8000 sample rate.

My codes until now are:

opBrowseFile.ShowDialog();

string fileName = opBrowseFile.FileName;

System.IO.Stream waveFileStream = System.IO.File.OpenRead(fileName);

BinaryReader reader = new BinaryReader(waveFileStream);

int chunkID = reader.ReadInt32();

int fileSize = reader.ReadInt32();

int riffType = reader.ReadInt32();

int fmtID = reader.ReadInt32();

int fmtSize = reader.ReadInt32();

int fmtCode = reader.ReadInt16();

int channels = reader.ReadInt16();

int sampleRate = reader.ReadInt32();

int fmtAvgBPS = reader.ReadInt32();

int fmtBlockAlign = reader.ReadInt16();

int bitDepth = reader.ReadInt16();

So now I have header info of wave file but I want to know how to convert it to lower sample rate. I inform that I want to this by myself and not with components same NAudio.

分享给朋友:
您可能感兴趣的文章:
随机阅读: