IPhone Audio Recording - AudioStreamBasicDescription Values

These are the values ​​that I pass, this is the only combination of values ​​that I received.

dataFormat.mSampleRate = 44100;    
dataFormat.mFormatID = kAudioFormatLinearPCM;
dataFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsBigEndian;
dataFormat.mBytesPerPacket = 4;
dataFormat.mFramesPerPacket = 1;
dataFormat.mBytesPerFrame = 4;
dataFormat.mChannelsPerFrame = 2;
dataFormat.mBitsPerChannel = 16;

status = AudioQueueNewInput(  &dataFormat, AudioInputCallback, self, NULL, NULL,  0,  
                   &queue);

status = AudioFileCreateWithURL(fileUrl, kAudioFileCAFType, &dataformat, kAudioFileFlags_EraseFile, &audioFile

Recording works, but during recording there is a lot of noise during playback. Could this have anything to do with this code?

+3
source share
2 answers

I see two possible errors. First, as pointed out by @invalidname, recording in stereo will probably not work on a mono device such as an iPhone. Well, it might work, but if it does, you will still get stereo streams with two monophones back, so why bother? You can also configure the stream to work in mono and save yourself from processor overhead.

, , . :

kAudioFormatFlagIsSignedInteger |
kAudioFormatFlagsNativeEndian |
kAudioFormatFlagIsPacked

, mReserved 0. , , , 0, .

. iPhone - , , . , .

"", , ( , ). , , Xcode . , , .

+2

? ? ?

, : , ..

, , , , , .

: iPhone ? , , 8 44.1.

+1

Source: https://habr.com/ru/post/1709168/


All Articles