SignalKit offers a powerful toolkit for real-time audio digital signal processing on Apple platforms. Built entirely in Swift with zero dependencies, it provides essential audio processors like EQ, Compressor, and Limiter, ensuring optimized performance without unnecessary overhead. Ideal for developers seeking efficient audio solutions.
SignalKit is a powerful audio Digital Signal Processing (DSP) toolkit specifically designed for real-time audio processing on Apple platforms using pure Swift. With zero dependencies, this toolkit is optimized for high-performance applications, ensuring efficient handling of audio signals without unnecessary overhead.
Key Features
SignalKit offers a collection of robust audio processors tailored for various applications:
| Processor | Description | Acceleration |
|---|---|---|
| EQProcessor | A 10-band parametric equalizer based on biquad cascade | vDSP_deq22 |
| CompressorProcessor | A 3-band multiband compressor featuring Linkwitz-Riley crossovers | vDSP |
| LimiterProcessor | A brick-wall look-ahead peak limiter | Linear-domain math |
| StereoWidener | Mid/Side stereo image control | vDSP matrix ops |
| CrossfeedProcessor | Headphone crossfeed with interaural time difference simulation | IIR + delay line |
| LoudnessMeter | ITU-R BS.1770-4 LUFS meter with optional Automatic Gain Control (AGC) | K-weighting biquads |
| SPSCRingBuffer | A lock-free single-producer/single-consumer ring buffer | OSMemoryBarrier |
Performance Metrics
SignalKit has been measured on Apple Silicon (M-series), showcasing minimal processor usage while maintaining high responsiveness through various processors. Each processor adheres to real-time budget constraints, allowing for seamless integration into performance-sensitive applications. Key performance metrics include:
| Processor | Median Processing Time | % of Real-Time Budget |
|---|---|---|
| EQ (10-band) | 7.96 μs | 0.07% |
| Compressor (3-band) | 29.21 μs | 0.27% |
| Limiter | 2.88 μs | 0.03% |
| Stereo Widener | 0.12 μs | < 0.01% |
| Crossfeed | 1.42 μs | 0.01% |
| LUFS Meter + AGC | 1.92 μs | 0.02% |
| Total Pipeline | 37.79 μs | 0.35% |
Real-Time Safety
SignalKit emphasizes real-time safety by strictly adhering to performance-centric programming practices:
- No heap allocations during processing
- No locking mechanisms
- No Objective-C messaging, ensuring thread safety
Each processor is carefully designed to maintain these principles, making it suitable for high-performance audio applications.
Usage Example
Integrating SignalKit into audio projects is straightforward. Here’s how to implement a 10-band equalizer:
import SignalKit
// Create a 10-band EQ at 48 kHz
let eq = EQProcessor(sampleRate: 48000, maxChannels: 2)
eq.apply(preset: .bassBoost)
// Process audio in your render callback
func renderCallback(buffer: UnsafeMutablePointer<Float>, frames: Int) {
eq.process(buffer, count: frames, channel: 0)
}
SignalKit provides efficient solutions for various audio processing tasks, making it a valuable resource for developers looking to implement advanced audio features in their applications. Its structure allows for easy extension and modification, ensuring that it fits seamlessly into various audio projects across macOS, iOS, tvOS, and visionOS environments.
No comments yet.
Sign in to be the first to comment.