Documentation
Ultrasound Audio Analyzer Framework
roto_ultrasound.framework for iOS®/iPadOS®
- Version: 1.01
- Author: David Bukowitz
- Created: 21 Mar, 2021
- Update: 30 Oct, 2021
If you have any questions that are beyond the scope of this document, Please feel free to email via info@rotovibes.com
Description
roto_ultrasound.framework is an iOS®/iPadOS® library that allows communication with any ultrasound mic output and provides post-procesing capabilites to collect, plot, analyze, record and playback the ultrasound signal.
Installation
Follow the steps below to install the roto-icpsc framework
- Drag and drop the roto_ultrasound.framework file into your Xcode project
- Select the "Embed & Sign" option in the Framworks, Libraries and Embedded Content menu
Framework Structure
- collect_us: Ultrasound audio signal capture and analysis
- playback_us: Reproduce ultrasound signal
- RotoAudioTWF: Plot an infinite waveform
// collect the ultrasound signal
// timeSec: duration of collection in seconds
// fileName: file name string
+(void) collectUltraSoundWithTimeinSec: (int)timeSec withFileName:(NSString*)fileName;
// returns the ultrasound average value for the collecting time in dB
+(double) ultraSoundAvgValdB;
// returns the ultrasound max peak value for the collecting time in dB
+(double) ultraSoundMaxPeakdB;
// play collected ultrasound signal from file
+(void) playUltraSoundFromFile: (NSString*)fileName;
// plot the waveform from values collected from collect_us
- (void)addSoundMeterItem:(double)lastValue withCounter:(int)counter;
Configuring your project
- Import the roto_ultrasound/collect_us.h to your project's class
- Add the microphone usage description permission Privacy - Microphone Usage Description to the plist info:
#import "ViewController.h"
#import "roto_ultrasound/collect_us.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
Collecting Data
- Request a measurement with the time duration in seconds using the command: collectUltraSoundWithTimeinSec:(int)
- To request the the average dB values use ultraSoundAvgValdB method as follow:
- To request the the max peak of the signal in dB use ultraSoundMaxPeakdB method as follow:
- To play the ultrasound audio from the saved file, use: playUltraSoundFromFile: (NSString*)fileName
- To plot real-time ultrasonic waveform, use: addSoundMeterItem:(double)lastValue withCounter:(int)counter
...
- (void)collectData {
[collect_us collectUltraSoundWithTimeinSec:1 withFileName:@"yourFileName.m4a"];
}
...
...
- (void)getAverageValue {
NSLog (@"Avg Val: %.2f dB", [collect_us ultraSoundAvgValdB]);
}
...
...
- (void)getMAxPeakValue {
NSLog (@"Max Peak: %.2f dB", [collect_us ultraSoundMaxPeakdB]);
}
...
Below is a sample of a console log response:
...
- (void)playAudioFile {
[collect_us playUltraSoundFromFile:@"yourFileName.m4a"];
}
...
...
#import "roto_ultrasound/RotoAudioTWF.h"
...
- (void)plotWaveform {
[self.plot_view addSoundMeterItem:[collect_us ultraSoundAvgValdB] withCounter:counter];
}
...
Below is a sample of the output UIImage
Changelog
See what's new added, changed, fixed, improved or updated in the latest versions.
Version 1.01 (30 Oct, 2021)
- Updated Optimized for iOS®15
Version 1.0 (21 Mar, 2021)
Initial Release