UNPKG

@mindconnect/mindconnect-nodejs

Version:

MindConnect Library for NodeJS (community based)

60 lines (59 loc) 2.95 kB
/// <reference types="node" /> import { SdkClient } from "../common/sdk-client"; import { SpectrumAnalysisModels } from "./spectrum-analysis-models"; /** * Signal Spectrum Analysis API * * * Fourier Transformation * * Provides Fourier Transform functionality for sound analysis. * * @export * @class SpectrumAnalysisClient * @extends {SdkClient} */ export declare class SpectrumAnalysisClient extends SdkClient { private _baseUrl; /** * Decomposes the sound file into frequency components and returns the amplitude of each component. * By default a FLATTOP window is applied before the Fourier transformation to help improve processing results. * * @param {Buffer} file * The sound file that is transformed. * If the sound is stereo then an average operation is made to obtain one channel. * Supports up to 1MB input files and the file must be either 8 bits or 16 bits wav format. * @param {SpectrumAnalysisModels.WindowType.WindowTypeEnum} [windowType] * * The input properties for the Short Time Fourier transformation processing. windowType - * the type of window used for preprocessing input signal. * The allowed values for window type are: FLATTOP, HAMMING, HANNING and BLACKMAN. * The input format for the paramater is a JSON string like the example below * * @param {{ filename?: string; mimetype?: string }} [params] * @returns {Promise<SpectrumAnalysisModels.FFTOutput>} * * @memberOf SpectrumAnalysisClient */ CalculateFrequencies(file: Buffer, windowType?: SpectrumAnalysisModels.WindowType.WindowTypeEnum, params?: { filename?: string; mimetype?: string; }): Promise<SpectrumAnalysisModels.FFTOutput>; /** * * Threshold Alert * * Performs amplitude breaching detection. * * Detects out of bounds frequency amplitudes inside a frequency range. * * Detects Fourier Transformation components which breach given thresholds. (Either lower, upper thresholds or both) * * @param {SpectrumAnalysisModels.ThresholdViolationInput} data * * Data structure with two parts - data and spectrumFilter. * * data - array of amplitudes of frequency components as returned by the Fourier Transformation. * * Conforms to data array from output of /calculateFrequencies. * * spectrumFilter - represents a frequency interval and thresholds that, when breached, will be signalled in the response. * * You can specify either lower or upper thresholds, or both but at least one of the thresholds must be specified. * @returns {Promise<SpectrumAnalysisModels.ThresholdViolationOutput>} * * @memberOf SpectrumAnalysisClient */ DetectThresholdViolations(data: SpectrumAnalysisModels.ThresholdViolationInput): Promise<SpectrumAnalysisModels.ThresholdViolationOutput>; }