Class Loudness

  • All Implemented Interfaces:
    Cloneable, org.json.simple.JSONAware

    public class Loudness
    extends Object
    implements Cloneable, org.json.simple.JSONAware
    Simple, decibel-based loudness curve.
    Author:
    Hendrik Schreiber
    • Field Detail

      • ABSOLUTE_SILENCE

        public static final int ABSOLUTE_SILENCE
    • Constructor Detail

      • Loudness

        public Loudness​(float sampleRate,
                        int[] ints)
      • Loudness

        public Loudness​(float sampleRate,
                        float[] floats)
      • Loudness

        public Loudness​(org.json.simple.JSONObject jsonObject)
    • Method Detail

      • append

        public Loudness append​(Loudness loudness)
        Concatenate this object with the given object.
        Parameters:
        loudness - other loudness object
        Returns:
        new object (concatenation of both objects)
      • getSampleRate

        public float getSampleRate()
      • getAverage

        public float getAverage​(long start,
                                long duration)
        Average loudness for a time range. If the time range contains silence, the resulting value may be meaningless, because of the logarithmic nature of the decibel scale.
        Parameters:
        start - start time in milliseconds
        duration - end time in milliseconds
        Returns:
        average loudness
      • getValue

        public float getValue​(long time)
        Get the loudness value in db at the given time in milliseconds.
        Parameters:
        time - time in milliseconds
        Returns:
        loudness in db or, if the time is invalid, ABSOLUTE_SILENCE
      • getValue

        public float getValue​(int sample)
      • getValues

        public float[] getValues()
      • getValueAtPercentile

        public float getValueAtPercentile​(float percentile)
        Maximal loudness for the most quiet X% of the track. Used with 0.95f as parameter, this results in a perceived loudness as suggested by ReplayGain 1.
        Parameters:
        percentile - percentile
        Returns:
        loudness value
      • getGatedLoudness

        public float getGatedLoudness()

        Loudness corresponding to EBU R 128 with both the absolute -70 LUFS silence gate and the -10 LU relative gate applied.

        Requires suitable loudness values.

        Returns:
        loudness
      • getLoudnessRange

        public float getLoudnessRange()
        /**

        Loudness range corresponding to EBU R 128 with both the absolute -70 LUFS silence gate and the -20 LU relative gate applied.

        Requires suitable loudness values.

        Returns:
        loudness range
      • toJSONString

        public String toJSONString()
        Specified by:
        toJSONString in interface org.json.simple.JSONAware
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object