1
我正在嘗試優化語音郵件質量,但我不知道音頻。我的問題是,如何在AQRecord中設置比特率?如何在AQRecorder中設置比特率
這裏是我的代碼:
void AQRecorder::SetupAudioFormat(UInt32 inFormatID){
memset(&mRecordFormat, 0, sizeof(mRecordFormat));
mRecordFormat.mFormatID = inFormatID;
if (inFormatID == kAudioFormatLinearPCM)
{
// if we want pcm, default to signed 16-bit little-endian
mRecordFormat.mSampleRate = 8000.0; // amr 8khz
mRecordFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
mRecordFormat.mBitsPerChannel = 16;
mRecordFormat.mChannelsPerFrame = 1;
mRecordFormat.mFramesPerPacket = 1;
mRecordFormat.mBytesPerFrame = (mRecordFormat.mBitsPerChannel/8) * mRecordFormat.mChannelsPerFrame;
mRecordFormat.mBytesPerPacket = mRecordFormat.mBytesPerFrame ;
}
}
如果我想讓語音信息質量更好,我該怎麼辦?將sampleRate設置爲16000或44100? –
@ Antony.zhu:更新了我的回答。 – Goz
非常感謝您的回答! –