 extension AVAudioPCMBuffer {
 
     public struct Peak {
-        var time: Double = 0
-        var framePosition: Int = 0
-        var amplitude: Float = 1
+        public static var min: Float = -10_000.0
+        public var time: Double = 0
+        public var framePosition: Int = 0
+        public var amplitude: Float = 1
     }
 
     /**

        let sampleRate = self.format.sampleRate
        let channelCount = Int(self.format.channelCount)

        AKLog("fadeBuffer() inTime: \(inTime) outTime: \(outTime)")

        // initial starting point for the gain, if there is a fade in, start it at .01 otherwise at 1
        var gain: Double = inTime > 0 ? 0.01 : 1

        }

        value.amplitude = peakValue
        //AKLog(value)
        return value
    }

    // Returns the highest level in the given array
    private func getPeak(from buffer: [Float]) -> Float {
        // create variable with very small value to hold the peak value
        var peak: Float = Peak.min

        for i in 0 ..< buffer.count {
            // store the absolute value of the sample
