Skip to content

msching/MCAudioInputQueue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MCAudioInputQueue

Simple Recorder based on AudioQueue

Usage

set AudioSession

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryRecord error:nil];
[[AVAudioSession sharedInstance] setActive:YES error:nil];

init & start inputQueue

MCAudioInputQueue *_recorder;
AudioStreamBasicDescription format;
format.mFormatID = kAudioFormatLinearPCM;
format.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
format.mBitsPerChannel = 16;
format.mChannelsPerFrame = 1;
format.mBytesPerPacket = _format.mBytesPerFrame = (_format.mBitsPerChannel / 8) * format.mChannelsPerFrame;
format.mFramesPerPacket = 1;
format.mSampleRate = 8000.0f;

_recorder = [MCAudioInputQueue inputQueueWithFormat:format bufferDuration:0.2 delegate:self];
[_recorder start];

handle data & error

- (void)inputQueue:(MCAudioInputQueue *)inputQueue inputData:(NSData *)data numberOfPackets:(UInt32)numberOfPackets
{
    //handle data
}

- (void)inputQueue:(MCAudioInputQueue *)inputQueue errorOccur:(NSError *)error
{
    //handle error
}

About

Simple Recorder based on AudioQueue

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published