# This script generates a series of gated sounds # The part of the sound gated "out" is replace by # a 500 Hz square wave, so that all sounds have the same # value form Gating word name toBeGated positive initialGate_(in_s) 0.3 endform select Sound 'name$' sf = Get sampling frequency ft = Get finishing time am = Get absolute extremum... 0 0 None am = am/2 durGate = ft - initialGate #Create square-wave and apply 5ms linear fade-in Create Sound... first 0 'ft' 'sf' am*sin(2*pi*500*x) Copy... square Formula... if self > 0 then am else self fi Formula... if self <=0 then -1*am else self fi Formula... if x < 0.005 then self * (x)/0.005 else self endif for i from 0 to 10 splice_point = initialGate + durGate * (i/10) rest = ft - splice_point select Sound 'name$' #extract part and apply fade-out Extract part... 0 'splice_point' Rectangular 1 no Rename... gate Formula... if x > 'splice_point'- 0.005 then self * ('splice_point'-x)/0.005 else self endif select Sound square Extract part... 0 'rest' Rectangular 1 no Rename... temp #generate fade-out to the square-wave Formula... if x > ('rest'- 0.005) then self * ('rest' - x)/0.005 else self endif #splice together select Sound gate if i < 10 plus Sound temp Concatenate Rename... gate'i' else Copy... gate'i' endif #clean up select Sound gate plus Sound temp Remove endfor