;;Slide.CAL ;; (Slide Note) ;; Written By 蛞蝓なめちゃん, 1997/09/10 ;; odasan@ma.catv.ne.jp ;; 機 能 : ・読込んだ 複数の音をスラーでつなぎます。 ;; 要するに pitch bend します。 ;; ・始めの音の duration を伸ばして、 ;; 次以降の音を pitch bend に書き換えます。 ;; ・初期設定では、最後の音の gate off 位置に ;; bend 0 を書き込みます。 ;; 使用法 : 対象範囲を選択して、本 program を実行するだけ。 ;; 注 意 : ・pitch bend sensibility は初期設定で 12 半音です。 ;; 他の値を使うときは、下記 program 中の ;; "range" の値を書き換えてください。 ;; ・また bend 値が -8192 〜 +8191 の範囲外になるような指定 ;; をすると、ERROR になります。 ;; 計算結果が +8192 になったときは、+8191 を書込みます。 ;; ・2 つめの音の (duration + pos) tick の位置に ;; bend 0 を 書込みます。 ;; bend値を 0 に戻す位置は、"pos" を書換えることで変更可能です。 ;; 初期設定で pos=0 です。 ;; 動 作 : time base = 120 のとき、pos= +2 を指定すると、 ;; 4:1:60 ch=1 note=A3 vel=96 dur=20 と ;; 4:1:90 ch=3 note=B3 vel=80 dur=90 ;; 4:2:60 ch=2 note=C4 vel=48 dur=60 の音が選択されている場合、 ;; 4:1:60 ch=1 note=A3 vel=96 dur=1:60 ;; 4:1:90 ch=1 pitch bend +1365 ;; 4:2:60 ch=1 pitch bend +2048 ;; 4:3:02 ch=1 pitch bend 0 ;; --- のように書換えます。 ;; UNDO : 編集メニューの「元に戻す」で、 ;; 「イベント挿入」を 2 回取消し、さらに ;; 「CAL(forEachEvent)」を取消せば、元に戻ります。 (do (int flag 0) (int ch) (int velo) (long note0) (long note1) (int dur0) (int dur1) (dword time0) (dword time1) (dword time2) (int pos 0) ;; bend 0 を書き込む位置 (long length) (int range 12) ;; pitch bend sensibility = 12 (forEachEvent (if (== Event.Kind NOTE) (do (if (== flag 0) (do (= time0 Event.Time) ;; 1 つめ (= note0 Note.Key) (= velo Note.Vel) (= dur0 Note.Dur) (= ch Event.Chan) (delete) (= flag 1) ) (do (= time1 Event.Time) ;; 2 つめ (= dur1 Note.Dur) (= note1 (- Note.Key note0)) (*= note1 8192) (/= note1 range) (if (== note1 8192) (= note1 8191) ) (= length (- time1 time0)) (+= length dur1) (delete) (insert time1 ch WHEEL note1) ;; Bend ) ) ) ) ) (insert time0 ch NOTE note0 velo length) (= time2 (+ time0 length)) (+= time2 pos) (insert time2 ch WHEEL 0) )