示例#1
0
 def write_chord(self, chord):
     if not self.midistream:
         self.midistream = midi.new_stream(90, chord.note(0).divisions)
         e = midi.ProgramChangeEvent()
         e.value = chord.notes[0].midi.program
         self.midistream.add_event(e)
     map(self.write, chord.notes)
示例#2
0
 def write_chord(self, chord):
     if not self.midistream:
         self.midistream = midi.new_stream(90, chord.note(0).divisions)
         e = midi.ProgramChangeEvent()
         e.value = chord.notes[0].midi.program
         self.midistream.add_event(e)
     map(self.write, chord.notes)
示例#3
0
 def write_measure(self, measure):
     if not self.midistream:
         self.midistream = midi.new_stream(90, measure.part.score.divisions)
         e = midi.ProgramChangeEvent()
         e.value = 1  #measure.midi.program
         self.midistream.add_event(e)
     self.write(measure.musicdata)
     self.tick += measure.ticks()
示例#4
0
 def write_measure(self, measure):
     if not self.midistream:
         self.midistream = midi.new_stream(90, measure.part.score.divisions)
         e = midi.ProgramChangeEvent()
         e.value = 1#measure.midi.program
         self.midistream.add_event(e)
     self.write(measure.musicdata)
     self.tick += measure.ticks()
示例#5
0
 def write_part(self, part):
     self.tick = 0
     if not self.midistream:
         self.midistream = midi.new_stream(50, part.score.divisions)
         e = midi.ProgramChangeEvent()
         e.value = 1  #part.midi.program
         self.midistream.add_event(e)
     else:
         self.midistream.add_track()
         e = midi.ProgramChangeEvent()
         e.value = 1  #part.midi.program
         self.midistream.add_event(e)
     map(self.write, part)
示例#6
0
 def write_part(self, part):
     self.tick = 0
     if not self.midistream:
         self.midistream = midi.new_stream(50, part.score.divisions)
         e = midi.ProgramChangeEvent()
         e.value = 1#part.midi.program
         self.midistream.add_event(e)
     else:
         self.midistream.add_track()
         e = midi.ProgramChangeEvent()
         e.value = 1#part.midi.program
         self.midistream.add_event(e)
     map(self.write, part)
示例#7
0
 def write_note(self, note):
     if not self.midistream:
         self.midistream = midi.new_stream(90, note.measure.part.score.divisions)
         e = midi.ProgramChangeEvent()
         e.value = 1#note.midi.program
         self.midistream.add_event(e)
     if note.pitch:
         pitch = note.pitch.getMIDIpitch()
         e = midi.NoteOnEvent()
         e.pitch = pitch
         e.velocity = 64
         e.tick = self.tick+note.startTick
         self.midistream.add_event(e)
         e = midi.NoteOffEvent()
         e.pitch = pitch
         e.velocity = 64
         e.tick = self.tick+note.startTick+note.duration
         self.midistream.add_event(e)
示例#8
0
 def write_note(self, note):
     if not self.midistream:
         self.midistream = midi.new_stream(
             90, note.measure.part.score.divisions)
         e = midi.ProgramChangeEvent()
         e.value = 1  #note.midi.program
         self.midistream.add_event(e)
     if note.pitch:
         pitch = note.pitch.getMIDIpitch()
         e = midi.NoteOnEvent()
         e.pitch = pitch
         e.velocity = 64
         e.tick = self.tick + note.startTick
         self.midistream.add_event(e)
         e = midi.NoteOffEvent()
         e.pitch = pitch
         e.velocity = 64
         e.tick = self.tick + note.startTick + note.duration
         self.midistream.add_event(e)