0

First of all, I'm using the audio manipulator framework called AudioKit.

I am trying to plot the AKMicrophone() using AKNodeOutputPlot() but it's not working. It's returning the error:

https://i.stack.imgur.com/a2rwY.jpg

I think it's everything right with the AKMicrophone/AKFrequecyTracker since I'm getting good results.

My code to plot:

    ::
        @IBOutlet var audioInputPlot: AKNodeOutputPlot!

        func setupPlot() {

            audioInputPlot.node = soundAnalyser.mic
            audioInputPlot.plotType = .rolling
            audioInputPlot.shouldFill = true
            audioInputPlot.shouldMirror = true
            audioInputPlot.color = UIColor.blue

        }

    ::

    class SoundAnalyser {

        var delegate:SoundAnalyserDelegate?

        let minimum = Double(50)
        let maximum = Double(2000)

        var mic: AKMicrophone
        var tracker: AKFrequencyTracker
        fileprivate var silence: AKBooster
        fileprivate var timer: Timer?
        fileprivate var notesArray: [(name:String, frequency:Double)]? //tuples array

    ::

AudioInputPlot is connected with an UIView on the storyboard. It's defined as class 'UIView'.

If I set the UIView's class as AKNodeOutputPlot, the terminal shows: Microphone_Analyser_AK[82421:10401487] Unknown class AKNodeOutputPlot in Interface Builder file. (lldb)

Seems that the storyboard isn't recognizing AudioKit framework... Should I proceed with doing it programatically or you know what is causing the problem?

What's wrong with this code?

denisb411
  • 581
  • 1
  • 7
  • 25
  • since this is the initializer `AKNodeOutputPlot(mic, frame: frame)` i dont think that you can add it in the storyboard – zombie Mar 17 '17 at 18:03

1 Answers1

0

Problem was that I was calling setupPlot() more than once. Solved the problem calling setupPlot() just one time under viewDidLoad().

denisb411
  • 581
  • 1
  • 7
  • 25