     }()
 
   private lazy var frequencyDetector: FrequencyDetector = { [unowned self] in
-    let frequencyDetector = FrequencyDetector(
-      sampleRate: 44100.0,
-      bufferSize: self.bufferSize,
-      delegate: self)
-
+    let frequencyDetector = FrequencyDetector(delegate: self)
     return frequencyDetector
     }()
 
   // MARK: - Initialization
 
-  public init(bufferSize: AVAudioFrameCount = 2048, delegate: TunerDelegate?) {
+  public init(bufferSize: AVAudioFrameCount = 4096, delegate: TunerDelegate?) {
     self.bufferSize = bufferSize
     self.delegate = delegate
   }


  public func frequencyDetector(frequencyDetector: FrequencyDetector,
    didRetrieveFrequency frequency: Float) {
      let pitch = Pitch(frequency: Double(averageFrequency(frequency)))
      delegate?.tunerDidRecievePitch(self, pitch: pitch)
  }
}

extension Tuner: AudioInputProcessorDelegate {

  public func audioInputProcessor(audioInputProcessor: AudioInputProcessor,
    didReceiveBuffer buffer: AVAudioPCMBuffer, atTime time: AVAudioTime) {
      frequencyDetector.readBuffer(buffer, atTime: time)
  }
}

