Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / Midi quantization

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Midi quantization
#8409
Posted by: 2006-07-29 21:18:22 Last edited by: Jeff Glatt 2007-06-16 19:22:02 (Total edited 1 time)
I make printouts of the music score of a MIDI tract. But the resulting scores are often quite hard to read. I need a script that extends the duration of each note to an even division of a sixteenth note, eighth note, quarter note, etc.
Message2.
#8410
Posted by: Jeff Glatt 2006-07-30 00:51:36 Last edited by: Jeff Glatt 2007-06-16 19:22:27 (Total edited 1 time)
What you're talking about doing is quantizing note length. Essentially what you're doing is adjusting the time of every note-off event. Yes, you can certainly do this with MIDI REXX. If your track is single notes (ie, not chords), then you could go through the track looking for every note-on and note-off event. You need to pick the smallest "sub-beat" that occurs in your song. For example, above that is a sixteenth note. Just search for every note-off event, and adjust its timing so it falls to the next "sub-beat". Assuming your midi file is 192 PPQN, that means there are 48 PPQN in every sixteenth note. So you can round up a note-off's time (to the nearest sixteenth note) as so:
/* Set only track 10 as searchable */
selected = MIDITrack(10)

IF selected \== 0 THEN DO
   DO UNTIL err \== ""
      err = MIDIGetEvent('Off |(Off')
      IF err == "" THEN DO

         midievent.!clock = (midievent.!clock // 48) + 48
         err = MIDISetEvent('TIME')

         IF err \== "" THEN SAY "ERROR:" err
      END
      ELSE IF err \== "No currently selected event" THEN SAY "ERROR:" err
   END
END
/* Follow up with a MidiSaveFile */
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-3-29  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0