Package heronarts.lx.audio
Class GraphicMeter
java.lang.Object
heronarts.lx.LXComponent
heronarts.lx.LXRunnableComponent
heronarts.lx.modulator.LXModulator
heronarts.lx.audio.DecibelMeter
heronarts.lx.audio.GraphicMeter
- All Implemented Interfaces:
LXComponent.Renamable
,LXLoopTask
,LXPath
,LXSerializable
,LXOscComponent
,LXNormalizedParameter
,LXParameter
,LXParameterListener
- Direct Known Subclasses:
LXAudioEngine.Meter
A graphic meter splits the signal into frequency bands and computes
envelopes for each of the bands independently. It can also give the overall
level, just like a normal decibel meter.
Since energy is not typically evenly distributed through the spectrum, a
slope can be applied to the equalizer to even out the levels, typically
something like 4.5 dB/octave is used, though this varies by recording.
-
Nested Class Summary
Nested classes/interfaces inherited from class heronarts.lx.modulator.LXModulator
LXModulator.Device, LXModulator.Global, LXModulator.Placeholder
Nested classes/interfaces inherited from class heronarts.lx.LXComponent
LXComponent.Hidden, LXComponent.Renamable
Nested classes/interfaces inherited from interface heronarts.lx.parameter.LXNormalizedParameter
LXNormalizedParameter.OscMode
Nested classes/interfaces inherited from interface heronarts.lx.parameter.LXParameter
LXParameter.Collection, LXParameter.Formatter, LXParameter.Monitor, LXParameter.MultiMonitor, LXParameter.Polarity, LXParameter.Units
Nested classes/interfaces inherited from interface heronarts.lx.LXSerializable
LXSerializable.Utils
-
Field Summary
Modifier and TypeFieldDescriptionfinal NormalizedParameter[]
final FourierTransform
final int
Number of bands in the equalizerfinal CompoundParameter
dB/octave slope applied to the equalizerFields inherited from class heronarts.lx.audio.DecibelMeter
attack, attackGain, buffer, gain, LOG_10, range, release, releaseGain
Fields inherited from class heronarts.lx.modulator.LXModulator
crashed, midiFilter
Fields inherited from class heronarts.lx.LXRunnableComponent
runMs, running, trigger
Fields inherited from class heronarts.lx.LXComponent
children, internalParameters, KEY_CHILDREN, KEY_CLASS, KEY_COMPONENT_ID, KEY_ID, KEY_INTERNAL, KEY_PARAMETER_PATH, KEY_PARAMETERS, KEY_PATH, KEY_RESET, label, legacyInternalParameters, legacyParameters, lx, modulationColor, modulationControlsExpanded, modulationsExpanded, parameters, presetFile
Fields inherited from interface heronarts.lx.LXPath
ROOT, ROOT_PREFIX, ROOT_SLASH
-
Constructor Summary
ConstructorDescriptionGraphicMeter
(LXAudioBuffer buffer) Default graphic equalizer with 2 bands per octaveGraphicMeter
(LXAudioBuffer buffer, int numBands) Makes a graphic equalizer with a default slope of 4.5 dB/octaveGraphicMeter
(LXAudioComponent component) GraphicMeter
(String label, LXAudioBuffer buffer) Default graphic equalizer with 2 bands per octaveGraphicMeter
(String label, LXAudioBuffer buffer, int numBands) Makes a graphic equalizer with a default slope of 4.5 dB/octave -
Method Summary
Modifier and TypeMethodDescriptionprotected double
computeValue
(double deltaMs) Implementation method to advance the modulator's internal state.double
getAverage
(int minBand, int avgBands) Averages the value of a set of bandsfloat
getAveragef
(int minBand, int avgBands) Averages the value of a set of bandsdouble
getBand
(int i) float
getBandf
(int i) double
getDecibels
(int i) float
getDecibelsf
(int i) int
Number of bands on the meterfloat
getRaw
(int i) Get most recent raw unsmoothed RMS amplitude of band ifloat[]
Returns a snapshot of the last raw audio sample buffer frame that was used to compute this meter.double
getSquare
(int i) Gets the squared value of the i-th bandfloat
getSquaref
(int i) Gets the squared value of the i-th bandMethods inherited from class heronarts.lx.audio.DecibelMeter
getDecibels, getDecibelsf, getExponent, getNormalized, getNormalizedf, getPeak, getPeakf, getRaw, getSquare, getSquaref, setBuffer, setNormalized
Methods inherited from class heronarts.lx.modulator.LXModulator
autostart, disableAutoStart, getCrash, getCrashStackTrace, getFormatter, getIndex, getOscAddress, getOscPath, getPath, getPolarity, getUnits, getValue, isMappingSource, loop, onSetValue, run, setComponent, setFormatter, setIndex, setMappingSource, setPolarity, setUnits, setValue, setValue, updateValue
Methods inherited from class heronarts.lx.LXRunnableComponent
isRunning, onParameterChanged, onReset, onStart, onStop, onTrigger, postRun, reset, start, stop, toggle, trigger
Methods inherited from class heronarts.lx.LXComponent
addArray, addChild, addInternalParameter, addLegacyInternalParameter, addLegacyParameter, addParameter, addParameter, addParameters, contains, copyParameters, dispose, getCategory, getChild, getComponentName, getComponentName, getComponentName, getDescription, getId, getLabel, getLX, getOscLabel, getParameter, getParameters, getParent, handleOscMessage, hasParameter, isValidOscParameter, load, loadParameters, loadPreset, removeParameter, removeParameter, removeParameter, removeParameter, save, savePreset, setDescription, setParent, toOscQuery, toOscQuery, toOscQuery, toString, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface heronarts.lx.parameter.LXNormalizedParameter
getBaseNormalized, getBaseNormalizedf, getOscMode, getValueFromNormalized, isWrappable
Methods inherited from interface heronarts.lx.osc.LXOscComponent
getOscAddress, handleOscMessage
Methods inherited from interface heronarts.lx.parameter.LXParameter
dispose, getBaseValue, getBaseValuef, getFormatter, getLabel, getParentParameter, getPolarity, getUnits, getValue, getValuef, isMappable, reset, setComponent, setFormatter, setMappable, setValue
Methods inherited from interface heronarts.lx.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, getDescription, getParent, getPath, isDescendant
-
Field Details
-
slope
dB/octave slope applied to the equalizer -
numBands
public final int numBandsNumber of bands in the equalizer -
fft
-
bands
-
-
Constructor Details
-
GraphicMeter
-
GraphicMeter
Default graphic equalizer with 2 bands per octave- Parameters:
buffer
- Audio buffer
-
GraphicMeter
Default graphic equalizer with 2 bands per octave- Parameters:
label
- Labelbuffer
- Audio buffer
-
GraphicMeter
Makes a graphic equalizer with a default slope of 4.5 dB/octave- Parameters:
buffer
- Audio buffer to monitornumBands
- Number of bands
-
GraphicMeter
Makes a graphic equalizer with a default slope of 4.5 dB/octave- Parameters:
label
- Labelbuffer
- Audio buffer to monitornumBands
- Number of bands
-
-
Method Details
-
computeValue
protected double computeValue(double deltaMs) Description copied from class:LXModulator
Implementation method to advance the modulator's internal state. Subclasses must provide and update value appropriately.- Overrides:
computeValue
in classDecibelMeter
- Parameters:
deltaMs
- Number of milliseconds to advance by- Returns:
- Computed value
-
getSamples
public float[] getSamples()Returns a snapshot of the last raw audio sample buffer frame that was used to compute this meter. Note that this is copy of the audio buffer local to the LX thread and this particular meter. The buffer is only updated when the meter is running, once per LX engine loop.- Returns:
- Raw audio sample buffer used to compute this meter
-
getRaw
public float getRaw(int i) Get most recent raw unsmoothed RMS amplitude of band i- Parameters:
i
- Raw band index- Returns:
- Raw value of band i
-
getDecibels
public double getDecibels(int i) - Parameters:
i
- Which frequency band to access- Returns:
- Level of that band in decibels
-
getDecibelsf
public float getDecibelsf(int i) - Parameters:
i
- Which frequency band to access- Returns:
- Level of that band in decibels as a float
-
getNumBands
public int getNumBands()Number of bands on the meter- Returns:
- Number of bands
-
getBand
public double getBand(int i) - Parameters:
i
- Which frequency band to retrieve- Returns:
- The value of the ith frequency band
-
getBandf
public float getBandf(int i) - Parameters:
i
- Which frequency band to retrieve- Returns:
- The value of that band, as a float
-
getSquare
public double getSquare(int i) Gets the squared value of the i-th band- Parameters:
i
- Frequency band- Returns:
- Squared normalized value
-
getSquaref
public float getSquaref(int i) Gets the squared value of the i-th band- Parameters:
i
- Frequency band- Returns:
- Squared normalized value as a float
-
getAverage
public double getAverage(int minBand, int avgBands) Averages the value of a set of bands- Parameters:
minBand
- The first band to start atavgBands
- How many bands to average- Returns:
- Average value of all these bands
-
getAveragef
public float getAveragef(int minBand, int avgBands) Averages the value of a set of bands- Parameters:
minBand
- The first band to start atavgBands
- How many bands to average- Returns:
- Average value of all these bands as a float
-