ddf.minim.ugens
Class Midi2Hz

java.lang.Object
  extended by ddf.minim.ugens.UGen
      extended by ddf.minim.ugens.Midi2Hz

public class Midi2Hz
extends UGen

Midi2Hz is a UGen that will convert a MIDI note number to a frequency in Hertz. This is useful if you want to drive the frequency input of an Oscil with something that generates MIDI notes.

Author:
Anderson Mills

Nested Class Summary
 
Nested classes/interfaces inherited from class ddf.minim.ugens.UGen
UGen.InputType, UGen.UGenInput
 
Field Summary
 UGen.UGenInput midiNoteIn
          Patch something to this input that generates Midi note numbers (values in the range [0,127]
 
Constructor Summary
Midi2Hz()
          Construct a Midi2Hz that generates a fixed value from MIDI note 0.
Midi2Hz(float fixedMidiNoteIn)
          Construct a Midi2Hz that generates a fixed value from fixedMidiNoteIn
 
Method Summary
 void setMidiNoteIn(float fixedMidiNoteIn)
          Set the fixed value this will use if midiNoteIn is not patched.
protected  void uGenerate(float[] channels)
          Implement this method when you extend UGen.
 
Methods inherited from class ddf.minim.ugens.UGen
addInput, getLastValues, patch, patch, patch, printInputs, removeInput, sampleRate, sampleRateChanged, setSampleRate, tick, unpatch, unpatch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

midiNoteIn

public UGen.UGenInput midiNoteIn
Patch something to this input that generates Midi note numbers (values in the range [0,127]

Constructor Detail

Midi2Hz

public Midi2Hz()
Construct a Midi2Hz that generates a fixed value from MIDI note 0.


Midi2Hz

public Midi2Hz(float fixedMidiNoteIn)
Construct a Midi2Hz that generates a fixed value from fixedMidiNoteIn

Parameters:
fixedMidiNoteIn -
Method Detail

setMidiNoteIn

public void setMidiNoteIn(float fixedMidiNoteIn)
Set the fixed value this will use if midiNoteIn is not patched.

Parameters:
fixedMidiNoteIn -

uGenerate

protected void uGenerate(float[] channels)
Description copied from class: UGen
Implement this method when you extend UGen. It will be called when your UGen needs to generate one sample frame of audio. It is expected that you will assign values to the array and not simply modify the existing values. In the case where you write a UGen that takes audio input and modifies it, the pattern to follow is to have the first UGenInput you create be your audio input and then in uGenerate you will use the getLastValues method of your audio UGenInput to retrieve the audio you want to modify, which you will then modify however you need to, assigning the result to the values in channels.

Specified by:
uGenerate in class UGen
Parameters:
channels - an array representing one sample frame.