コード例 #1
0
def event_indeces_to_midi_file(event_indeces, midi_file_name, velocity_scale=0.8):
    event_seq = EventSeq.from_array(event_indeces)
    note_seq = event_seq.to_note_seq()
    for note in note_seq.notes:
        note.velocity = int((note.velocity - 64) * velocity_scale + 64)
    note_seq.to_midi_file(midi_file_name)
    return len(note_seq.notes)
コード例 #2
0
from sequence import EventSeq, NoteSeq
import numpy as np

rand_array = np.random.random_sample([2048])
rand_array = rand_array * 240
rand_array = rand_array.astype(np.int)

print(rand_array)
es = EventSeq.from_array(rand_array)
es.to_note_seq().to_midi_file('out.midi')