Analysis
Module: Audio / Audio Definitions / Audio Output / Audio Input
Functions
Name | |
---|---|
MLResult | MLAudioBeginTraitAnalysisFromMicCapture(MLAudioTraitAnalysisTarget target, MLAudioTraitAnalysisCallback callback, void context, MLHandle out_handle) Starts a trait analysis of the energy contained in the mic signals. |
MLResult | MLAudioGetTraitAnalysis(MLHandle handle, float * out_value) Queries the current value of the trait analysis. |
MLResult | MLAudioEndTraitAnalysis(MLHandle handle) Stops a trait analysis. |
MLResult | MLAudioBeginSpectralAnalysisFromMicCapture(MLAudioSpectralAnalysisTarget target, MLAudioSpectralAnalysisCallback callback, void context, MLHandle out_handle) Starts a spectral analysis of the energy contained in the mic signals. |
MLResult | MLAudioGetSpectralAnalysis(MLHandle handle, MLAudioSpectralAnalysis * out_values) Queries the current values of a spectral analysis. |
MLResult | MLAudioEndSpectralAnalysis(MLHandle handle) Stops a spectral analysis. |
Detailed Description
ANALYSIS.
Functions Documentation
MLAudioBeginTraitAnalysisFromMicCapture
MLResult MLAudioBeginTraitAnalysisFromMicCapture(
MLAudioTraitAnalysisTarget target,
MLAudioTraitAnalysisCallback callback,
void * context,
MLHandle * out_handle
)
Starts a trait analysis of the energy contained in the mic signals.
Parameters
MLAudioTraitAnalysisTarget | target | MLAudioTraitAnalysisTarget enum specifying the type of analysis requested. |
MLAudioTraitAnalysisCallback | callback | Callback function pointer. |
void * | context | Generic data pointer passed back through the callback. |
MLHandle * | out_handle | MLHandle to be used in subsequent calls. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully began analysis. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
Required Permissions:
- None
A trait analysis measures the characteristics of an audio stream, producing a single value representing the result of the analysis at a point in time. This function creates a new trait analysis, initializes its connection to the device microphones as the audio data source, and returns a handle in the 'out_handle' argument. The 'target' argument specifies the type of trait analysis, which implies the type of audio content to be analyzed. Results may be acquired either on a polling basis by calling MLAudioGetTraitAnalysis, or via a callback set by the optional 'callback' argument of this function, triggered whenever a new value is available.
API Level:
- 20
MLAudioGetTraitAnalysis
MLResult MLAudioGetTraitAnalysis(
MLHandle handle,
float * out_value
)
Queries the current value of the trait analysis.
Parameters
MLHandle | handle | MLHandle of the analysis. |
float * | out_value | Retrieved value of trait analysis. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully retrieved the value. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLAudioResult_NotImpelmented | return control frequencies because feature has not been implemented yet. |
Required Permissions:
- None
API Level:
- 20
MLAudioEndTraitAnalysis
MLResult MLAudioEndTraitAnalysis(
MLHandle handle
)
Stops a trait analysis.
Parameters
MLHandle | handle | MLHandle of the analysis. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully ended analysis. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
Required Permissions:
- None
API Level:
- 20
MLAudioBeginSpectralAnalysisFromMicCapture
MLResult MLAudioBeginSpectralAnalysisFromMicCapture(
MLAudioSpectralAnalysisTarget target,
MLAudioSpectralAnalysisCallback callback,
void * context,
MLHandle * out_handle
)
Starts a spectral analysis of the energy contained in the mic signals.
Parameters
MLAudioSpectralAnalysisTarget | target | MLAudioSpectralAnalysisTarget enum specifying type of analysis requested. |
MLAudioSpectralAnalysisCallback | callback | Callback function pointer. |
void * | context | Generic data pointer passed back through the callback. |
MLHandle * | out_handle | MLHandle to be used in subsequent calls. |
Returns
MLResult | MLResult_OK | Successfully began analysis. |
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
Required Permissions:
- None
A spectral analysis measures the characteristics of an audio stream on a per-frequency-band basis. This function creates a new spectral analysis, initializes its connection to the device microphones as the audio data source, and returns a handle in the 'out_handle' argument. The 'target' argument specifies the type of spectral analysis, which implies the type of audio content to be analyzed. Spectral analysis results are returned in the MLAudioSpectralAnalysis struct, which contains a time window of spectral analysis values. Results may be acquired either on a polling basis by calling MLAudioGetSpectralAnalysis, or via a callback set by the optional 'callback' argument of this function, triggered whenever new values are available. Cleanup of the MLAudioSpectralAnalysis struct passed in the optional callback is handled by the audio system; i.e., the caller is not responsible for deallocating memory if the callback is used.
API Level:
- 20
MLAudioGetSpectralAnalysis
MLResult MLAudioGetSpectralAnalysis(
MLHandle handle,
MLAudioSpectralAnalysis * out_values
)
Queries the current values of a spectral analysis.
Parameters
MLHandle | handle | MLHandle of the spectral analysis. |
MLAudioSpectralAnalysis * | out_values | MLAudioSpectralAnalysis struct to be filled with the results properties. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully retrieved analysis. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLAudioResult_OperationUnavailable | Failed because operation is unavailable. |
Required Permissions:
- None
To store the values being queried, this function allocates a memory block which is pointed to by the 'values' field of the MLAudioSpectralAnalysis struct passed as the 'out_values' argument. The format of the data in this memory block can vary based on the selected MLAudioSpectralAnalysisTarget associated with the specified handle. The caller is responsible for deallocating this memory after each call to MLAudioGetSpectralAnalysis.
API Level:
- 20
MLAudioEndSpectralAnalysis
MLResult MLAudioEndSpectralAnalysis(
MLHandle handle
)
Stops a spectral analysis.
Parameters
MLHandle | handle | MLHandle of the spectral analysis. |
Returns
MLResult | MLResult_OK | Successfully stopped analysis. |
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
Required Permissions:
- None
API Level:
- 20