     /// Time within the audio file at the current time
     open var playhead: Double {
         
-        let endTime = Double(Double(endingFrame) / internalAudioFile.sampleRate)
-        let startTime = Double(Double(startingFrame) / internalAudioFile.sampleRate)
+        let endTime = Double(endingFrame) / internalAudioFile.sampleRate
+        let startTime = Double(startingFrame) / internalAudioFile.sampleRate
         
         if endTime > startTime {
             

        }
    }
    
    /// Sets the time in the future when playback will commence. For immediately playback, leave it 0.
    open var scheduledTime: Double = 0
    
    
    // MARK: - Initialization

    /// Play the file back from a certain time, to an end time (if set). You can optionally set a scheduled time to play (in seconds).
    ///
    ///  - Parameters:
    ///    - from startTime: Time into the file at which to start playing back
    ///    - to endTime: Time into the file at which to playing back will stop / Loop
    ///    - when scheduledTime: use this when scheduled playback doesn't need to be in sync with other players
    ///         otherwise use the avTime signature.
    ///
    open func play(from startTime: Double = 0, to endTime: Double = 0, when scheduledTime: Double = 0) {
        let hostTime = mach_absolute_time()
        let avTime = AKAudioPlayer.secondsToAVAudioTime(hostTime:hostTime, time:scheduledTime)
        play(from:startTime, to:endTime, avTime:avTime)
    }
    
    /// Play the file back from a certain time, to an end time (if set). You can optionally set a scheduled time to play (in seconds).
    ///
    ///  - Parameters:
    ///    - from startTime: Time into the file at which to start playing back
    ///    - to endTime: Time into the file at which to playing back will stop / Loop
    ///    - avTime: an AVAudioTime object specifying when to schedule the playback. You can create this using the helper function
    ///         AKAudioPlayer.secondToAVAudioTime(hostTime:time). hostTime is a call to mach_absolute_time(). When you have a group of
    ///         players which you want to sync together it's important that this value be the same for all of them as a reference point.
    ///
    open func play(from time: Double, to endTime: Double, avTime:AVAudioTime? ) {
        if endTime > 0 {
            self.endTime = endTime
        }
        self.startTime = time
        
        if endingFrame > startingFrame {
            stop()
            scheduledAVTime = avTime
            start()
        } else {
            AKLog("ERROR AKaudioPlayer:  cannot play, \(internalAudioFile.fileNamePlusExtension) is empty or segment is too short!")
        }
    }
    
    // MARK: - Static Methods
    
    open class func secondsToAVAudioTime(hostTime:UInt64, time: Double) -> AVAudioTime {
        // Find the conversion factor from host ticks to seconds
        var timebaseInfo = mach_timebase_info()
        mach_timebase_info(&timebaseInfo)
        let hostTimeToSecFactor = Double(timebaseInfo.numer) / Double(timebaseInfo.denom) / Double(NSEC_PER_SEC)
        
        let out = AVAudioTime(hostTime: hostTime + UInt64(time / hostTimeToSecFactor))
        return out
    }
    
    // MARK: - Private Methods
    
