I am attempting to optimize voice message quality, but I don't know about audio. My problem is, how to set bit-rate in AQRecord?
here is my code:
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 ;
}
}
Your bit rate is currently set to 128kbps.
For Linear PCM the bit rate is calculated as sampleRate * bitDepth * numChannels. In your case this is 8000 * 16 * 1 or 128000.
Edit: PCM is already at "best" quality. At 8kHz sampling rate you are slightly clipping the vocal frequency range. 16kHz covers the vocal range better than 8kHz sampling. Anything beyond that sample rate is unnecessary for speech.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.