いらないモノ、ひつようなモノ

書籍、音楽、そして若干のテクノロジー

UDOライブラリ

少しづつできてきたものをば。

multiTapOnBeat

マルチタップする。エコーとか。ディレイとか、マルチタップとか、大好き。BPMを引数にとって、8ビート間隔で減衰率を指定しながら。

;; multiTapOnBeat
;; 2007/09/09 - a9a9qq@gmail.com
;; 
;; [Syntax]
;; 
;; aout multiTapOnBeat ain, i_bpm, i_beat, i_rate, i_inv
;; 
;;   a_out:  effected a-rate 
;;   a_in:   source a-rate
;;   i_bpm:  bpm of the song
;;   i_beat: beat to tap
;;   i_rate: rate to lower the amplitude
;;   i_inv:  can be skipped to be 0
;;
;; [The way to use]
;; 
;; 1) Initialize the global a-rate parameter at the beggening of orc file,
;;    which would be allocated just after the nchnls definition, and
;;    before the #include.
;; 
;;      ex. "gatap init 0"
;; 
;; 2) Route the a-rate ouput of the instr to the global parameter
;;    defined at the top of orc file.
;; 
;;      ex, "gatap = gatap + aout"
;; 
;; 3) Add the dummy function for the effector routine,
;;    which includes UDO opcode multiTapOnBeat. You may
;;    need to clean up the globa a-rate parameter.
;; 
;;      ex)
;;      instr 100
;;       atmp     multiTapOnBeat gatap, 120, 8, 0.8
;;       outs    atmp, atmp
;;       gatap   = 0
;;      endin


opcode multiTapOnBeat, a, aiiio
setksmps 1
a_src, i_bpm, i_beat, i_rate, i_inv xin

iint = 60.0 / i_bpm / (i_beat/4)
if (i_inv == 1) then
 a_src=a_src*i_rate*i_rate*i_rate*i_rate*i_rate*i_rate*i_rate*i_rate*i_rate
 i_rate=1.0/i_rate
endif
a_out multitap a_src, \
 iint,   i_rate, \
 iint*2, i_rate*i_rate, \
 iint*3, i_rate*i_rate*i_rate, \
 iint*4, i_rate*i_rate*i_rate*i_rate, \
 iint*5, i_rate*i_rate*i_rate*i_rate*i_rate, \
 iint*6, i_rate*i_rate*i_rate*i_rate*i_rate*i_rate, \
 iint*7, i_rate*i_rate*i_rate*i_rate*i_rate*i_rate*i_rate, \
 iint*8, i_rate*i_rate*i_rate*i_rate*i_rate*i_rate*i_rate*i_rate
xout a_out
endop