Class DecibelMeter

All Implemented Interfaces:
LXComponent.Renamable, LXLoopTask, LXPath, LXSerializable, LXOscComponent, LXNormalizedParameter, LXParameter, LXParameterListener
Direct Known Subclasses:
GraphicMeter

public class DecibelMeter extends LXModulator implements LXNormalizedParameter, LXOscComponent
A DecibelMeter is a modulator that returns the level of an audio signal. Gain may be applied to the signal. A decibel range is given in which values are normalized from 0 to 1. Raw decibel values can be accessed if desired.
  • Field Details

    • LOG_10

      protected static final double LOG_10
    • buffer

      protected LXAudioBuffer buffer
    • gain

      public final CompoundParameter gain
      Gain of the meter, in decibels
    • range

      public final CompoundParameter range
      Range of the meter, in decibels.
    • attack

      public final CompoundParameter attack
      Meter attack time, in milliseconds
    • release

      public final CompoundParameter release
      Meter release time, in milliseconds
    • attackGain

      protected float attackGain
    • releaseGain

      protected float releaseGain
  • Constructor Details

  • Method Details

    • setBuffer

      public DecibelMeter setBuffer(LXAudioBuffer buffer)
    • getExponent

      public double getExponent()
      Description copied from interface: LXNormalizedParameter
      Gets the exponent used for scaling this parameter across its normalized range. Default is 1 which means linear scaling.
      Specified by:
      getExponent in interface LXNormalizedParameter
      Returns:
      scaling exponent
    • getRaw

      public float getRaw()
      Return raw underlying levels, no attack/gain smoothing
      Returns:
      Raw RMS value
    • getDecibels

      public double getDecibels()
      Returns:
      Raw decibel value of the meter
    • getDecibelsf

      public float getDecibelsf()
      Returns:
      Raw decibel value of the meter as a float
    • getSquare

      public double getSquare()
      Returns:
      A value for the audio meter from 0 to 1 with quadratic scaling
    • getSquaref

      public float getSquaref()
      Returns:
      Quadratic scaled value as a float
    • 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.
      Specified by:
      computeValue in class LXModulator
      Parameters:
      deltaMs - Number of milliseconds to advance by
      Returns:
      Computed value
    • setNormalized

      public LXNormalizedParameter setNormalized(double value)
      Description copied from interface: LXNormalizedParameter
      Sets the value or the parameter in normalized space from 0 to 1
      Specified by:
      setNormalized in interface LXNormalizedParameter
      Parameters:
      value - The normalized value, from 0 to 1
      Returns:
      this, for method chaining
    • getPeak

      public double getPeak()
    • getPeakf

      public float getPeakf()
    • getNormalized

      public double getNormalized()
      Description copied from interface: LXNormalizedParameter
      Gets the value of the parameter in a normalized space from 0 to 1
      Specified by:
      getNormalized in interface LXNormalizedParameter
      Returns:
      Value of parameter, normalized to range from 0 to 1
    • getNormalizedf

      public float getNormalizedf()
      Description copied from interface: LXNormalizedParameter
      Gets the value of the parameter in a normalized space as a float
      Specified by:
      getNormalizedf in interface LXNormalizedParameter
      Returns:
      Normalized value of parameter, in range from 0 to 1