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 ClassesNested classes/interfaces inherited from class heronarts.lx.modulator.LXModulator
LXModulator.Device, LXModulator.Global, LXModulator.Placeholder, LXModulator.ResetButton, LXModulator.TriggerButtonNested classes/interfaces inherited from class heronarts.lx.LXComponent
LXComponent.Author, LXComponent.Description, LXComponent.Hidden, LXComponent.Name, LXComponent.PluginRequired, LXComponent.Renamable, LXComponent.TagsNested classes/interfaces inherited from interface heronarts.lx.parameter.LXNormalizedParameter
LXNormalizedParameter.OscModeNested classes/interfaces inherited from interface heronarts.lx.parameter.LXParameter
LXParameter.Collection, LXParameter.Formatter, LXParameter.Monitor, LXParameter.MultiMonitor, LXParameter.Polarity, LXParameter.UnitsNested classes/interfaces inherited from interface heronarts.lx.LXSerializable
LXSerializable.Utils -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal NormalizedParameter[]final FourierTransformfinal intNumber of bands in the equalizerfinal CompoundParameterdB/octave slope applied to the equalizerFields inherited from class heronarts.lx.audio.DecibelMeter
attack, attackGain, buffer, gain, LOG_10, range, RATIO_20_LOG10, release, releaseGainFields inherited from class heronarts.lx.modulator.LXModulator
crashed, midiFilter, midiSourceFields inherited from class heronarts.lx.LXRunnableComponent
reset, runMs, running, triggerFields inherited from class heronarts.lx.LXComponent
childArrays, 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, presetFileFields inherited from interface heronarts.lx.LXPath
DEFAULT_SEPARATOR, ROOT, ROOT_PREFIX, ROOT_SLASH -
Constructor Summary
ConstructorsConstructorDescriptionGraphicMeter(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 TypeMethodDescriptionfinal voidaddProcessor(GraphicMeter.Processor processor) voiddispose()Invoked when a component is being removed from the system and will no longer be used at all.doublegetAverage(int minBand, int avgBands) Averages the value of a set of bandsfloatgetAveragef(int minBand, int avgBands) Averages the value of a set of bandsdoublegetBand(int i) floatgetBandf(int i) doublegetDecibels(int i) floatgetDecibelsf(int i) intNumber of bands on the meterfloatgetRaw(int i) Get most recent raw unsmoothed RMS amplitude of band idoublegetSquare(int i) Gets the squared value of the i-th bandfloatgetSquaref(int i) Gets the squared value of the i-th bandprotected voidCompute new values when a frame of audio input is received.protected voidonStop()Optional subclass method when stop happens.final voidremoveProcessor(GraphicMeter.Processor processor) Methods inherited from class heronarts.lx.audio.DecibelMeter
amplitudeToDecibels, computeValue, getBufferSize, getDecibels, getDecibelsf, getExponent, getNormalized, getNormalizedf, getPeak, getPeakf, getRaw, getSampleRate, getSquare, getSquaref, setBuffer, setNormalizedMethods 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, updateValueMethods inherited from class heronarts.lx.LXRunnableComponent
isRunning, onParameterChanged, onReset, onStart, onTrigger, postRun, reset, start, stop, toggle, triggerMethods inherited from class heronarts.lx.LXComponent
addArray, addChild, addInternalParameter, addInternalParameters, addLegacyInternalParameter, addLegacyParameter, addParameter, addParameter, addParameters, assertDisposed, contains, copyParameters, getCategory, getChild, getComponentDescription, getComponentName, getComponentName, getComponentName, getDescription, getId, getLabel, getLX, getOscLabel, getParameter, getParameters, getParent, handleOscMessage, hasParameter, isSnapshotControl, isValidOscParameter, load, loadParameters, loadPreset, removeParameter, removeParameter, removeParameter, removeParameter, save, savePreset, setDescription, setParent, toOscQuery, toOscQuery, toOscQuery, toString, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface heronarts.lx.parameter.LXNormalizedParameter
getBaseNormalized, getBaseNormalizedf, getOscMode, getValueFromNormalized, isWrappableMethods inherited from interface heronarts.lx.osc.LXOscComponent
getOscAddress, handleOscMessageMethods inherited from interface heronarts.lx.parameter.LXParameter
getBaseValue, getBaseValuef, getFormatter, getLabel, getParentParameter, getPolarity, getUnits, getValue, getValuef, isMappable, reset, setComponent, setFormatter, setMappable, setValueMethods inherited from interface heronarts.lx.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, 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
-
addProcessor
-
removeProcessor
-
onAudioFrame
protected void onAudioFrame()Description copied from class:DecibelMeterCompute new values when a frame of audio input is received. This is called by the thread that has filled the audio buffer.- Overrides:
onAudioFramein classDecibelMeter
-
onStop
protected void onStop()Description copied from class:LXRunnableComponentOptional subclass method when stop happens.- Overrides:
onStopin classDecibelMeter
-
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
-
dispose
public void dispose()Description copied from class:LXComponentInvoked when a component is being removed from the system and will no longer be used at all. This unregisters the component and should free up any resources and parameter listeners. Ideally after this method is called the object should be eligible for garbage collection. Subclasses are generally expected to override this method to handle their particular cleanup work. They should also generally callsuper.dispose()at the appropriate time to perform the basic cleanup, which may need to happen either before or after cleaning up other objects.- Specified by:
disposein interfaceLXParameter- Overrides:
disposein classLXComponent
-