Documentation

Ultrasound Audio Analyzer Framework

roto_ultrasound.framework for iOS®/iPadOS®


  • 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, analyze, record and playback the ultrasound signal.


Installation

Follow the steps below to install the roto-icpsc framework

  1. Drag and drop the roto_ultrasound.framework file into your Xcode project
  2. Select the "Embed & Sign" option in the Framworks, Libraries and Embedded Content menu

Framework Structure

  1. collect_us: Ultrasound audio signal capture and analysis
  2. 
    // 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;
      
  3. playback_us: Reproduce ultrasound signal
  4. 
    // play collected ultrasound signal from file
    +(void) playUltraSoundFromFile: (NSString*)fileName;
    

Configuring your project

  1. Import the roto_ultrasound/collect_us.h to your project's class
  2. 
    #import "ViewController.h"
    #import "roto_ultrasound/collect_us.h"
    
    @interface ViewController ()
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
       [super viewDidLoad];
    }
    
  3. Add the microphone usage description permission Privacy - Microphone Usage Description to the plist info:

Collecting Data

  1. Request a measurement with the time duration in seconds using the command: collectUltraSoundWithTimeinSec:(int)
  2. 
    ...
    - (void)collectData {
        [collect_us collectUltraSoundWithTimeinSec:1 withFileName:@"yourFileName.m4a"];
    }
    ...
             
  3. To request the the average dB values use ultraSoundAvgValdB method as follow:
  4. 
    ...
    - (void)getAverageValue {
        NSLog (@"Avg Val: %.2f dB", [collect_us ultraSoundAvgValdB]);
    }
    ...
                        
  5. To request the the max peak of the signal in dB use ultraSoundMaxPeakdB method as follow:
  6. 
    ...
    - (void)getMAxPeakValue {
        NSLog (@"Max Peak: %.2f dB", [collect_us ultraSoundMaxPeakdB]);
    }
    ...
                                     

    Below is a sample of a console log response:

  7. To play the ultrasound audio from the saved file, use: playUltraSoundFromFile: (NSString*)fileName
  8. 
    ...
    - (void)playAudioFile {
        [collect_us playUltraSoundFromFile:@"yourFileName.m4a"];
    }
    ...
                             

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