ddf.minim.ugens
Class Frequency

java.lang.Object
  extended by ddf.minim.ugens.Frequency

public class Frequency
extends java.lang.Object

A 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).

Author:
Anderson Mills

Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

asHz

public float asHz()
Returns the value of this Frequency in Hertz.


setAsHz

public void setAsHz(float hz)
Set this Frequency to be equal to the provided Hertz value.

Parameters:
hz -

asMidiNote

public float asMidiNote()
Returns the midi note value of this Frequency


ofHertz

public static Frequency ofHertz(float hz)
Construct a Frequency that represents the provided Hertz.

Parameters:
hz - the Hz for this Frequency (440 is A4, for instance)

ofMidiNote

public static Frequency ofMidiNote(float midiNote)
Construct a Frequency from a MIDI note value.

Parameters:
midiNote - a value in the range [0,127]

ofPitch

public static Frequency ofPitch(java.lang.String pitchName)
Construct a Frequency from a pitch name, such as A4 or Bb2.

Parameters:
pitchName - the name of the pitch to convert to a Frequency.