MIDIUtil
MIDIUtil copied to clipboard
Problem with microtonal tuning
I am using the qsynth (gui for fluidsynth) and i have problems getting microtonal tuning out of it (in timidity it works as you have said). This is my code, can you see what the problem is?
`from midiutil import MIDIFile
degrees = range(57, 82) # MIDI note number duration = 1 # In beats tempo = 60 # In BPM volume = 20 # 0-127, as per the MIDI standard
track = 0 channel = 0 tuning = [(69, 500)] program = 0 bank = 0 time = 0
MyMIDI = MIDIFile(1) # One track, defaults to format 1 (tempo track # automatically created)
MyMIDI.addTempo(track,time, tempo)
MyMIDI.changeNoteTuning(track, tuning, tuningProgam=program) MyMIDI.changeTuningBank(track, channel, time, bank) # may or may not be needed MyMIDI.changeTuningProgram(track, channel, time, program) # ditto
for pitch in degrees: MyMIDI.addNote(0, 0, pitch, time, duration, volume) time = time + .25
with open("/tmp/major-scale.mid", "wb") as output_file: MyMIDI.writeFile(output_file) `