Class AudioUtil

java.lang.Object
com.hypixel.hytale.common.util.AudioUtil

public class AudioUtil extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final float
    Maximum accepted volume in decibels.
    static final float
    Maximum accepted pitch shift in semitones for normal authoring. +12 = +1 octave.
    static final float
    Maximum accepted pitch shift in semitones for state-binding deltas and call-site modifiers.
    static final float
    Minimum accepted volume in decibels.
    static final float
    Minimum accepted pitch shift in semitones for "normal" authoring (e.g.
    static final float
    Minimum accepted pitch shift in semitones for state-binding deltas and call-site modifiers.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    decibelsToLinearGain(float decibels)
    Converts a volume decibel value into OpenAL's linear gain value.
    static float
    linearGainToDecibels(float linearGain)
    Converts OpenAL's linear gain value into a volume decibel value.
    static float
    linearPitchToSemitones(float linearPitch)
    Converts OpenAl's linear pitch value into a pitch in semitones.
    static float
    semitonesToLinearPitch(float semitones)
    Converts a pitch in semitones into a OpenAl's linear pitch value.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MIN_DECIBEL_VOLUME

      public static final float MIN_DECIBEL_VOLUME
      Minimum accepted volume in decibels.

      -100dB and under is equivalent to no sound being played.

      See Also:
    • MAX_DECIBEL_VOLUME

      public static final float MAX_DECIBEL_VOLUME
      Maximum accepted volume in decibels.

      10dB is an arbitrary number and is equivalent to multiplying the original sound volume by 3.

      See Also:
    • MIN_SEMITONE_PITCH

      public static final float MIN_SEMITONE_PITCH
      Minimum accepted pitch shift in semitones for "normal" authoring (e.g. SoundEventLayer random pitch variation). -12 semitones = -1 octave.
      See Also:
    • MAX_SEMITONE_PITCH

      public static final float MAX_SEMITONE_PITCH
      Maximum accepted pitch shift in semitones for normal authoring. +12 = +1 octave.
      See Also:
    • MIN_STATE_PITCH_SEMITONES

      public static final float MIN_STATE_PITCH_SEMITONES
      Minimum accepted pitch shift in semitones for state-binding deltas and call-site modifiers. Extended downward from the normal range to support "time stop" / record-winding-down style effects.
      See Also:
    • MAX_STATE_PITCH_SEMITONES

      public static final float MAX_STATE_PITCH_SEMITONES
      Maximum accepted pitch shift in semitones for state-binding deltas and call-site modifiers.
      See Also:
  • Constructor Details

    • AudioUtil

      public AudioUtil()
  • Method Details

    • decibelsToLinearGain

      public static float decibelsToLinearGain(float decibels)
      Converts a volume decibel value into OpenAL's linear gain value.
      Parameters:
      decibels - the value.
      Returns:
      an OpenAl's linear gain value.
      See Also:
    • linearGainToDecibels

      public static float linearGainToDecibels(float linearGain)
      Converts OpenAL's linear gain value into a volume decibel value.
      Parameters:
      linearGain - the value.
      Returns:
      a decibel value.
      See Also:
    • semitonesToLinearPitch

      public static float semitonesToLinearPitch(float semitones)
      Converts a pitch in semitones into a OpenAl's linear pitch value.
      Parameters:
      semitones - the value.
      Returns:
      an OpenAl's linear pitch value.
      See Also:
    • linearPitchToSemitones

      public static float linearPitchToSemitones(float linearPitch)
      Converts OpenAl's linear pitch value into a pitch in semitones.
      Parameters:
      linearPitch - the value.
      Returns:
      a pitch in semitones.
      See Also: