示例#1
0
def write_NoteContainer(file, notecontainer, bpm=120, repeat=0, verbose=False):
    """Write a mingus.NoteContainer to a MIDI file."""
    m = MidiFile()
    t = MidiTrack(bpm)
    m.tracks = [t]
    while repeat >= 0:
        t.set_deltatime('\x00')
        t.play_NoteContainer(notecontainer)
        t.set_deltatime("\x48")
        t.stop_NoteContainer(notecontainer)
        repeat -= 1
    return m.write_file(file, verbose)
示例#2
0
def write_NoteContainer(file, notecontainer, bpm=120, repeat=0, verbose=False):
    """Write a mingus.NoteContainer to a MIDI file."""
    m = MidiFile()
    t = MidiTrack(bpm)
    m.tracks = [t]
    while repeat >= 0:
        t.set_deltatime('\x00')
        t.play_NoteContainer(notecontainer)
        t.set_deltatime("\x48")
        t.stop_NoteContainer(notecontainer)
        repeat -= 1
    return m.write_file(file, verbose)
示例#3
0
def write_Note(file, note, bpm=120, repeat=0, verbose=False):
    """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.
    """
    m = MidiFile()
    t = MidiTrack(bpm)
    m.tracks = [t]
    while repeat >= 0:
        t.set_deltatime('\x00')
        t.play_Note(note)
        t.set_deltatime("\x48")
        t.stop_Note(note)
        repeat -= 1
    return m.write_file(file, verbose)
示例#4
0
def write_Note(file, note, bpm=120, repeat=0, verbose=False):
    """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.
    """
    m = MidiFile()
    t = MidiTrack(bpm)
    m.tracks = [t]
    while repeat >= 0:
        t.set_deltatime('\x00')
        t.play_Note(note)
        t.set_deltatime("\x48")
        t.stop_Note(note)
        repeat -= 1
    return m.write_file(file, verbose)