public final class PitchConverter
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static double |
absoluteCentToHertz(double absoluteCent)
Returns the frequency (Hz) of an absolute cent value.
|
static double |
centToRatio(double cent)
Converts cent values to ratios.
|
static double |
hertzToAbsoluteCent(double hertzValue)
The reference frequency is configured.
|
static double |
hertzToMidiCent(double hertzValue)
Converts a frequency in Hz to a MIDI CENT value using
(12 * log2 (f / 440)) + 69 E.g. 69.168 MIDI CENTS = MIDI NOTE 69 + 16,8 cents69.168 MIDI CENTS = 440Hz + x Hz |
static int |
hertzToMidiKey(java.lang.Double hertzValue)
A MIDI key is an integer between 0 and 127, inclusive.
|
static double |
hertzToRelativeCent(double hertzValue)
Converts a Hertz value to relative cents.
|
static double |
midiCentToHertz(double midiCent)
Converts a MIDI CENT frequency to a frequency in Hz.
|
static double |
midiKeyToHertz(int midiKey)
Calculates the frequency (Hz) for a MIDI key.
|
static double |
ratioToCent(double ratio)
Converts a ratio to cents.
|
public static int hertzToMidiKey(java.lang.Double hertzValue)
hertzValue - The pitch in Hertz.java.lang.IllegalArgumentException - if the hertzValue does not fall within the range of valid
MIDI key frequencies.public static double midiKeyToHertz(int midiKey)
midiKey - The MIDI key. A MIDI key is an integer between 0 and 127,
inclusive.java.lang.IllegalArgumentException - If midiKey is not in the valid range between 0 and 127,
inclusive.public static double hertzToRelativeCent(double hertzValue)
hertzValue - A value in hertz.public static double hertzToAbsoluteCent(double hertzValue)
hertzValue - The pitch in Hertz.public static double absoluteCentToHertz(double absoluteCent)
absoluteCent - The pitch in absolute cent.public static double hertzToMidiCent(double hertzValue)
(12 * log2 (f / 440)) + 69 69.168 MIDI CENTS = MIDI NOTE 69 + 16,8 cents69.168 MIDI CENTS = 440Hz + x HzhertzValue - The pitch in Hertz.public static double midiCentToHertz(double midiCent)
midiCent - The pitch in MIDI CENT.public static double centToRatio(double cent)
cent - A cent valuepublic static double ratioToCent(double ratio)
ratio - A cent value