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)
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()
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()
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)
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)
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)
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)