Skip to content

Commit

Permalink
Update editor.py
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminHalko committed Jan 29, 2022
1 parent 73ba215 commit 9f702b3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,16 @@ def PlayRwav(startOffset,replaceNumber):
ShowError("Could not play audio",error)

def NormalizeMidi(midiPath,savePath,defaultTempo):
midi_data = pretty_midi.PrettyMIDI(midiPath)
mid = mido.MidiFile(midiPath)
for track in mid.tracks:
for num,msg in enumerate(track):
try:
if(not msg.is_meta and msg.channel != 0):
track[num] = msg.copy(channel=0)
except Exception:
tried = True
mid.save(savePath)
midi_data = pretty_midi.PrettyMIDI(savePath)
newMidi = pretty_midi.PrettyMIDI(initial_tempo=defaultTempo,resolution=2000)
i = 0
for instrument in midi_data.instruments:
Expand Down Expand Up @@ -1545,4 +1554,4 @@ def getData(file,point):
if(not os.path.exists(file.path)): file.path = ""
from errorhandler import ShowError

version = "1.0.0-beta.a"
version = "1.0.0-beta.b"

0 comments on commit 9f702b3

Please sign in to comment.