DixShtix

com.dixshtix.midi
Class Note

java.lang.Object
  |
  +--java.lang.Number
        |
        +--com.dixshtix.midi.MidiNumber
              |
              +--com.dixshtix.midi.Note
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Note
extends MidiNumber

Notes are in the Range 0-127.
A MIDI note number of 60 is "Middle C" on a piano. So, a MIDI note number of 69 is used for A440 tuning.
Allowable values for MIDI note numbers are 0 to 127 (ie, there are a maximum of 128 different notes that a MIDI instrument can possibly play).
Most software doesn't use MIDI note numbers to identify notes to a musician (even though that's what the MIDI gear expects, and what the software sends to it). MIDI note numbers don't mean much to a musician. Instead, the software identifies a note in "musical terminology" such as saying that the note is the F# in the third octave (of a piano keyboard). So, that note is F#3. If your MIDI unit (or software) considers octave 0 as being the lowest octave of the MIDI note range, then middle C is C5. The lowest note is then C0 (note number 0), and the highest possible note is G10 (note number 127). Some units consider the 3rd octave of the MIDI note range (ie, 2 octaves below middle C) as octave 0, and therefore, the first 2 octaves are referred to as -2 and -1. In this case, middle C is identified as C3, the lowest note is C-2, and the highest note is G8.

Version:
0.1
Author:
Richard C. Penner II
See Also:
Serialized Form

Field Summary
(package private) static java.lang.String[] ascii_names
          Twelve names for notes, with ASCII representations.
static java.lang.String[] names
          Twelve names for every note.
private static double[] note_table
          A private table which has 128 entries, one for every note.
(package private) static java.lang.String[] unicode_names
          Twelve names for notes, without ASCII representations.
 
Fields inherited from class com.dixshtix.midi.MidiNumber
number
 
Fields inherited from class java.lang.Number
serialVersionUID
 
Constructor Summary
Note(int num)
          Creator.
 
Method Summary
 double toFreq()
          Convert a note object to a frequency in Hertz.
static double toFreq(int note)
          Convert a note number to a frequency in Hertz.
 java.lang.String toString()
          Produce a short, human-readable string.
 
Methods inherited from class com.dixshtix.midi.MidiNumber
byteValue, doubleValue, equals, floatValue, hashCode, intValue, longValue, shortValue
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

note_table

private static double[] note_table
A private table which has 128 entries, one for every note.

unicode_names

static final java.lang.String[] unicode_names
Twelve names for notes, without ASCII representations.

ascii_names

static final java.lang.String[] ascii_names
Twelve names for notes, with ASCII representations.

names

public static java.lang.String[] names
Twelve names for every note. Used in output. May be ASCII or Unicode-only.
Constructor Detail

Note

public Note(int num)
Creator.
Parameters:
num - A Midi note number. 0-127, with 60 equal to middle C.
Method Detail

toString

public java.lang.String toString()
Produce a short, human-readable string.
Overrides:
toString in class MidiNumber

toFreq

public double toFreq()
Convert a note object to a frequency in Hertz.

toFreq

public static double toFreq(int note)
Convert a note number to a frequency in Hertz.

DixShtix