Audiokit: AKAudioRecorder: How to record a specific node?

Created on 25 Apr 2016  路  7Comments  路  Source: AudioKit/AudioKit

Hi there, I was wondering how I can get an AKAudioRecorder to, y'know, actually record something. AKAudioRecorder's interface seems very simple, with only init(:), record(), and stop(); but I need to know how to get it to record a specific node.

enhancement

All 7 comments

AKAudioRecorder only records what is coming out of the speaker, ie. the final output.
So, if you wanted to record a specific node, you'd have to install a tap on that node and then write the incoming buffers to disk. I agree it would be really cool if AKAudioRecorder could be given an optional node to record from.

This could actually be a huge feature request. Excited about the possibility of doing multitrack recording with audiokit, particularly if an AKAudioRecorder can be attached to each node (or even custom group of nodes).

@aure: Ok, this makes sense. I am, however, having an issue that AKAudioRecorder is recording _nothing_ to a file I give it, even though there is an output to AudioKit.output(). Is there any sample code or project that you know of which uses AKAudioRecorder? Maybe I'm just missing something.

@blerchy I am wrong about the AKAudioRecorder. It does not record the output. It only records the input. So, I can tackle this problem in two steps. First, record from the output node, then make a recorder attached to any node.

@aure I am a bit confused now, which input does the AKAudioRecorder record from? If I can't get it to record a specific node, can I get it to record from the microphone instead?

Currently AKAudioRecorder just records from the inputNode, ie. the microphone. I am working on a node recorder right now.

@blerchy @arsone In the develop branch, I have committed a new AKAudioRecorder that seems to work like it should. It defaults to recording the overall AudioKit output (like I thought it was already), but you can also initialize it with a node: so that you can tell it to record from the microphone, or any AKNode. It seems to only record in .caf format right now and its probably brittle if you try recording the same node (why you would do that I don't know!), but it should suffice for now. I'll make some playgrounds and examples that use it. Definitely use with caution! To use it, either update to the develop branch or just overwrite your AKAudioRecorder.swift contents with the following:

https://github.com/audiokit/AudioKit/blob/ca0cf66af9953741cf1516e12508261892eb93cf/AudioKit/Common/Internals/AKAudioRecorder.swift

I'll leave this issue open while we discuss things, but if you feel satisfied, feel free to close it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

minayko picture minayko  路  4Comments

NadirBertolasi picture NadirBertolasi  路  10Comments

trevor-sonic picture trevor-sonic  路  5Comments

adamjsutcliffe picture adamjsutcliffe  路  10Comments

ghost picture ghost  路  8Comments