name
Track
import promidi.*;

Sequencer sequencer;

void setup(){
  sequencer = new Sequencer();

  MidiIO midiIO = MidiIO.getInstance();
  midiIO.printDevices();
  midiIO.closeOutput(1);
  MidiOut test = midiIO.getMidiOut(1,1);

  Track track = new Track("one", test);
  track.setQuantization(Q._1_4);
  track.addEvent(new Note(36, 127,40), 0);
  track.addEvent(new Note(49, 80,40), 1); 
  track.addEvent(new Note(41, 90,40), 2);
  track.addEvent(new Note(46, 127,40), 3);

  Song song = new Song("test", 120);
  song.addTrack(track);
  sequencer.setSong(song);
  sequencer.setLoopStartPoint(0);
  sequencer.setLoopEndPoint(512);
  sequencer.setLoopCount(-1);
}

void mousePressed(){
  if(mouseButton == LEFT) sequencer.start();
  else sequencer.stop();
}

void draw(){
}
description
A track handles all midiEvents of a song for a certain midiout. You can directly add Events like Notes or ControllerChanges to it or also work with patterns.
constructors
Track(i_name, i_midiOut);
Pattern(i_name, i_length);
parameters
i_name
String: name for the track
i_midiOut
MidiOut: midi out the events are send to
i_name
String: the name of the pattern
i_length
long: the length of the pattern in ticks
methods
Adds a new event to the track. However, if the event is already contained in the track, it is not added again. The list of events is kept in time order, meaning that this event inserted at the appropriate place in the list, not necessarily at the end.
Use this method to add a pattern to the track.
Returns the MidiOutput of the track.
Returns the name of the pattern.
Returns the current quantization of the pattern.
Removes the specified event from the track.
Use this method to add a pattern to the track.
Sets the MidiOut of the Track
Sets the name of the track.
Sets the quantization for a pattern.
Obtains the number of events in this pattern.
Obtains the length of the pattern, expressed in MIDI ticks. (The duration of a tick in seconds is determined by the timing resolution of the Sequence containing this track, and also by the tempo of the music as set by the sequencer.)
usage
Web & Application
related