Package com.adonax.audiocue
Enum AudioCueFunctions.VolType
- All Implemented Interfaces:
Serializable
,Comparable<AudioCueFunctions.VolType>
,java.lang.constant.Constable
- Enclosing class:
AudioCueFunctions
The
enum VolumeType
is a repository of functions
used to convert an input in the linear range 0..1 to an
attenuation factor, where the input 0 indicating silence
and 1 indicating full volume, and the returned factor
intended to be multiplied to the PCM values on a per-element
basis.
The perception of amplitudes is not linear, but exponential, and commonly measured using the deciBel unit. The formula x^4 is widely used as a "good enough" approximation of the of the more costly dB calculation: exp(x * 6.908)/1000 that spans a range of 60 dB.
A straight use of linear values will tend to result in hard-to-perceive changes in the upper range and more extreme sensitivity with the lower values. But with a 60dB dynamic range, the x^4 approximation may have the opposite problem, with values below 0.5 quickly becoming inaudible. For this reason, a selection of intermediate exponential curves are offered.
- Since:
- 2.1.0
- Version:
- 2.1.0
- Author:
- Philip Freihofner
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionRepresents an amplitude function that best maps to the geometric curve of human hearing, but at a higher computational cost than EXP_X4.Represents an amplitude function that tends to result in most of the perceived amplification taking place in the lower numerical range, but less so than the LINEAR function.Represents an 'intermediate' amplitude function that is somewhat louder in the lower numeric range than EXP_X4, but quieter in the lower numeric range than EXP_X2.Represents an amplitude function that is commonly used to map the linear values ranging from 0 (silent) to 1 (full volume) to volume factors that approximate the geometric curve of human hearing.Represents an amplitude function with enhanced sensitivity to volume changes occurring in the upper numerical area between 0 (silent) and 1 (full volume) The mapping function is calculated as follows: f(x) = x * x * x * x * xRepresents an amplitude function that directly uses linear linear values ranging from 0 (silent) to 1 (maximum amplitude). -
Method Summary
Modifier and TypeMethodDescriptionstatic AudioCueFunctions.VolType
Returns the enum constant of this type with the specified name.static AudioCueFunctions.VolType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
LINEAR
Represents an amplitude function that directly uses linear linear values ranging from 0 (silent) to 1 (maximum amplitude). This volume control tends to result in most of the amplification occurring in the lower end of the numerical range.- See Also:
-
EXP_X2
Represents an amplitude function that tends to result in most of the perceived amplification taking place in the lower numerical range, but less so than the LINEAR function. Input values, ranging from 0 (silent) to 1 (full volume) are mapped to volume factors with the function f(x) = x * x.- See Also:
-
EXP_X3
Represents an 'intermediate' amplitude function that is somewhat louder in the lower numeric range than EXP_X4, but quieter in the lower numeric range than EXP_X2. Input values, ranging from 0 (silent) to 1 (full volume) are mapped to volume factors with the function f(x) = x * x * x.- See Also:
-
EXP_X4
Represents an amplitude function that is commonly used to map the linear values ranging from 0 (silent) to 1 (full volume) to volume factors that approximate the geometric curve of human hearing. With a dynamic range of 60 dB, values below 0.5 can quickly become inaudible. For this reason, functions with louder lower ends (EXP_X3, EXP_X2) are also offered. The mapping function is calculated as follows: f(x) = x * x * x * x- See Also:
-
EXP_X5
Represents an amplitude function with enhanced sensitivity to volume changes occurring in the upper numerical area between 0 (silent) and 1 (full volume) The mapping function is calculated as follows: f(x) = x * x * x * x * x- See Also:
-
EXP_60dB
Represents an amplitude function that best maps to the geometric curve of human hearing, but at a higher computational cost than EXP_X4. The mapping function is calculated as follows:
f(x) = Math.exp(x * 6.908) / 1000.0
The input value of 0 is directly mapped to zero instead of using the above function.- See Also:
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-