     public var rightAmplitude: Float {
         return amp[1]
     }
+    
+    /// Determines if the returned amplitude value is the rms or peak value
+    public var mode: AnalysisMode = .rms
 
     private var handler: (Float) -> Void = { _ in }
 

    /// - parameter input: Node to analyze
    /// - parameter bufferSize: Size of buffer to analyze
    /// - parameter handler: Code to call with new amplitudes
    public init(_ input: Node, bufferSize: UInt32 = 1_024, handler: @escaping (Float) -> Void = { _ in }) {
        self.handler = handler
        super.init(input, bufferSize: bufferSize)
    }


        for n in 0 ..< channelCount {
            let data = floatData[n]

            if mode == .rms {
                var rms: Float = 0
                vDSP_rmsqv(data, 1, &rms, UInt(length))
                amp[n] = rms
            } else {
                var peak: Float = 0
                var index: vDSP_Length = 0
                vDSP_maxvi(data, 1, &peak, &index, UInt(length))
                amp[n] = peak
            }
        }

        handler(amplitude)
