Package jazzparser :: Package data :: Module midi :: Class SequenceMidiAlignment
[hide private]
[frames] | no frames]

Class SequenceMidiAlignment

source code

object --+
         |
        SequenceMidiAlignment

Specification of parameters to align a chord sequence with a MIDI file. This includes things like where repeats should occur in the chord sequence and how many beats to each MIDI beat, so that the chords end up at the right place in the music.

Aligns a ChordSequence with a midi.EventStream.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
midi.EventStream
align(self, sequence, mid, lyrics=False)
Aligns the sequence with the midi file and adds lyric events into the midi data to indicate where the chords occur.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
  midi_beats_per_beat
Number of beats in the MIDI file to align with each chord sequence beat.
  sequence_start
Number of MIDI ticks between the first note-on event in the MIDI file and where the chord sequence starts.
  repeat_spans
Definitions of repeats.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

align(self, sequence, mid, lyrics=False)

source code 

Aligns the sequence with the midi file and adds lyric events into the midi data to indicate where the chords occur. This ought to function like a karaoke midi file, showing the chords as the occur.

Note that this modifies the midi sequence in place.

Parameters:
  • lyrics (bool) - use lyrics events the mark the chords. By default uses marker events, which are more appropriate but may not be supported by your player.
  • sequence (ChordSequence) - the chord sequence to take chords from
  • sequence (ChordSequence) - input midi sequence
  • mid (midi.EventStream)
Returns: midi.EventStream
the original midi sequence with text added in for the chords.

Instance Variable Details [hide private]

midi_beats_per_beat

Number of beats in the MIDI file to align with each chord sequence beat. Use negative numbers (<-1) to specify reciprocals (i.e. -4 -> 1/4).

repeat_spans

Definitions of repeats. Given as (start,end,count). The first count times the endth chord is finished, the sequence will return to the startth chord. Repeats with the same end point will be used in the order they occur in this list.

Note: Counts for inner repeats will not be reset in the outer loop of nested spans.