|
Drag[en]gine Script Module DragonScript 1.32.1
|
Audio analyzer resource. More...
Public Member Functions | |
Constructors | |
| AudioAnalyzer | new () |
| Create audio analyzer. | |
Management | |
| bool | getUseAudioCapture () |
| Use audio capture as input for analysis. | |
| void | setUseAudioCapture (bool useAudioCapture) |
| Set use of audio capture as input for analysis. | |
| int | getSampleRate () |
| Analysis sample rate in Hz. | |
| void | setSampleRate (int sampleRate) |
| Set analysis sample rate in Hz. | |
| int | getResolution () |
| FFT resolution (window size in samples). | |
| void | setResolution (int resolution) |
| Set FFT resolution. | |
| int | getFrequencyBandCount () |
| Count of frequency bands tracked. | |
| void | setFrequencyBandCount (int count) |
| Set count of frequency bands tracked. | |
| float | getLowestFrequency () |
| Lowest frequency for frequency bands in Hz. | |
| float | getHighestFrequency () |
| Highest frequency for frequency bands in Hz. | |
| void | setFrequencyRange (float lowestFrequency, float highestFrequency) |
| Set frequency range for frequency bands in Hz. | |
| bool | getEnablePreEmphasis () |
| Apply pre-emphasis filter before FFT. | |
| void | setEnablePreEmphasis (bool enable) |
| Set apply pre-emphasis filter before FFT. | |
| float | getPreEmphasisFactor () |
| Pre-emphasis filter coefficient. | |
| void | setPreEmphasisFactor (float factor) |
| Set pre-emphasis filter coefficient. | |
| bool | getEnableMelFiltering () |
| Apply mel filter banks after FFT. | |
| void | setEnableMelFiltering (bool enable) |
| Set apply mel filter banks after FFT. | |
| int | getMelFilterCount () |
| Count of mel filter banks. | |
| void | setMelFilterCount (int count) |
| Set count of mel filter bank filters. | |
| bool | getNormalizeMelEnergies () |
| Normalize mel filter bank energies. | |
| void | setNormalizeMelEnergies (bool normalize) |
| Set normalize mel filter bank energies. | |
| void | updateResults () |
| Update results. | |
Time-Domain Results | |
| float | getRMS () |
| Root mean square amplitude in range 0 to 1. | |
| float | getPeak () |
| Absolute peak amplitude in range 0 to 1. | |
| float | getZeroCrossingRate () |
| Zero-crossing rate in range 0 to 1. | |
Frequency-Domain Results | |
| float | getSpectralCentroid () |
| Spectral centroid (center of mass of spectrum) in Hz. | |
| float | getSpectralFlatness () |
| Spectral flatness in range 0 (tonal) to 1 (noise-like). | |
| float | getSpectralFlux () |
| Spectral flux measuring rate of spectrum change. | |
| float | getSpectralRolloff () |
| Spectral roll-off frequency in Hz. | |
| int | getSpectralPeakCount () |
| Count of spectral peak frequencies. | |
| float | getSpectralPeakFrequencyAt (int index) |
| Spectral peak frequency in Hz at index. | |
| float | getSpectralPeakMagnitudeAt (int index) |
| Spectral peak magnitude at index. | |
| float | getFrequencyBandMagnitudeAt (int index) |
| Magnitude of frequency band at index. | |
| float | getFrequencyBandEnergyAt (int index) |
| Energy of frequency band at index. | |
| float | getFrequencyBandLowestFrequencyAt (int index) |
| Lowest frequency of frequency band at index in Hz. | |
| float | getFrequencyBandHighestFrequencyAt (int index) |
| Highest frequency of frequency band at index in Hz. | |
| float | getFrequencyBandMfccAt (int index) |
| Mel Frequency Cepstral Coefficient of the frequency band at index. | |
| float | getMaxBandMagnitude () |
| Maximum magnitude of all frequency bands. | |
| float | getMaxBandEnergy () |
| Maximum energy of all frequency bands. | |
| float | getTotalBandMagnitude () |
| Total magnitude of all frequency bands. | |
| float | getTotalBandEnergy () |
| Total energy of all frequency bands. | |
| float | getPitch () |
| Estimated pitch (fundamental frequency) in Hz or 0 if not detected. | |
Operators | |
| bool | equals (Object obj) |
| Audio analyzers are equal. | |
| int | hashCode () |
| Hash code. | |
Audio analyzer resource.
Analyzes audio data providing time-domain and frequency-domain results. To use create an AudioAnalyzer instance and configure the analysis parameters. Audio analysis is performed by the synthesizer module asynchronously. Call updateResults() periodically (for example each frame update or using a timer) to retrieve the accumulated analysis results.
Time-domain results include the root mean square amplitude (RMS), absolute peak amplitude and the zero-crossing rate. Frequency-domain results include the spectral centroid, spectral flatness, spectral flux, spectral roll-off frequency, individual spectral peaks and frequency band energy levels as well as the estimated fundamental pitch.
This is a native class.
| bool Dragengine.Scenery.AudioAnalyzer.equals | ( | Object | obj | ) |
Audio analyzers are equal.
| bool Dragengine.Scenery.AudioAnalyzer.getEnableMelFiltering | ( | ) |
Apply mel filter banks after FFT.
If enabled changes frequency bands from logarithmically spaced to mel-scale spaced triangular filters. This produces a perceptually-motivated band distribution closer to how humans perceive pitch and timbre.
Default is false.
| bool Dragengine.Scenery.AudioAnalyzer.getEnablePreEmphasis | ( | ) |
Apply pre-emphasis filter before FFT.
If enabled pre-emphasis filter is applied to the input samples before the FFT calculation. This boosts high frequencies to improve analysis quality.
Default is true.
| int Dragengine.Scenery.AudioAnalyzer.getFrequencyBandCount | ( | ) |
Count of frequency bands tracked.
| float Dragengine.Scenery.AudioAnalyzer.getFrequencyBandEnergyAt | ( | int | index | ) |
Energy of frequency band at index.
Bands are logarithmically spaced within the frequency range set by #setFrequencyRange(float,float).
| EInvalidParam | index is less than 0 |
| EInvalidParam | index is greater than or equal to getFrequencyBandsCount(). |
| float Dragengine.Scenery.AudioAnalyzer.getFrequencyBandHighestFrequencyAt | ( | int | index | ) |
Highest frequency of frequency band at index in Hz.
Bands are logarithmically spaced within the frequency range set by #setFrequencyRange(float,float).
| EInvalidParam | index is less than 0 |
| EInvalidParam | index is greater than or equal to getFrequencyBandsCount(). |
| float Dragengine.Scenery.AudioAnalyzer.getFrequencyBandLowestFrequencyAt | ( | int | index | ) |
Lowest frequency of frequency band at index in Hz.
Bands are logarithmically spaced within the frequency range set by #setFrequencyRange(float,float).
| EInvalidParam | index is less than 0 |
| EInvalidParam | index is greater than or equal to getFrequencyBandsCount(). |
| float Dragengine.Scenery.AudioAnalyzer.getFrequencyBandMagnitudeAt | ( | int | index | ) |
Magnitude of frequency band at index.
Bands are logarithmically spaced within the frequency range set by #setFrequencyRange(float,float).
| EInvalidParam | index is less than 0 |
| EInvalidParam | index is greater than or equal to getFrequencyBandsCount(). |
| float Dragengine.Scenery.AudioAnalyzer.getFrequencyBandMfccAt | ( | int | index | ) |
Mel Frequency Cepstral Coefficient of the frequency band at index.
Returns the DCT coefficient of the log mel energies corresponding to this band. Only valid if mel filtering is enabled otherwise 0.
| EInvalidParam | index is less than 0 |
| EInvalidParam | index is greater than or equal to getFrequencyBandsCount(). |
| float Dragengine.Scenery.AudioAnalyzer.getHighestFrequency | ( | ) |
Highest frequency for frequency bands in Hz.
Default is 20000 Hz.
| float Dragengine.Scenery.AudioAnalyzer.getLowestFrequency | ( | ) |
Lowest frequency for frequency bands in Hz.
Default is 20 Hz.
| float Dragengine.Scenery.AudioAnalyzer.getMaxBandEnergy | ( | ) |
Maximum energy of all frequency bands.
| float Dragengine.Scenery.AudioAnalyzer.getMaxBandMagnitude | ( | ) |
Maximum magnitude of all frequency bands.
| int Dragengine.Scenery.AudioAnalyzer.getMelFilterCount | ( | ) |
Count of mel filter banks.
Default is 26.
| bool Dragengine.Scenery.AudioAnalyzer.getNormalizeMelEnergies | ( | ) |
Normalize mel filter bank energies.
Default is true.
| float Dragengine.Scenery.AudioAnalyzer.getPeak | ( | ) |
Absolute peak amplitude in range 0 to 1.
| float Dragengine.Scenery.AudioAnalyzer.getPitch | ( | ) |
Estimated pitch (fundamental frequency) in Hz or 0 if not detected.
| float Dragengine.Scenery.AudioAnalyzer.getPreEmphasisFactor | ( | ) |
Pre-emphasis filter coefficient.
Default is 0.97.
| int Dragengine.Scenery.AudioAnalyzer.getResolution | ( | ) |
FFT resolution (window size in samples).
Higher values give better frequency resolution at the cost of more processing time and higher latency.
Default is 1024.
| float Dragengine.Scenery.AudioAnalyzer.getRMS | ( | ) |
Root mean square amplitude in range 0 to 1.
| int Dragengine.Scenery.AudioAnalyzer.getSampleRate | ( | ) |
Analysis sample rate in Hz.
Downsamples input from input sample rate to analysis sample rate. Default is 16000.
| float Dragengine.Scenery.AudioAnalyzer.getSpectralCentroid | ( | ) |
Spectral centroid (center of mass of spectrum) in Hz.
| float Dragengine.Scenery.AudioAnalyzer.getSpectralFlatness | ( | ) |
Spectral flatness in range 0 (tonal) to 1 (noise-like).
| float Dragengine.Scenery.AudioAnalyzer.getSpectralFlux | ( | ) |
Spectral flux measuring rate of spectrum change.
| int Dragengine.Scenery.AudioAnalyzer.getSpectralPeakCount | ( | ) |
Count of spectral peak frequencies.
| float Dragengine.Scenery.AudioAnalyzer.getSpectralPeakFrequencyAt | ( | int | index | ) |
Spectral peak frequency in Hz at index.
| EInvalidParam | index is less than 0 |
| EInvalidParam | index is greater than or equal to getSpectralPeaksCount(). |
Spectral peaks are sorted from strongest to weakest.
| float Dragengine.Scenery.AudioAnalyzer.getSpectralPeakMagnitudeAt | ( | int | index | ) |
Spectral peak magnitude at index.
| EInvalidParam | index is less than 0 |
| EInvalidParam | index is greater than or equal to getSpectralPeaksCount(). |
Spectral peaks are sorted from strongest to weakest.
| float Dragengine.Scenery.AudioAnalyzer.getSpectralRolloff | ( | ) |
Spectral roll-off frequency in Hz.
| float Dragengine.Scenery.AudioAnalyzer.getTotalBandEnergy | ( | ) |
Total energy of all frequency bands.
| float Dragengine.Scenery.AudioAnalyzer.getTotalBandMagnitude | ( | ) |
Total magnitude of all frequency bands.
| bool Dragengine.Scenery.AudioAnalyzer.getUseAudioCapture | ( | ) |
Use audio capture as input for analysis.
Default is true. Has no effect unless AudioSystem::startAudioCapture() is called.
| float Dragengine.Scenery.AudioAnalyzer.getZeroCrossingRate | ( | ) |
Zero-crossing rate in range 0 to 1.
| int Dragengine.Scenery.AudioAnalyzer.hashCode | ( | ) |
Hash code.
| AudioAnalyzer Dragengine.Scenery.AudioAnalyzer.new | ( | ) |
Create audio analyzer.
| void Dragengine.Scenery.AudioAnalyzer.setEnableMelFiltering | ( | bool | enable | ) |
Set apply mel filter banks after FFT.
If enabled changes frequency bands from logarithmically spaced to mel-scale spaced triangular filters. This produces a perceptually-motivated band distribution closer to how humans perceive pitch and timbre.
| void Dragengine.Scenery.AudioAnalyzer.setEnablePreEmphasis | ( | bool | enable | ) |
Set apply pre-emphasis filter before FFT.
If enabled pre-emphasis filter is applied to the input samples before the FFT calculation. This boosts high frequencies to improve analysis quality.
| void Dragengine.Scenery.AudioAnalyzer.setFrequencyBandCount | ( | int | count | ) |
Set count of frequency bands tracked.
| EInvalidParam | count is less than 1. |
| void Dragengine.Scenery.AudioAnalyzer.setFrequencyRange | ( | float | lowestFrequency, |
| float | highestFrequency | ||
| ) |
Set frequency range for frequency bands in Hz.
| void Dragengine.Scenery.AudioAnalyzer.setMelFilterCount | ( | int | count | ) |
Set count of mel filter bank filters.
| EInvalidParam | count is less than 1. |
| void Dragengine.Scenery.AudioAnalyzer.setNormalizeMelEnergies | ( | bool | normalize | ) |
Set normalize mel filter bank energies.
| void Dragengine.Scenery.AudioAnalyzer.setPreEmphasisFactor | ( | float | factor | ) |
Set pre-emphasis filter coefficient.
Factor is clamped to the range from 0 to 1.
| void Dragengine.Scenery.AudioAnalyzer.setResolution | ( | int | resolution | ) |
Set FFT resolution.
| EInvalidParam | resolution is less than 64. |
| void Dragengine.Scenery.AudioAnalyzer.setSampleRate | ( | int | sampleRate | ) |
Set analysis sample rate in Hz.
| EInvalidParam | sampleRate is less than 1. |
Downsamples input from input sample rate to analysis sample rate.
| void Dragengine.Scenery.AudioAnalyzer.setUseAudioCapture | ( | bool | useAudioCapture | ) |
Set use of audio capture as input for analysis.
| void Dragengine.Scenery.AudioAnalyzer.updateResults | ( | ) |
Update results.
Fetch asynchronously accumulated analysis results from synthesizer module. The results stay valid until the next call to updateResults(). The time interval betwen calling updateResults() affects the granularity of the results.