INNER CODE UNIT · Swift

startAudioFrame

pa-jesusf/KikoFlu · ios/Runner/AppDelegate.swift:276

        let startAudioFrame = AVAudioFramePosition(resolvedStartFrame * frameLength)
        let durationMs = Int(Double(file.length) / sampleRate * 1000.0)

        if startAudioFrame >= totalFrames {
            return [
                "frameMs": resolvedFrameMs,
                "startFrame": resolvedStartFrame,
                "durationMs": durationMs,
                "energies": [],
            ]
        }

        file.framePosition = startAudioFrame
        let bufferCapacity = AVAudioFrameCount(frameLength)
        let buffer = AVAudioPCMBuffer(pcmFormat: sourceFormat, frameCapacity: bufferCapacity)!
        var energies: [Double] = []
        var framesReadTotal = startAudioFrame

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…