         let totalFrames = (audioFile.samplesCount - startFrame) - (audioFile.samplesCount - endFrame)
         frameCount = AVAudioFrameCount(totalFrames)
 
-        //AKLog("startFrame: \(startFrame) frameCount: \(frameCount)")
+        // AKLog("startFrame: \(startFrame) frameCount: \(frameCount)")
 
         if #available(iOS 11, macOS 10.13, tvOS 11, *) {
             playerNode.scheduleSegment(audioFile,


        let sampleTime: Double = 1.0 / audioFile.sampleRate

        //exponential fade type

        // from -20db?
        let fadeInPower: Double = exp(log(10) * sampleTime / fade.inTime)

        case dynamic, always
    }

    // TODO: allow for different exponential curve slopes, implement other types
    public enum FadeType {
        case exponential // , linear, logarithmic
    }

    public struct Loop {
