new MicLevelsAnalysis()
Members
- 
    
_audioAnalyzerAnalyserNode
 - 
    
_audioContextAudioContext
 - 
    
    
    
 - 
    
_currentInputStreamLocalMediaStream
 - 
    
_isAnalysisActive
 - 
    
    internal flag: is/should mic-levels analysis be active?
 - 
    
_isAnalysisCanceled
 - 
    
    internal flag: is/should mic-levels analysis be active?
 - 
    
html5Navigatornavigator
 - 
    
    
    
 - 
    
isMicLevelsEnabled
 - 
    
    Switch for generally disabling "microphone-level changed" calculations (otherwise calculation becomes active/inactive depending on whether or not a listener is registered to event
MIC_CHANGED_EVT_NAME)TODO make this configurable?...
 - 
    
constantLEVEL_CHANGED_THRESHOLD
 - 
    
    MIC-LEVELS: threshold for calculating level changes
 - 
    
private,constantMIC_CHANGED_EVT_NAME
 - 
    
    MIC-LEVELS: Name for the event that is emitted, when the input-mircophone's level change.
- Default Value:
 - "miclevelchanged"
 
 - 
    
constantMIC_MAX_NORM_VAL
 - 
    
    MIC-LEVELS: the maximal value for level changes (used for normalizing change-values)
 - 
    
MIC_MAX_VAL
 - 
    
    MIC-LEVELS: the maximal value to occurs in the input data
FIXME verify / check if this is really the maximal possible value...
 - 
    
constantMIC_NORMALIZATION_FACTOR
 - 
    
    MIC-LEVELS: normalization factor for values: adjust value, so that is more similar to the results from the other input-modules
 - 
    
constantMIC_QUERY_INTERVALL
 - 
    
    MIC-LEVELS: time interval / pauses between calculating level changes
 - 
    
recording
 - 
    
    state-flag that indicates, if the process (e.g. ASR, recording) is actually active right now, i.e. if analysis calculations should be done or not.
 - 
    
private,constantSTREAM_STARTED_EVT_NAME
 - 
    
    STREAM_STARTED: Name for the event that is emitted, when the audio input stream for analysis becomes available.
- Default Value:
 - "webaudioinputstarted"
 
 
Methods
- 
    
_startAudioAnalysis()
 - 
    
    
    HELPER start-up mic-levels analysis (and fire events for registered listeners)
 - 
    
_startUserMedia(inputstream)
 - 
    
    
    HELPER callback for getUserMedia: creates the microphone-levels-changed "analyzer" and fires mic-levels-changed events for registered listeners
Name Type Description inputstreamLocalMediaStream  - 
    
_stopAudioAnalysis()
 - 
    
    
    HELPER stop mic-levels analysis
 - 
    
_updateMicLevelAnalysis()
 - 
    
    
    HELPER determine whether to start/stop audio-analysis based on listeners getting added/removed on the MediaManager
 - 
    
active(active){Boolean}
 - 
    
    
    Getter/Setter for ASR-/recording-active state. This function should be called with
truewhen ASR starts and withfalsewhen ASR stops. NOTE setting theactivestate allows the analyzer to start processing when a listener formiclevelchangedis added while ASR/recording is already active (otherwise the processing would not start immediately, but when the ASR/recording is started the next time).Name Type Description activeBoolean optional if activeis provided, then the mic-level-analysis' (recording) active-state is set to this value.Returns:
Type Description Boolean the mic-level-analysis' (recording) active-state. If argument activewas supplied, then the return value will be the same as this input value. - 
    
createAudioContext()
 - 
    
    
    
    
    
    
    
    
    
 - 
    
enabled(enable){Boolean}
 - 
    
    
    Get/set the mic-level-analysis' enabled-state: If the analysis is disabled, then
startwill not active the analysis (and currently running analysis will be stopped). This function is getter and setter: if an argumentenableis provided, then the mic-level-analysis' enabled-state will be set, before returning the current value of the enabled-state (if omitted, just the enabled-state will be returned)Name Type Description enableBoolean optional OPTIONAL if enableis provided, then the mic-level-analysis' enabled-state is set to this value.Returns:
Type Description Boolean the mic-level-analysis' enabled-state  - 
    
getDb()
 - 
    
    
    HELPER calculate the dezible value for PCM value
- Deprecated
 - currently un-used
 
 - 
    
getRms()
 - 
    
    
    HELPER calculate the RMS value for list of audio values
- Deprecated
 - currently un-used
 
 - 
    
hasChanged()
 - 
    
    
    HELPER determine if a value has change in comparison with a previous value (taking the LEVEL_CHANGED_THRESHOLD into account)
 - 
    
normalize()
 - 
    
    
    HELPER normalize the levels-changed value to MIC_MAX_NORM_VAL
- Deprecated
 - currently un-used
 
 - 
    
start(audioInputData)
 - 
    
    
    Start the audio analysis for generating "microphone levels changed" events. This functions should be called, when ASR is starting / receiving the audio audio stream. When the analysis has started, listeners of the
MediaManagerfor eventmiclevelchangedwill get notified, when the mic-levels analysis detects changes in the microphone audio input levels.Name Type Description audioInputDataAudioInputData optional If provided, the analysis will use these audio input objects instead of creating its own audio-input via getUserMedia. The AudioInputData object must have 2 properties: { inputSource: MediaStreamAudioSourceNode (HTML5 Web Audio API) audioContext: AudioContext (HTML5 Web Audio API) } If this argument is omitted, then the analysis will create its own audio input stream viagetUserMedia - 
    
stop()
 - 
    
    
    Stops the audio analysis for "microphone levels changed" events. This functions should be called, when ASR has stopped / closed the audio input stream.