https://github.com/hansemannn/ios-coremotion-fft
Calculate FFT values based on iOS CoreMotion accelerometer data
https://github.com/hansemannn/ios-coremotion-fft
accelerate-framework coremotion fft ios
Last synced: about 2 months ago
JSON representation
Calculate FFT values based on iOS CoreMotion accelerometer data
- Host: GitHub
- URL: https://github.com/hansemannn/ios-coremotion-fft
- Owner: hansemannn
- License: mit
- Created: 2017-08-15T13:08:10.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-22T08:44:20.000Z (over 7 years ago)
- Last Synced: 2025-01-27T07:11:41.574Z (4 months ago)
- Topics: accelerate-framework, coremotion, fft, ios
- Language: Objective-C
- Size: 49.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# iOS CoreMotion FFT
Calculate FFT values based on iOS CoreMotion accelerometer data.## Credits
Huge shout-out to [this StackOverflow](https://stackoverflow.com/questions/32840282/how-to-get-correct-mean-values-after-applying-fourier-transform-on-accelerometer/32843293) which provided the core-algorithm used to calculate FFT values.## Usage
This is an example project containing the `FFTCalculator` library I wrote to wrap the FFT-functionality.
Here is an example usage (Obj-C):
```objc
#import "FFTCalculator.h"- (void)viewDidLoad {
[super viewDidLoad];// Initialize calculator with frame size
FFTCalculator *fftCalculator = [[FFTCalculator alloc] initWithFrameSize:256];
// Check if the CoreMotion sensor is available (= FFTCalculator is supported)
if (![fftCalculator isSupported]) {
NSLog(@"Error: FFTCalculator not supported due to device restrictions");
NSLog("@Please run this project on the device to use the CoreMotion sensor.");
return;
}
// Start updates
[fftCalculator startUpdatesWithCalculationHandler:^(NSArray * _Nullable values, float mean, NSError * _Nullable error) {
NSLog(@"\nFourier values: %@", values);
NSLog(@"Fourier mean-value: %f", mean);
}];// Stop updates
[fftCalculator stopUpdates];
}
```## Copyright
MIT## Author
Hans Knöchel