Skip to content

hyper-online/SwiftLPC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

High-Performance Linear Predictive Coding in Swift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages