AccelerateWatch

AccelerateWatch: High performance digital signal processing and vector operations implemented in C, and wrapped in Swift, designed especially to be targeted at watchOS.

Working version: 1.0.1

Currently all codes are built and tested on

Xcode 8.0 beta 3

iOS 10.0 beta 3

watchOS 3.0 beta 3

Swift 3

Where and why to use AccelerateWatch?

Apple watchOS 3 opens opptunities to developers to access more motion sensor data both in real time and possible background tasks. Unfortunately meanwhile, the Accelerate framework, a powerful tool for high-performance computations, is still unavailable on watchOS. This library is extracted from my other projects, and help those watchOS⌚️ apps which need to process sensor data in real time, just like what Accelerate does for iOS platform.

Swift APIs. C data structures and methods are wrapped in Swift, so that you can call them using Swift conveniently.

Friendly syntax. This is a reason that you even want to use this instead of Accelerate framework on iOS, though other similar libraries like Surge exists.

Currently the functionality set is relatively smaller compared with Accelerate framework because only those I used in my projects are added (mostly focused on time series operations and analysis). So contributions are welcome! 😃

DSBuffer

DSBuffer represents a fixed length signal queue (Float type) which is suitable for storing and processing a windowed time series.

Normal operations

// Create a DSBuffer object// *Tips*: // - If you do not need to perform FFT on the buffer, set fftIsSupperted to be false could save 50% memory.// - If you need to perform FFT, set buffer size to power of 2 could accelerate more.init(size:Int,fftIsSupported:Bool=true)// Push new data to the end of the buffer (and the foremost will be dropped)funcpush(value:Float)// Get data by indexfuncdataAt(index:Int)// Get buffer sizevarbufferSize:Int// Dump buffer as arrayvardata:[Float]// Reset all buffer values to zerofuncclear()