public class QuantisationMeter extends java.lang.Object implements NoteEventParser
QuantisationMeter is able to measure the quantisation level of a given piece.
It parses note on events, and measures each note as it occurs, thus saving the memory
space of actually having to load the notes in to memory.| Modifier and Type | Field and Description |
|---|---|
private int |
divisions
The number of divisions per quarter note to use when measuring.
|
private int |
numMeasuredNotes
The number of notes we've measured so far.
|
private double |
quantisationErrorTotal
The total quantisation error of the notes we've seen so far.
|
private TimeTracker |
timeTracker
The time tracker to use to measure quantisation.
|
| Constructor and Description |
|---|
QuantisationMeter(TimeTracker tt,
int divisions)
Create a new quantisation meter with the given TimeTracker and number of divisions
per quarter note.
|
| Modifier and Type | Method and Description |
|---|---|
double |
getQuantisationError()
Get the average quantisation error out of the notes we've seen so far.
|
void |
noteOff(int key,
long tick,
int channel)
Process a Note Off event.
|
MidiNote |
noteOn(int key,
int velocity,
long tick,
int channel)
Process a Note On event.
|
private TimeTracker timeTracker
private double quantisationErrorTotal
private int numMeasuredNotes
private int divisions
public QuantisationMeter(TimeTracker tt, int divisions)
tt - timeTrackerdivisions - divisionspublic MidiNote noteOn(int key, int velocity, long tick, int channel)
NoteEventParsernoteOn in interface NoteEventParserkey - The key pressed. This will be a number between 1 and 88 for piano.velocity - The velocity of the press. This is a value between 1 and 127 inclusive.tick - The midi tick location of this event.channel - The midi channel this note came from.public void noteOff(int key,
long tick,
int channel)
throws javax.sound.midi.InvalidMidiDataException
NoteEventParsernoteOff in interface NoteEventParserkey - The midi key which has been turned off. This value is between 39 and 127, inclusive, for piano.tick - The midi tick location of this event.channel - The midi channel this note came from.javax.sound.midi.InvalidMidiDataException - If a note off event doesn't match any previously seen note on events.public double getQuantisationError()