public class Frequency
extends java.lang.Object
Frequency
is used to contain a frequency.
This is generally used by an Oscil
UGen, but
can also be used to convert different notations of frequencies
such as Hz, MIDI note number, and a pitch name (English or solfege).Modifier and Type | Method and Description |
---|---|
float |
asHz()
Returns the value of this Frequency in Hertz.
|
float |
asMidiNote()
Returns the midi note value of this Frequency
|
static Frequency |
ofHertz(float hz)
Construct a Frequency that represents the provided Hertz.
|
static Frequency |
ofMidiNote(float midiNote)
Construct a Frequency from a MIDI note value.
|
static Frequency |
ofPitch(java.lang.String pitchName)
Construct a Frequency from a pitch name, such as A4 or Bb2.
|
void |
setAsHz(float hz)
Set this Frequency to be equal to the provided Hertz value.
|
public float asHz()
public void setAsHz(float hz)
hz
- public float asMidiNote()
public static Frequency ofHertz(float hz)
hz
- the Hz for this Frequency (440 is A4, for instance)public static Frequency ofMidiNote(float midiNote)
midiNote
- a value in the range [0,127]public static Frequency ofPitch(java.lang.String pitchName)
pitchName
- the name of the pitch to convert to a Frequency.