Save This Page
Home » openjdk-7 » » sound » [javadoc | source]
public class: MidiUtils [javadoc | source]
Some utilities for MIDI (some stuff is used from javax.sound.midi)
Nested Class Summary:
public static class  MidiUtils.TempoCache   
Field Summary
public static final  int DEFAULT_TEMPO_MPQ     
public static final  int META_END_OF_TRACK_TYPE     
public static final  int META_TEMPO_TYPE     
Method from Summary:
convertTempo,   getTempoMPQ,   isMetaEndOfTrack,   isMetaTempo,   microsec2ticks,   microsecond2tick,   tick2index,   tick2microsecond,   ticks2microsec
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from Detail:
 public static double convertTempo(double tempo) 
    1 - MPQ-Tempo to BPM tempo
    2 - BPM tempo to MPQ tempo
 public static int getTempoMPQ(MidiMessage midiMsg) 
    parses this message for a META tempo message and returns the tempo in MPQ, or -1 if this isn't a tempo message
 public static boolean isMetaEndOfTrack(MidiMessage midiMsg) 
    return true if the passed message is Meta End Of Track
 public static boolean isMetaTempo(MidiMessage midiMsg) 
    return if the given message is a meta tempo message
 public static long microsec2ticks(long us,
    double tempoMPQ,
    int resolution) 
    convert tempo to microsecond with given tempo Does not take tempo changes into account. Does not work for SMPTE timing!
 public static long microsecond2tick(Sequence seq,
    long micros,
    TempoCache cache) 
    Given a microsecond time, convert to tick. returns tempo at the given time in cache.getCurrTempoMPQ
 public static int tick2index(Track track,
    long tick) 
    Binary search for the event indexes of the track
 public static long tick2microsecond(Sequence seq,
    long tick,
    TempoCache cache) 
    Given a tick, convert to microsecond
 public static long ticks2microsec(long tick,
    double tempoMPQ,
    int resolution) 
    convert tick to microsecond with given tempo. Does not take tempo changes into account. Does not work for SMPTE timing!