Skip to content

Instantly share code, notes, and snippets.

@psugihara
Created February 8, 2013 02:00
Show Gist options
  • Save psugihara/4736032 to your computer and use it in GitHub Desktop.
Save psugihara/4736032 to your computer and use it in GitHub Desktop.
NSArray *pathComponents = @[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject],
fileName];
NSURL *outputFileURL = [NSURL fileURLWithPathComponents:pathComponents];
AudioFileWriter *fileWriter = [[AudioFileWriter alloc]
initWithAudioFileURL:outputFileURL
samplingRate:_audioManager.samplingRate
numChannels:_audioManager.numInputChannels];
float data[_loopLength * _audioManager.numInputChannels];
_loopBuffer->FetchInterleavedData(data, _loopLength, _audioManager.numInputChannels);
[fileWriter writeNewAudio:data
numFrames:_loopLength
numChannels:_audioManager.numInputChannels];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment