AKNodeRecorder produces empty audio file on iOS

393 views
Skip to first unread message

MF

unread,
Apr 26, 2017, 12:45:43 PM4/26/17
to AudioKit Users Group

Hi, I am trying to record a node output using AKNodeRecorder based on the Recording Notes example from Playground. Based on the console output, it did start recording (it shows record() AKNodeRecorder: recording). In the playground example, it logs the further info (record() AKNodeRecorder writing (file duration: 0.1 seconds)). But in my case it doesn't log any further info. When I stopped recording after at least 10 seconds, the console shows stopRecordingAndExport() Stopped. (0.000 seconds recorded). It looks to me like the recorder was not able to record the node. Am I doing something wrong here? 


When initializing the recorder, the system said that Audio files cannot be non-interleaved. Ignoring setting AVLinearPCMIsNonInterleaved YES. I wonder if it's related to the issue I am having.


I am running the program on an iPad with iOS 10.3.1. I am using the latest AudioKit release.


Here is the code:

 

open class OscillatorInstrument: NSObject {

    var fmBank = AKFMOscillatorBank()

    var oscMixer : AKMixer!

    var recorder : AKNodeRecorder!


    public override init() {

        super.init()

oscMixer = AKMixer(fmBank)

        AudioKit.output = fmBank

        AudioKit.start()


        do {

            recorder = try AKNodeRecorder(node: oscMixer)


            AKLog((recorder.audioFile?.directoryPath.absoluteString)!)

            AKLog((recorder.audioFile?.fileNamePlusExtension)!)

        } catch {

            AKLog("can't create recorder")

        }

    }


    open func startRecording() {


        do {

            try recorder.record()

        } catch {

            AKLog("Couldn't record")

        }


    }


    open func stopRecordingAndExport() {

        let dur = String(format: "%0.3f seconds", recorder.recordedDuration)

        AKLog("Stopped. (\(dur) recorded)")


        recorder.stop()

    }

}


Here is the log data from the console:


2017-04-26 09:54:04.045329+0200 VideoSynth[3149:726988] [DYMTLInitPlatform] platform initialization successful

2017-04-26 09:54:04.414046+0200 VideoSynth[3149:726925] Audio files cannot be non-interleaved. Ignoring setting AVLinearPCMIsNonInterleaved YES.

init() /private/var/mobile/Containers/Data/Application/91AD0864-0C60-4152-8922-2541AF89979D/tmp/

init() 27202A4E-9283-443A-B4BB-4264FB235EDA.caf

2017-04-26 09:54:04.591836+0200 VideoSynth[3149:726925] Creating OpenGL ES2 Renderer

2017-04-26 09:54:04.691268+0200 VideoSynth[3149:726925] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles

2017-04-26 09:54:04.693088+0200 VideoSynth[3149:726925] [MC] Reading from public effective user settings.

record() AKNodeRecorder: recording

stopRecordingAndExport() Stopped. (0.000 seconds recorded)

Matthew Gallagher

unread,
Apr 26, 2017, 4:22:17 PM4/26/17
to AudioKit Users Group
I had this same problem before. Try setting AudioKit.output = oscMixer instead

MF

unread,
May 2, 2017, 1:07:02 PM5/2/17
to AudioKit Users Group
Hi Matt!

Thanks so much for the help! It works :)

I wonder if it's a iOS specific bug. the playground example is similar to my setting and it works fine when running on osx. But on iOS we can only record the output node.
Reply all
Reply to author
Forward
0 new messages