Mechanical Music Digest 
You Are Not Logged In Login/Get New Account
Please Log In. Accounts are free!
Logged In users are granted additional features including a more current version of the Archives and a simplified process for submitting articles.
Home Archives Calendar Gallery Store Links Info
MMD > Tech > rem_Bridges.cal

; Rem_Bridges.cal ; ; Copyright 2002 by Walter Tenten ; ; First all notes are extended by 6. ; Thus they will overlap in places where bridging is present. ; ; The second section will remove any overlapping notes ; and merge them into single events. ; ; (do (do (word CurrentKey 13) ; Ampico starts at Note 16! (word ExtendedNotes 0) ; Maximum of 2**16 (word DeletedNotes 0) (word wNoteNumber 0) (word wChan 0) (word wKey 0) (word wVel 0) (long lDur 0) (dword dTime 0) (dword dNoteEnde 0) (while (< CurrentKey 115) ; Ampico ends with 113 (do (message "CurrentNote: " CurrentKey " Extended Notes: " ExtendedNotes) (forEachEvent (if (&& (== Event.Kind NOTE) (== Note.Key CurrentKey)) (do (= Note.Dur (+ Note.Dur 6)) (++ ExtendedNotes) ) NIL ) ) (++ CurrentKey) ) ) (pause ExtendedNotes " Notes Extended.") ) ; Ab hier Unlap/Merge (do (= CurrentKey 13) (= wNoteNumber 0) (while (< CurrentKey 115) (do (= wNoteNumber 0) (message "Working on Note: " CurrentKey) (forEachEvent (if (&& (== Event.Kind NOTE) (== Note.Key CurrentKey)) (do (++ wNoteNumber) ;; (pause "Working on Note: " wNoteNumber) (if (!= wNoteNumber 1) ; First Note ? (do ; No ;;; (pause wNoteNumber ".. EventTime =" Event.Time "dNoteEnde =" dNoteEnde) (if (< Event.Time dNoteEnde) ; Overlap ? (do ; Yes (= lDur (+ Note.Dur (- Event.Time dTime))) ; adjust length (= dNoteEnde (+ dTime lDur)) ; adjust too ;;; (pause wNoteNumber "New length =" lDur) (delete) (++ DeletedNotes) ) ; end do (do ; Else No Overlap (insert dTime wChan NOTE Note.Key wVel lDur) ; restore prev Note (-- DeletedNotes) ;;; (pause wNoteNumber ".. Note " Event.Time Note.Dur) (= dTime Event.Time) ; New set of Note properties (= wChan Event.Chan) (= wKey Note.Key) (= wVel Note.Vel) (= lDur Note.Dur) (= dNoteEnde (+ dTime lDur)) (delete) (++ DeletedNotes) ) ; end do ) ; end if ;;; (pause DeletedNotes "Notes Deleted") ) ; end do (do ; else if (!= wNoteNumber 1) ;;; (pause wNoteNumber ". Note " Event.Time Note.Dur) (= dTime Event.Time) ; Save Note properties for first Note (= wChan Event.Chan) (= wKey Note.Key) (= wVel Note.Vel) (= lDur Note.Dur) (= dNoteEnde (+ dTime lDur)) (delete) (++ DeletedNotes) ) ; end do ) ; end if (!= wNoteNumber 1) ) ; end do NIL ; Not a Note or note this Key ) ; end if (&& (== Event.Kind NOTE)...) ) ; end forEachEvent ;; (pause wNoteNumber " in Track " CurrentKey) (if (!= wNoteNumber 0) (do (insert dTime wChan NOTE CurrentKey wVel lDur) ; restore prev Note (-- DeletedNotes) ) ) (++ CurrentKey) ) ; end do ) ; end while (pause DeletedNotes " doubled/overlapping notes (net) deleted.") ) )

Home    Archives    Calendar    Gallery    Store    Links    Info   


Enter text below to search the MMD Website with Google



CONTACT FORM: Click HERE to write to the editor, or to post a message about Mechanical Musical Instruments to the MMD

Unless otherwise noted, all opinions are those of the individual authors and may not represent those of the editors. Compilation copyright 1995-2024 by Jody Kravitz.

Please read our Republication Policy before copying information from or creating links to this web site.

Click HERE to contact the webmaster regarding problems with the website.

Please support publication of the MMD by donating online

Please Support Publication of the MMD with your Generous Donation

Pay via PayPal

No PayPal account required

                                     
Translate This Page