uk.org.toot.music
Class Note

java.lang.Object
  extended by uk.org.toot.music.TimedCoding
      extended by uk.org.toot.music.Note

public class Note
extends TimedCoding

This class provides static methods to assist in the representation of a note as an int. Such a note encodes time, pitch, level and duration. The time is specified as ticks relative to the start of a bar, 0..255. The duration is specified as ticks relative to the time, 0..255 such that the off time can be up to several bars later than the on time. The pitch (or drum) is specified as a MIDI compatible pitch, 0..127 The level is specified as a MIDI-compatible velocity, 0..127. The most significant bits represent time so that an array of ints representing notes can be time-ordered by simple sorting. Such sorting orders notes by time, then level, then duration, then pitch.

Author:
st Format 0ttttttt tvvvvvvv dddddddd 0ppppppp always positive can be sorted by time (t) uses 1/2 of positive int values, unused bit 7 is zero

Constructor Summary
Note()
           
 
Method Summary
static int createNote(int timeOn, int pitch, int level)
           
static int createNote(int timeOn, int pitch, int level, int duration)
           
static int getDuration(int note)
          Return the duration, in ticks, of the specified note.
static int getLevel(int note)
           
static int getPitch(int note)
           
static int setDuration(int note, int time)
           
static int setLevel(int note, int level)
           
static int setPitch(int note, int pitch)
           
 
Methods inherited from class uk.org.toot.music.TimedCoding
getTime, setTime
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Note

public Note()
Method Detail

createNote

public static int createNote(int timeOn,
                             int pitch,
                             int level)

createNote

public static int createNote(int timeOn,
                             int pitch,
                             int level,
                             int duration)

getDuration

public static int getDuration(int note)
Return the duration, in ticks, of the specified note.

Parameters:
note - the int which contains the duration of the note
Returns:
the time, in ticks, of the duration.

setDuration

public static int setDuration(int note,
                              int time)

getPitch

public static int getPitch(int note)

setPitch

public static int setPitch(int note,
                           int pitch)

getLevel

public static int getLevel(int note)

setLevel

public static int setLevel(int note,
                           int level)


Copyright © 2004, 2005, 2006, 2007 Steve Taylor. All Rights Reserved.