战舰的板子,1053b录音实验做好了,可以实现线性PCM的录音和播放,用的程序就是例程给的,但是我想实现IMA ADPCM录音,wav头和录音初始化设置如下void recoder_wav_init(__WaveHeader* wavhead) //初始化WAV头 {
wavhead->riff.ChunkID=0X46464952; //"RIFF"
wavhead->riff.ChunkSize=0xffffffff; //还未确定,最后需要计算
wavhead->riff.Format=0X45564157; //"WAVE"
wavhead->fmt.ChunkID=0X20746D66; //"fmt "
wavhead->fmt.ChunkSize=20; //大小为16个字节
wavhead->fmt.AudioFormat=0X11; //0X01,表示PCM;0X11,表示IMA ADPCM
wavhead->fmt.NumOfChannels=0x01; //单声道
wavhead->fmt.SampleRate=0x1f40; //8Khz采样率 采样速率
wavhead->fmt.ByteRate=0x0fd7; //16位,即2个字节
wavhead->fmt.BlockAlign=0x100; //块大小,2个字节为一个块
wavhead->fmt.BitsPerSample=4; //16位PCM
wavhead->fmt.ByteExtraData=2;
wavhead->fmt.ExtraData=0x01f9;
wavhead->fact.ChunkID=0x74636166;
wavhead->fact.ChunkSize=4;
wavhead->fact.NumOfSamples=0xffffffff;
wavhead->data.ChunkID=0X61746164; //"data"
wavhead->data.ChunkSize=0xffffffff; //数据大小,还需要计算
}
VS_WR_Cmd1(SPI_BASS,0x00,0x00);
VS_WR_Cmd1(SPI_AICTRL0,0x00,0x0c); //设置采样率,设置为8Khz,线性PCM直接写采样值,IMA ADPCM写分频值
VS_WR_Cmd1(SPI_AICTRL1,0x00,0x00); //设置增益,0,自动增益.1024相当于1倍,512相当于0.5倍,最大值65535=64倍
VS_WR_Cmd1(SPI_AICTRL2,0x10,0x00); //设置增益最大值,0,代表最大值65536=64X
VS_WR_Cmd1(SPI_AICTRL3,0x00,0x02); //左通道(MIC单声道输入),0是IMA ADPCM,1是线性PCM
VS_WR_Cmd1(SPI_CLOCKF,0x20,0x00); //设置VS10XX的时钟,MULT:2倍频;ADD:不允许;CLK:12.288Mhz
VS_WR_Cmd1(SPI_MODE,0x18,0x04); //MIC,录音激活
问题是现在设置成这样,有回声,录音文件也有,但是播放都是杂音,听不见录得声音,请大家帮忙分析一下原因,在线等。还有播放时设置如下
VS_WR_Cmd1(SPI_MODE,0x08,0x04);
VS_WR_Cmd1(SPI_CLOCKF,0x98,0x00);
VS_WR_Cmd1(SPI_AUDATA,0x1f,0x40);
VS_WR_Cmd1(SPI_BASS,0x00,0x00);
VS_WR_Cmd1(SPI_VOL,0x20,0x20);
VS_Reset_DecodeTime();
大家看看有啥错误,难道IMA ADPCM录音还有其他设置吗?
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>