Skip to content

Latest commit

 

History

History
31 lines (18 loc) · 1.12 KB

README.md

File metadata and controls

31 lines (18 loc) · 1.12 KB

SwiftLPC: High-Performance Linear Predictive Coding in Swift

SwiftLPC is a small library that performs Linear Predictive Coding. LPC is a powerful tool in speech processing, used for efficiently encoding the spectral characteristics of speech. SwiftLPC takes full advantage of the Accelerate framework for optimal performance.

This implementation uses Burg’s method and is essentially a conversion of the existing implementation in the librosa Python library.

With a native Swift implementation of this algorithm we can get significantly improved performance, and the ability to run analysis on large audio files directly on mobile devices.

Example Usage

import SwiftLPC

let lpc = LinearPredictiveCoding()

let audioSignal: [Float] = [...]
let predictedCoefficents = lpc.computeLpc(audioSignal, order: 31)

Benchmarks

Running on a 1 minute wav file on a 10-core M1 Pro.

  • librosa: ~165ms
  • SwiftLPC: ~60ms

2.75x speed improvement.

Author