AbdouSarr / libfvad_swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libfvad_swift

libfvad_swift is an open-source Swift package that provides an easy-to-use iOS API for WebRTC's voice activity detection feature (VAD).

forked and ported to SPM from the original implementation here.

Usage Example

import AVFoundation
import libfvad_swift

let detector = fvad_new()

public func runPrediction(on frames: UnsafePointer<Int16>, interval ms: Int) -> Bool {
    let count = ms * _sampleRate / 1000
    switch fvad_process(inst, frames, count) {
    case 0:
        return false // no voice activity
    case 1:
        return true // voice activity detected
    default:
        break
    }
}

Installation (Swift Package Manager)

To use libfvad_swift in your project, add it to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/abdousarr/libfvad_swift", from: "1.0.1")
]

And then import the package in your source files:

import libfvad_swift

About

License:MIT License


Languages

Language:C 95.4%Language:Objective-C 2.5%Language:Swift 2.1%