Class Loudness
- java.lang.Object
-
- com.tagtraum.audiokern.replaygain.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 Summary
Fields Modifier and Type Field Description static int
ABSOLUTE_SILENCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Loudness
append(Loudness loudness)
Concatenate this object with the given object.Object
clone()
boolean
equals(Object o)
float
getAverage(long start, long duration)
Average loudness for a time range.float
getGatedLoudness()
Loudness corresponding to EBU R 128 with both the absolute -70 LUFS silence gate and the -10 LU relative gate applied.float
getLoudnessRange()
/**float
getSampleRate()
float
getValue(int sample)
float
getValue(long time)
Get the loudness value in db at the given time in milliseconds.float
getValueAtPercentile(float percentile)
Maximal loudness for the most quiet X% of the track.float[]
getValues()
int
hashCode()
String
toJSONString()
String
toString()
-
-
-
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 millisecondsduration
- 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 with0.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 interfaceorg.json.simple.JSONAware
-
clone
public Object clone() throws CloneNotSupportedException
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
-