MCPcopy Create free account
hub / github.com/bspaans/python-mingus / write_Note

Function write_Note

mingus/midi/midi_file_out.py:75–90  ·  view source on GitHub ↗

Expect a Note object from mingus.containers and save it into a MIDI file, specified in file. You can set the velocity and channel in Note.velocity and Note.channel.

(file, note, bpm=120, repeat=0, verbose=False)

Source from the content-addressed store, hash-verified

73
74
75def write_Note(file, note, bpm=120, repeat=0, verbose=False):
76 """Expect a Note object from mingus.containers and save it into a MIDI
77 file, specified in file.
78
79 You can set the velocity and channel in Note.velocity and Note.channel.
80 """
81 m = MidiFile()
82 t = MidiTrack(bpm)
83 m.tracks = [t]
84 while repeat >= 0:
85 t.set_deltatime(b"\x00")
86 t.play_Note(note)
87 t.set_deltatime(b"\x48")
88 t.stop_Note(note)
89 repeat -= 1
90 return m.write_file(file, verbose)
91
92
93def write_NoteContainer(file, notecontainer, bpm=120, repeat=0, verbose=False):

Callers

nothing calls this directly

Calls 6

set_deltatimeMethod · 0.95
play_NoteMethod · 0.95
stop_NoteMethod · 0.95
write_fileMethod · 0.95
MidiTrackClass · 0.90
MidiFileClass · 0.70

Tested by

no test coverage detected