Class GraphicMeter

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

public class GraphicMeter extends DecibelMeter
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.
  • Field Details

  • Constructor Details

    • GraphicMeter

      public GraphicMeter(LXAudioComponent component)
    • GraphicMeter

      public GraphicMeter(LXAudioBuffer buffer)
      Default graphic equalizer with 2 bands per octave
      Parameters:
      buffer - Audio buffer
    • GraphicMeter

      public GraphicMeter(String label, LXAudioBuffer buffer)
      Default graphic equalizer with 2 bands per octave
      Parameters:
      label - Label
      buffer - Audio buffer
    • GraphicMeter

      public GraphicMeter(LXAudioBuffer buffer, int numBands)
      Makes a graphic equalizer with a default slope of 4.5 dB/octave
      Parameters:
      buffer - Audio buffer to monitor
      numBands - Number of bands
    • GraphicMeter

      public GraphicMeter(String label, LXAudioBuffer buffer, int numBands)
      Makes a graphic equalizer with a default slope of 4.5 dB/octave
      Parameters:
      label - Label
      buffer - Audio buffer to monitor
      numBands - 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 class DecibelMeter
      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 at
      avgBands - 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 at
      avgBands - How many bands to average
      Returns:
      Average value of all these bands as a float