Class Quantizer

java.lang.Object
org.jjazz.quantizer.api.Quantizer

public class Quantizer extends Object
Provide quantize related methods and properties.
  • Field Details

  • Method Details

    • getInstance

      public static Quantizer getInstance()
    • getQuantizeStrength

      public float getQuantizeStrength()
      Convenience method to get the current quantization strength.
      Returns:
      1f if isIterativeQuantizedEnabled() is false, otherwise return getIterativeQuantizeStrength().
    • getIterativeQuantizeStrength

      public float getIterativeQuantizeStrength()
      Returns:
      See Also:
    • setIterativeQuantizeStrength

      public void setIterativeQuantizeStrength(float strength)
      Set the iterative quantize strength.

      1 means hard quantize. 0.2f means note is moved 0.2f * half_quantize_distance.

      Parameters:
      strength - A value in the ]0;1] range.
    • isIterativeQuantizeEnabled

      public boolean isIterativeQuantizeEnabled()
      Check if iterative quantize is enabled.

      This is enabled by default.

      Returns:
    • setIterativeQuantizeEnabled

      public void setIterativeQuantizeEnabled(boolean b)
      Set the value of iterativeEnabled
      Parameters:
      b - new value of iterativeEnabled
    • getQuantized

      public Position getQuantized(Position pos, TimeSignature ts, int maxBarIndex)
      Return the closest quantized position using the Quantizer's global settings.
      Parameters:
      pos - The original position.
      ts - The TimeSignature for the original position.
      maxBarIndex - The quantized position can not exceed this maximum bar index.
      Returns:
      See Also:
    • getQuantized

      public static Position getQuantized(Quantization q, Position pos, TimeSignature ts, float qStrength, int maxBarIndex)
      Return the closest quantized position using the specified quantization settings.
      Parameters:
      q - The quantization setting
      pos - The original position.
      ts - The TimeSignature for the original position.
      qStrength - A value in the ]0;1] range. 1 means hard quantize. 0.2f means note is moved half_quantize_distance*0.2f.
      maxBarIndex - The quantized position can not exceed this maximum bar index.
      Returns:
    • getQuantized

      public static float getQuantized(Quantization q, float beatPos)
      Quantize beatPos using the specified quantization setting.
      Parameters:
      q -
      beatPos -
      Returns:
    • getQuantizedNext

      public static float getQuantizedNext(Quantization q, float beatPos)
      Get the next quantized position after beatPos.

      If beatPos is already a quantized position, return, beatPos.

      Parameters:
      q -
      beatPos -
      Returns:
    • getQuantizedPrevious

      public static float getQuantizedPrevious(Quantization q, float beatPos)
      Get the previous quantized position before beatPos.

      If beatPos is already a quantized position, return beatPos.

      Parameters:
      q -
      beatPos -
      Returns:
    • setQuantizationValue

      public void setQuantizationValue(Quantization q)
    • getQuantizationValue

      public Quantization getQuantizationValue()
    • getDefaultQuantizationValue

      public Quantization getDefaultQuantizationValue(TimeSignature ts)
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)