3542 lines
486 KiB
HTML
3542 lines
486 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
|
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=0.8"/><title>2 rsc3: ugens</title><link rel="stylesheet" type="text/css" href="scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="racket.css" title="default"/><link rel="stylesheet" type="text/css" href="manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="manual-racket.css" title="default"/><script type="text/javascript" src="scribble-common.js"></script><script type="text/javascript" src="manual-racket.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="scribble-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">▼</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">rsc3:<span class="mywbr"> </span> racket/<span class="mywbr"> </span>scheme/<span class="mywbr"> </span>supercollider</a></td></tr></table></div><div class="tocviewsublisttop" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="rsc3__server_commands.html" class="tocviewlink" data-pltdoc="x">rsc3:<span class="mywbr"> </span> server commands</a></td></tr><tr><td align="right">2 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">rsc3:<span class="mywbr"> </span> ugens</a></td></tr><tr><td align="right">3 </td><td><a href="rsc3__tutorials.html" class="tocviewlink" data-pltdoc="x">rsc3:<span class="mywbr"> </span> tutorials</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">►</a></td><td>2 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">rsc3:<span class="mywbr"> </span> ugens</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">2.1 </td><td><a href="#%28part.__.Rlpf_in_freq_rq_%29" class="tocviewlink" data-pltdoc="x">(Rlpf in freq rq)</a></td></tr><tr><td align="right">2.2 </td><td><a href="#%28part.__fold_in_lo_hi_%29" class="tocviewlink" data-pltdoc="x">(fold in lo hi)</a></td></tr><tr><td align="right">2.3 </td><td><a href="#%28part.__formlet_in_freq_attack.Time_decay.Time_%29" class="tocviewlink" data-pltdoc="x">(formlet in freq attack<span class="mywbr"> </span>Time decay<span class="mywbr"> </span>Time)</a></td></tr><tr><td align="right">2.4 </td><td><a href="#%28part.__lin-lin_in_srclo_srchi_dstlo_dsthi_%29" class="tocviewlink" data-pltdoc="x">(lin-<wbr></wbr>lin in srclo srchi dstlo dsthi)</a></td></tr><tr><td align="right">2.5 </td><td><a href="#%28part.__fos_in_a0_a1_b1_%29" class="tocviewlink" data-pltdoc="x">(fos in a0 a1 b1)</a></td></tr><tr><td align="right">2.6 </td><td><a href="#%28part.__bpf_in_freq_rq_%29" class="tocviewlink" data-pltdoc="x">(bpf in freq rq)</a></td></tr><tr><td align="right">2.7 </td><td><a href="#%28part.__wrap_in_lo_hi_%29" class="tocviewlink" data-pltdoc="x">(wrap in lo hi)</a></td></tr><tr><td align="right">2.8 </td><td><a href="#%28part.__bpz2_in_%29" class="tocviewlink" data-pltdoc="x">(bpz2 in)</a></td></tr><tr><td align="right">2.9 </td><td><a href="#%28part.__amp-comp_freq_root_exp_%29" class="tocviewlink" data-pltdoc="x">(amp-<wbr></wbr>comp freq root exp)</a></td></tr><tr><td align="right">2.10 </td><td><a href="#%28part.__lag2_in
|
||
|
|
||
|
(import (rsc3))
|
||
|
|
||
|
(audition (out 0 (mul (f-<wbr></wbr>sin-<wbr></wbr>osc ar (mce2 440 550) 0) 0.05)))
|
||
|
|
||
|
(let ((f (x-<wbr></wbr>line kr 200 4000 1 remove-<wbr></wbr>synth)))
|
||
|
(audition (out 0 (mul (f-<wbr></wbr>sin-<wbr></wbr>osc ar f 0) 0.25))))</a></td></tr><tr><td align="right">2.103 </td><td><a href="#%28part.__v-osc_rate_bufpos_freq_phase_%29" class="tocviewlink" data-pltdoc="x">(v-<wbr></wbr>osc rate bufpos freq phase)</a></td></tr><tr><td align="right">2.104 </td><td><a href="#%28part.__var-saw_rate_freq_iphasewidth_%29" class="tocviewlink" data-pltdoc="x">(var-<wbr></wbr>saw rate freq iphasewidth)</a></td></tr><tr><td align="right">2.105 </td><td><a href="#%28part.__import__sosc___rsc3_____let___a__letc___r_1_______________let____r___mul__buf-rate-scale_kr_0__r______________________p__phasor_ar_0_r__0__buf-frames_kr_0__0______________________f__mul-add__lf-noise1_kr_2__300_400______________________i__mul__sin-osc_ar_f_0__0_1__________________mrg2__buf-wr_0_p_1_i______________________out_0_0_0_____________b__letc___r_1_______________let____r___mul__buf-rate-scale_kr_0__r______________________p__phasor_ar_0_r__0__buf-frames_kr_0__0__________________out_0__buf-rd_1_ar_0_p_1_2__________with-sc3_____lambda__fd________async_fd__b-alloc_0____44100_2__1_________send-synth_fd__a__a________send-synth_fd__b__b________send_fd__s-new0__a__1001_1_0_________send_fd__s-new0__b__1002_1_0________define__do-send_m_____with-sc3__lambda__fd___send_fd_m_______do-send__n-set1_1002__r__5_____do-send__n-set1_1001__r___random_0_2______do-send__n-set1_1002__r__2__%29" class="tocviewlink" data-pltdoc="x">(import (sosc) (rsc3))
|
||
|
|
||
|
(let ((a (letc ((r 1))
|
||
|
(let* ((r* (mul (buf-<wbr></wbr>rate-<wbr></wbr>scale kr 0) r))
|
||
|
(p (phasor ar 0 r* 0 (buf-<wbr></wbr>frames kr 0) 0))
|
||
|
(f (mul-<wbr></wbr>add (lf-<wbr></wbr>noise1 kr 2) 300 400))
|
||
|
(i (mul (sin-<wbr></wbr>osc ar f 0) 0.1)))
|
||
|
(mrg2 (buf-<wbr></wbr>wr 0 p 1 i)
|
||
|
(out 0 0.0)))))
|
||
|
(b (letc ((r 1))
|
||
|
(let* ((r* (mul (buf-<wbr></wbr>rate-<wbr></wbr>scale kr 0) r))
|
||
|
(p (phasor ar 0 r* 0 (buf-<wbr></wbr>frames kr 0) 0)))
|
||
|
(out 0 (buf-<wbr></wbr>rd 1 ar 0 p 1 2))))))
|
||
|
(with-<wbr></wbr>sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-<wbr></wbr>alloc 0 (* 44100 2) 1))
|
||
|
(send-<wbr></wbr>synth fd "a" a)
|
||
|
(send-<wbr></wbr>synth fd "b" b)
|
||
|
(send fd (s-<wbr></wbr>new0 "a" 1001 1 0))
|
||
|
(send fd (s-<wbr></wbr>new0 "b" 1002 1 0)))))
|
||
|
|
||
|
(define (do-<wbr></wbr>send m)
|
||
|
(with-<wbr></wbr>sc3 (lambda (fd) (send fd m))))
|
||
|
|
||
|
(do-<wbr></wbr>send (n-<wbr></wbr>set1 1002 "r" 5))
|
||
|
|
||
|
(do-<wbr></wbr>send (n-<wbr></wbr>set1 1001 "r" (random 0 2)))
|
||
|
|
||
|
(do-<wbr></wbr>send (n-<wbr></wbr>set1 1002 "r" 2))</a></td></tr><tr><td align="right">2.106 </td><td><a href="#%28part.__import__rsc3_____audition__out_0__mul__impulse_ar_800_0__0_1______let___f__x-line_kr_800_10_5_remove-synth_______audition__out_0__mul__impulse_ar_f_0_0__0_5_______let___f__mouse-y__kr_4_8_0_0_1__________p__mouse-x__kr_0_1_0_0_1_______audition__out_0__mul__impulse_ar_f__mce2_0_p___0_2____%29" class="tocviewlink" data-pltdoc="x">(import (rsc3))
|
||
|
|
||
|
(audition (out 0 (mul (impulse ar 800 0) 0.1)))
|
||
|
|
||
|
(let ((f (x-<wbr></wbr>line kr 800 10 5 remove-<wbr></wbr>synth)))
|
||
|
(audition (out 0 (mul (impulse ar f 0.0) 0.5))))
|
||
|
|
||
|
(let ((f (mouse-<wbr></wbr>y* kr 4 8 0 0.1))
|
||
|
(p (mouse-<wbr></wbr>x* kr 0 1 0 0.1)))
|
||
|
(audition (out 0 (mul (impulse ar f (mce2 0 p)) 0.2))))</a></td></tr><tr><td align="right">2.107 </td><td><a href="#%28part.__import__rsc3_____audition__out_0__mul__blip_ar_440_200__0_15___%29" class="tocviewlink" data-pltdoc="x">(import (rsc3))
|
||
|
|
||
|
(audition (out 0 (mul (blip ar 440 200) 0.15)))</a></td></tr><tr><td align="right">2.108 </td><td><a href="#%28part.__select_which_array_%29" class="tocviewlink" data-pltdoc="x">(select which array)</a></td></tr><tr><td align="right">2.109 </td><td><a href="#%28part.__import__rsc3__%29" class="tocviewlink" data-pltdoc="x">(import (rsc3))</a></td></tr><tr><td align="right">2.110 </td><td><a href="#%28part.__import__rsc3_____with-sc3___lambda__fd______async_fd__b-alloc_10_512_1_______async_fd__b-gen1_10__sine1___list____1_2_4__1_1_2_1_3_1_4_1_5_1_6_1_7_1_8_1_9_1_10________audition__out_0__mul__c-osc_ar_10_200_0_7__0_25______audition__out_0__mul__c-osc_ar_10_200__mouse-x__kr_0_4_0_0_1___0_25___%29" class="tocviewlink" data-pltdoc="x">(import (rsc3))
|
||
|
|
||
|
(with-<wbr></wbr>sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-<wbr></wbr>alloc 10 512 1))
|
||
|
(async fd (b-<wbr></wbr>gen1 10 "sine1" (list (+<span class="mywbr"> </span> 1 2 4) 1 1/<span class="mywbr"> </span>2 1/<span class="mywbr"> </span>3 1/<span class="mywbr"> </span>4 1/<span class="mywbr"> </span>5 1/<span class="mywbr"> </span>6 1/<span class="mywbr"> </span>7 1/<span class="mywbr"> </span>8 1/<span class="mywbr"> </span>9 1/<span class="mywbr"> </span>10)))))
|
||
|
|
||
|
(audition (out 0 (mul (c-<wbr></wbr>osc ar 10 200 0.7) 0.25)))
|
||
|
|
||
|
(audition (out 0 (mul (c-<wbr></wbr>osc ar 10 200 (mouse-<wbr></wbr>x* kr 0 4 0 0.1)) 0.25)))</a></td></tr><tr><td align="right">2.111 </td><td><a href="#%28part.__v-osc3_rate_bufpos_freq1_freq2_freq3_%29" class="tocviewlink" data-pltdoc="x">(v-<wbr></wbr>osc3 rate bufpos freq1 freq2 freq3)</a></td></tr><tr><td align="right">2.112 </td><td><a href="#%28part.__lf-cub_rate_freq_iphase_%29" class="tocviewlink" data-pltdoc="x">(lf-<wbr></wbr>cub rate freq iphase)</a></td></tr><tr><td align="right">2.113 </td><td><a href="#%28part.__lf-pulse_rate_freq_iphase_width_%29" class="tocviewlink" data-pltdoc="x">(lf-<wbr></wbr>pulse rate freq iphase width)</a></td></tr><tr><td align="right">2.114 </td><td><a href="#%28part.__import__sosc___rsc3__%29" class="tocviewlink" data-pltdoc="x">(import (sosc) (rsc3))</a></td></tr><tr><td align="right">2.115 </td><td><a href="#%28part._.See_lf-cub_%29" class="tocviewlink" data-pltdoc="x">See lf-<wbr></wbr>cub.</a></td></tr><tr><td align="right">2.116 </td><td><a href="#%28part.__sync-saw_rate_sync.Freq_saw.Freq_%29" class="tocviewlink" data-pltdoc="x">(sync-<wbr></wbr>saw rate sync<span class="mywbr"> </span>Freq saw<span class="mywbr"> </span>Freq)</a></td></tr><tr><td align="right">2.117 </td><td><a href="#%28part.__t-choose_trig_array_%29" class="tocviewlink" data-pltdoc="x">(t-<wbr></wbr>choose trig array)</a></td></tr><tr><td align="right">2.118 </td><td><a href="#%28part.__sin-osc_rate_freq_phase_%29" class="tocviewlink" data-pltdoc="x">(sin-<wbr></wbr>osc rate freq phase)</a></td></tr><tr><td align="right">2.119 </td><td><a href="#%28part.__klang_rate_freq.Scale_freq.Offset_spec_%29" class="tocviewlink" data-pltdoc="x">(klang rate freq<span class="mywbr"> </span>Scale freq<span class="mywbr"> </span>Offset spec)</a></td></tr><tr><td align="right">2.120 </td><td><a href="#%28part.__lag-in_num-channels_bus_lag_%29" class="tocviewlink" data-pltdoc="x">(lag-<wbr></wbr>in num-<wbr></wbr>channels bus lag)</a></td></tr><tr><td align="right">2.121 </td><td><a href="#%28part.__sound-in_channel_%29" class="tocviewlink" data-pltdoc="x">(sound-<wbr></wbr>in channel)</a></td></tr><tr><td align="right">2.122 </td><td><a href="#%28part.__in_num-channels_rate_bus_%29" class="tocviewlink" data-pltdoc="x">(in num-<wbr></wbr>channels rate bus)</a></td></tr><tr><td align="right">2.123 </td><td><a href="#%28part.__in-trig_num-channels_bus_%29" class="tocviewlink" data-pltdoc="x">(in-<wbr></wbr>trig num-<wbr></wbr>channels bus)</a></td></tr><tr><td align="right">2.124 </td><td><a href="#%28part.__replace-out_bufferindex_inputs_%29" class="tocviewlink" data-pltdoc="x">(replace-<wbr></wbr>out bufferindex inputs)</a></td></tr><tr><td align="right">2.125 </td><td><a href="#%28part.__local-in_num-channels_rate_%29" class="tocviewlink" data-pltdoc="x">(local-<wbr></wbr>in num-<wbr></wbr>channels rate)</a></td></tr><tr><td align="right">2.126 </td><td><a href="#%28part.__offset-out_bufferindex_inputs_%29" class="tocviewlink" data-pltdoc="x">(offset-<wbr></wbr>out bufferindex inputs)</a></td></tr><tr><td align="right">2.127 </td><td><a href="#%28part.__in-feedback_num-channels_bus_%29" class="tocviewlink" data-pltdoc="x">(in-<wbr></wbr>feedback num-<wbr></wbr>channels bus)</a></td></tr><tr><td align="right">2.128 </td><td><a href="#%28part.__x-out_buffer-index_xfade_inputs_%29" class="tocviewlink" data-pltdoc="x">(x-<wbr></wbr>out buffer-<wbr></wbr>index xfade inputs)</a></td></tr><tr><td align="right">2.129 </td><td><a href="#%28part.__out_bufferindex_inputs_%29" class="tocviewlink" data-pltdoc="x">(out bufferindex inputs)</a></td></tr><tr><td align="right">2.130 </td><td><a href="#%28part.__mix_.U.Gen_%29" class="tocviewlink" data-pltdoc="x">(mix UGen)</a></td></tr><tr><td align="right">2.131 </td><td><a href="#%28part.__mix-fill_n_f____let___n_6_________o__lambda______mul__f-sin-osc_ar__rand_200_700__0__0_1________audition__out_0__mix-fill_n_o____%29" class="tocviewlink" data-pltdoc="x
|
||
|
|
||
|
(let ((n 6)
|
||
|
(o (lambda (_<span class="mywbr"> </span>) (mul (f-<wbr></wbr>sin-<wbr></wbr>osc ar (rand 200 700) 0) 0.1))))
|
||
|
(audition (out 0 (mix-<wbr></wbr>fill n o))))</a></td></tr><tr><td align="right">2.132 </td><td><a href="#%28part.__latch_in_trig_%29" class="tocviewlink" data-pltdoc="x">(latch in trig)</a></td></tr><tr><td align="right">2.133 </td><td><a href="#%28part.__decay_in_decay.Time_%29" class="tocviewlink" data-pltdoc="x">(decay in decay<span class="mywbr"> </span>Time)</a></td></tr><tr><td align="right">2.134 </td><td><a href="#%28part.__wrap-index_bufnum_in_%29" class="tocviewlink" data-pltdoc="x">(wrap-<wbr></wbr>index bufnum in)</a></td></tr><tr><td align="right">2.135 </td><td><a href="#%28part.__mouse-y_rate_minval_maxval_warp_lag_%29" class="tocviewlink" data-pltdoc="x">(mouse-<wbr></wbr>y rate minval maxval warp lag)</a></td></tr><tr><td align="right">2.136 </td><td><a href="#%28part.__degree-to-key_bufnum_in_octave_%29" class="tocviewlink" data-pltdoc="x">(degree-<wbr></wbr>to-<wbr></wbr>key bufnum in octave)</a></td></tr><tr><td align="right">2.137 </td><td><a href="#%28part.__key-state_rate_keynum_minval_maxval_lag_%29" class="tocviewlink" data-pltdoc="x">(key-<wbr></wbr>state rate keynum minval maxval lag)</a></td></tr><tr><td align="right">2.138 </td><td><a href="#%28part.__mrg2_left_right_%29" class="tocviewlink" data-pltdoc="x">(mrg2 left right)</a></td></tr><tr><td align="right">2.139 </td><td><a href="#%28part.__mouse-button_rate_minval_maxval_lag_%29" class="tocviewlink" data-pltdoc="x">(mouse-<wbr></wbr>button rate minval maxval lag)</a></td></tr><tr><td align="right">2.140 </td><td><a href="#%28part.__slew_in_up_dn_%29" class="tocviewlink" data-pltdoc="x">(slew in up dn)</a></td></tr><tr><td align="right">2.141 </td><td><a href="#%28part.__mouse-x_rate_minval_maxval_warp_lag_%29" class="tocviewlink" data-pltdoc="x">(mouse-<wbr></wbr>x rate minval maxval warp lag)</a></td></tr><tr><td align="right">2.142 </td><td><a href="#%28part.__decay2_in_attack.Time_decay.Time_%29" class="tocviewlink" data-pltdoc="x">(decay2 in attack<span class="mywbr"> </span>Time decay<span class="mywbr"> </span>Time)</a></td></tr><tr><td align="right">2.143 </td><td><a href="#%28part.__k2a_in_%29" class="tocviewlink" data-pltdoc="x">(k2a in)</a></td></tr><tr><td align="right">2.144 </td><td><a href="#%28part.__mul-add_a_b_c_%29" class="tocviewlink" data-pltdoc="x">(mul-<wbr></wbr>add a b c)</a></td></tr><tr><td align="right">2.145 </td><td><a href="#%28part.__clip2_a_b_%29" class="tocviewlink" data-pltdoc="x">(clip2 a b)</a></td></tr><tr><td align="right">2.146 </td><td><a href="#%28part.__.Atan2_x_y_%29" class="tocviewlink" data-pltdoc="x">(Atan2 x y)</a></td></tr><tr><td align="right">2.147 </td><td><a href="#%28part.__trunc_a_b_%29" class="tocviewlink" data-pltdoc="x">(trunc a b)</a></td></tr><tr><td align="right">2.148 </td><td><a href="#%28part.__sub_a_b_%29" class="tocviewlink" data-pltdoc="x">(sub a b)</a></td></tr><tr><td align="right">2.149 </td><td><a href="#%28part.__round-up_a_b_%29" class="tocviewlink" data-pltdoc="x">(round-<wbr></wbr>up a b)</a></td></tr><tr><td align="right">2.150 </td><td><a href="#%28part.__ring4_a_b_%29" class="tocviewlink" data-pltdoc="x">(ring4 a b)</a></td></tr><tr><td align="right">2.151 </td><td><a href="#%28part.__pow_a_b_%29" class="tocviewlink" data-pltdoc="x">(pow a b)</a></td></tr><tr><td align="right">2.152 </td><td><a href="#%28part.__ring1_a_b_%29" class="tocviewlink" data-pltdoc="x">(ring1 a b)</a></td></tr><tr><td align="right">2.153 </td><td><a href="#%28part.__gt_a_b_%29" class="tocviewlink" data-pltdoc="x">(gt a b)</a></td></tr><tr><td align="right">2.154 </td><td><a href="#%28part.__add_a_b_%29" class="tocviewlink" data-pltdoc="x">(add a b)</a></td></tr><tr><td align="right">2.155 </td><td><a href="#%28part.__abs-dif_a_b_%29" class="tocviewlink" data-pltdoc="x">(abs-<wbr></wbr>dif a b)</a></td></tr><tr><td align="right">2.156 </td><td><a href="#%28part.__am-clip_a_b_%29" class="tocviewlink" data-pltdoc="x">(am-<wbr></wbr>clip a b)</a><
|
||
|
|
||
|
#|
|
||
|
|
||
|
fft feature detector for onset detection based on work described in
|
||
|
Jensen,K. & Andersen, T. H. (2003). Real-<wbr></wbr>time Beat Estimation Using
|
||
|
Feature Extraction. in Proceedings of the Computer Music Modeling and
|
||
|
Retrieval Symposium, Lecture Notes in Computer Science. springer
|
||
|
Verlag.
|
||
|
|
||
|
First order derivatives of the features are taken. Threshold may
|
||
|
need to be set low to pick up on changes.
|
||
|
|
||
|
buffer -<wbr></wbr> fft buffer to read from.
|
||
|
propsc -<wbr></wbr> Proportion of spectral centroid feature.
|
||
|
prophfe -<wbr></wbr> Proportion of high frequency energy feature.
|
||
|
prophfc -<wbr></wbr> Proportion of high frequency content feature.
|
||
|
propsf -<wbr></wbr> Proportion of spectral flux feature.
|
||
|
threshold -<wbr></wbr> Threshold level for allowing a detection
|
||
|
waittime -<wbr></wbr> If triggered, minimum wait until a further frame can
|
||
|
cause another spot (useful to stop multiple detects on
|
||
|
heavy signals)
|
||
|
|
||
|
Default values in sclang are:<span class="mywbr"> </span> propsc=0.25, prophfe=0.25,
|
||
|
prophfc=0.25, propsf=0.25, threshold=1.0, waittime=0.04.
|
||
|
|
||
|
|#
|
||
|
|
||
|
(with-<wbr></wbr>sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-<wbr></wbr>alloc 0 2048 1))))
|
||
|
|
||
|
(let* ((source (sound-<wbr></wbr>in 0))
|
||
|
(detect (pv-<wbr></wbr>jensen-<wbr></wbr>andersen (fft* 0 source)
|
||
|
0.25 0.25 0.25 0.25
|
||
|
(mouse-<wbr></wbr>x kr 0.01 1.0 1 0.1)
|
||
|
0.04)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-<wbr></wbr>osc ar (mce2 440 445) 0)
|
||
|
(decay (mul 0.1 detect) 0.1)))))</a></td></tr><tr><td align="right">2.247 </td><td><a href="#%28part.__pv-phase-shift270_buffer_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>phase-<wbr></wbr>shift270 buffer)</a></td></tr><tr><td align="right">2.248 </td><td><a href="#%28part.__pv-hainsworth-foote_buffer_proph_propf_threshold_waittime_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>hainsworth-<wbr></wbr>foote buffer proph propf threshold waittime)</a></td></tr><tr><td align="right">2.249 </td><td><a href="#%28part.__pv-phase-shift_buffer_shift_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>phase-<wbr></wbr>shift buffer shift)</a></td></tr><tr><td align="right">2.250 </td><td><a href="#%28part.__pv-copy_buffer.A_buffer.B_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>copy buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B)</a></td></tr><tr><td align="right">2.251 </td><td><a href="#%28part.__pv-brick-wall_buffer_wipe_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>brick-<wbr></wbr>wall buffer wipe)</a></td></tr><tr><td align="right">2.252 </td><td><a href="#%28part.__pv-mag-smear_buffer_bins_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>mag-<wbr></wbr>smear buffer bins)</a></td></tr><tr><td align="right">2.253 </td><td><a href="#%28part.__pv-mag-above_buffer_threshold_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>mag-<wbr></wbr>above buffer threshold)</a></td></tr><tr><td align="right">2.254 </td><td><a href="#%28part.__pv-bin-shift_buffer_stretch_shift_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>bin-<wbr></wbr>shift buffer stretch shift)</a></td></tr><tr><td align="right">2.255 </td><td><a href="#%28part.__fft_buffer_in_hop_wintype_active_%29" class="tocviewlink" data-pltdoc="x">(fft buffer in hop wintype active)</a></td></tr><tr><td align="right">2.256 </td><td><a href="#%28part.__pv-bin-wipe_buffer.A_buffer.B_wipe_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>bin-<wbr></wbr>wipe buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B wipe)</a></td></tr><tr><td align="right">2.257 </td><td><a href="#%28part.__pv-copy.Phase_buffer.A_buffer.B_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>copy<span class="mywbr"> </span>Phase buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B)</a></td></tr><tr><td align="right">2.258 </td><td><a href="#%28part.__pv-phase-shift90_buffer_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>phase-<wbr></wbr>shift90 buffer)</a></td></tr><tr><td align="right">2.259 </td><td><a href="#%28part.__convolution2_in_bufnum_trigger_framesize_______.Strict_convolution_with_fixed_kernel_which_can_be_updated_using_a_trigger_signal___in________-_processing_target_bufnum____-_buffer_index_for_the_fixed_kernel__may_be_modulated_in_____________combination_with_the_trigger_trigger___-_update_the_kernel_on_a_change_from__~3d0_to__0_framesize_-_size_of_fft_frame__must_be_a_power_of_two__convolution_____________uses_twice_this_number_internally__maximum_value_you_____________can_give_this_argument_is_2_16~3d65536__.Note_that_it_gets_____________progressively_more_expensive_to_run_for_higher_powers______________512__1024__2048__4096_standard________with-sc3___lambda__fd______for-each______lambda__b_________async_fd__b-alloc_b_2048_1_________list_10_11_12_______for-each______lambda__n_________send_fd__b-set1_10_______400_n__100__1_________enum-from-to_0_2_______for-each______lambda__n_________send_fd__b-set1_11_______20_n__10___random_0_1__________enum-from-to_0_49_______for-each______lambda__n_________send_fd__b-set1_12_______40_n__20__1_________enum-from-to_0_19_______send-synth_____fd__c_______letc___k_0___t_0__________let___i__impulse_ar_1_0_____________out_0__mul__convolution2_i_k_t_2048__0_5__________define_send-to____lambda__m_______with-sc3_______lambda__fd__________send_fd_m________define_async-to____lambda__m_______with-sc3_______l
|
||
|
|
||
|
#|
|
||
|
|
||
|
Strict convolution with fixed kernel which can be updated using a
|
||
|
trigger signal.
|
||
|
|
||
|
in -<wbr></wbr> processing target
|
||
|
bufnum -<wbr></wbr> buffer index for the fixed kernel, may be modulated in
|
||
|
combination with the trigger
|
||
|
trigger -<wbr></wbr> update the kernel on a change from <=0 to >0
|
||
|
framesize -<wbr></wbr> size of fft frame, must be a power of two. convolution
|
||
|
uses twice this number internally, maximum value you
|
||
|
can give this argument is 2^16=65536. Note that it gets
|
||
|
progressively more expensive to run for higher powers!
|
||
|
512, 1024, 2048, 4096 standard.
|
||
|
|
||
|
|#
|
||
|
|
||
|
(with-<wbr></wbr>sc3
|
||
|
(lambda (fd)
|
||
|
(for-<wbr></wbr>each
|
||
|
(lambda (b)
|
||
|
(async fd (b-<wbr></wbr>alloc b 2048 1)))
|
||
|
(list 10 11 12))
|
||
|
(for-<wbr></wbr>each
|
||
|
(lambda (n)
|
||
|
(send fd (b-<wbr></wbr>set1 10 (+<span class="mywbr"> </span> (* 400 n) 100) 1)))
|
||
|
(enum-<wbr></wbr>from-<wbr></wbr>to 0 2))
|
||
|
(for-<wbr></wbr>each
|
||
|
(lambda (n)
|
||
|
(send fd (b-<wbr></wbr>set1 11 (+<span class="mywbr"> </span> (* 20 n) 10) (random 0 1))))
|
||
|
(enum-<wbr></wbr>from-<wbr></wbr>to 0 49))
|
||
|
(for-<wbr></wbr>each
|
||
|
(lambda (n)
|
||
|
(send fd (b-<wbr></wbr>set1 12 (+<span class="mywbr"> </span> (* 40 n) 20) 1)))
|
||
|
(enum-<wbr></wbr>from-<wbr></wbr>to 0 19))
|
||
|
(send-<wbr></wbr>synth
|
||
|
fd "c"
|
||
|
(letc ((k 0) (t 0))
|
||
|
(let ((i (impulse ar 1 0)))
|
||
|
(out 0 (mul (convolution2 i k t 2048) 0.5)))))))
|
||
|
|
||
|
(define send-<wbr></wbr>to
|
||
|
(lambda (m)
|
||
|
(with-<wbr></wbr>sc3
|
||
|
(lambda (fd)
|
||
|
(send fd m)))))
|
||
|
|
||
|
(define async-<wbr></wbr>to
|
||
|
(lambda (m)
|
||
|
(with-<wbr></wbr>sc3
|
||
|
(lambda (fd)
|
||
|
(async fd m)))))
|
||
|
|
||
|
(send-<wbr></wbr>to (s-<wbr></wbr>new1 "c" 1001 1 1 "k" 10))
|
||
|
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "k" 11))
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "t" 0))
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "t" 1))
|
||
|
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "k" 12))
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "t" 0))
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "t" 1))
|
||
|
|
||
|
(async-<wbr></wbr>to (b-<wbr></wbr>zero 12))
|
||
|
|
||
|
(for-<wbr></wbr>each
|
||
|
(lambda (n)
|
||
|
(send-<wbr></wbr>to (b-<wbr></wbr>set1 12 (+<span class="mywbr"> </span> (* 20 n) 10) 1)))
|
||
|
(enum-<wbr></wbr>from-<wbr></wbr>to 0 39))
|
||
|
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "t" 0))
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "t" 1))</a></td></tr><tr><td align="right">2.260 </td><td><a href="#%28part.__pv-rect-comb2_buffer.A_buffer.B_num.Teeth_phase_width_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>rect-<wbr></wbr>comb2 buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B num<span class="mywbr"> </span>Teeth phase width)</a></td></tr><tr><td align="right">2.261 </td><td><a href="#%28part.__pv-add_buffer.A_buffer.B_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>add buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B)</a></td></tr><tr><td align="right">2.262 </td><td><a href="#%28part.__pv-rand-comb_buffer_wipe_trig_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>rand-<wbr></wbr>comb buffer wipe trig)</a></td></tr><tr><td align="right">2.263 </td><td><a href="#%28part.__pv-local-max_buffer_threshold_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>local-<wbr></wbr>max buffer threshold)</a></td></tr><tr><td align="right">2.264 </td><td><a href="#%28part.__pv-mag-mul_buffer.A_buffer.B_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>mag-<wbr></wbr>mul buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B)</a></td></tr><tr><td align="right">2.265 </td><td><a href="#%28part.__pv-conformal-map_buffer_real_imag_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>conformal-<wbr></wbr>map buffer real imag)</a></td></tr><tr><td align="right">2.266 </td><td><a href="#%28part.__pv-diffuser_buffer_trig_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>diffuser buffer trig)</a></td></tr><tr><td align="right">2.267 </td><td><a href="#%28part.__pv-max_buffer.A_buffer.B_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>max buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B)</a></td></tr><tr><td align="right">2.268 </td><td><a href="#%28part.__.Ifft_buffer_wintype_%29" class="tocviewlink" data-pltdoc="x">(Ifft buffer wintype)</a></td></tr><tr><td align="right">2.269 </td><td><a href="#%28part.__pv-bin-scramble_buffer_wipe_width_trig_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>bin-<wbr></wbr>scramble buffer wipe width trig)</a></td></tr><tr><td align="right">2.270 </td><td><a href="#%28part.__pv-rand-wipe_buffer.A_buffer.B_wipe_trig_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>rand-<wbr></wbr>wipe buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B wipe trig)</a></td></tr><tr><td align="right">2.271 </td><td><a href="#%28part.__.Packfft_chain_bufsize_frombin_tobin_zeroothers_magsphases_%29" class="tocviewlink" data-pltdoc="x">(Packfft chain bufsize frombin tobin zeroothers magsphases)</a></td></tr><tr><td align="right">2.272 </td><td><a href="#%28part.__pvcollect_chain_numframes_func_frombin_tobin_zeroothers_%29" class="tocviewlink" data-pltdoc="x">(pvcollect chain numframes func frombin tobin zeroothers)</a></td></tr><tr><td align="right">2.273 </td><td><a href="#%28part.__.P.V_.Magclip_buffer_threshold_%29" class="tocviewlink" data-pltdoc="x">(PV_<span class="mywbr"> </span>Magclip buffer threshold)</a></td></tr><tr><td align="right">2.274 </td><td><a href="#%28part.__.P.V_.Magfreeze_buffer_freeze_%29" class="tocviewlink" data-pltdoc="x">(PV_<span class="mywbr"> </span>Magfreeze buffer freeze)</a></td></tr><tr><td align="right">2.275 </td><td><a href="#%28part.__pv-rect-comb_buffer_num.Teeth_phase_width____with-sc3___lambda__fd______async_fd__b-alloc_10_2048_1_______let____dup__lambda__a___mce2_a_a____________x__mouse-x_kr_0_0_5_0_0_1___________y__mouse-y_kr_0_0_5_0_0_1___________n__dup__mul__white-noise_ar__0_3____________c__pv-rect-comb__fft__10_n__8_x_y_______audition__out_0__ifft__c_______let____dup__lambda__a___mce2_a_a____________p__mul-add__lf-tri_kr_0_097_0__0_4_0_5___________w__mul-add__lf-tri_kr_0_24_0__-0_5_0_5___________n__dup__mul__white-noise_ar__0_3____________c__pv-rec
|
||
|
|
||
|
(with-<wbr></wbr>sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-<wbr></wbr>alloc 10 2048 1))))
|
||
|
|
||
|
(let* ((dup (lambda (a) (mce2 a a)))
|
||
|
(x (mouse-<wbr></wbr>x kr 0 0.5 0 0.1))
|
||
|
(y (mouse-<wbr></wbr>y kr 0 0.5 0 0.1))
|
||
|
(n (dup (mul (white-<wbr></wbr>noise ar) 0.3)))
|
||
|
(c (pv-<wbr></wbr>rect-<wbr></wbr>comb (fft* 10 n) 8 x y)))
|
||
|
(audition (out 0 (ifft* c))))
|
||
|
|
||
|
(let* ((dup (lambda (a) (mce2 a a)))
|
||
|
(p (mul-<wbr></wbr>add (lf-<wbr></wbr>tri kr 0.097 0) 0.4 0.5))
|
||
|
(w (mul-<wbr></wbr>add (lf-<wbr></wbr>tri kr 0.24 0) -<wbr></wbr>0.5 0.5))
|
||
|
(n (dup (mul (white-<wbr></wbr>noise ar) 0.3)))
|
||
|
(c (pv-<wbr></wbr>rect-<wbr></wbr>comb (fft* 10 n) 8 p w)))
|
||
|
(audition (out 0 (ifft* c))))</a></td></tr><tr><td align="right">2.276 </td><td><a href="#%28part.__pv-mag-shift_buffer_stretch_shift_%29" class="tocviewlink" data-pltdoc="x">(pv-<wbr></wbr>mag-<wbr></wbr>shift buffer stretch shift)</a></td></tr><tr><td align="right">2.277 </td><td><a href="#%28part._.See_allpass-n%29" class="tocviewlink" data-pltdoc="x">See allpass-<wbr></wbr>n</a></td></tr><tr><td align="right">2.278 </td><td><a href="#%28part._.See_comb-n%29" class="tocviewlink" data-pltdoc="x">See comb-<wbr></wbr>n</a></td></tr><tr><td align="right">2.279 </td><td><a href="#%28part._.See_.Bufallpass-c%29" class="tocviewlink" data-pltdoc="x">See Bufallpass-<wbr></wbr>c</a></td></tr><tr><td align="right">2.280 </td><td><a href="#%28part.__free-verb_in_mix_room_damp_%29" class="tocviewlink" data-pltdoc="x">(free-<wbr></wbr>verb in mix room damp)</a></td></tr><tr><td align="right">2.281 </td><td><a href="#%28part._.See_free.Verb%29" class="tocviewlink" data-pltdoc="x">See free<span class="mywbr"> </span>Verb</a></td></tr><tr><td align="right">2.282 </td><td><a href="#%28part.__play-buf_num.Channels_bufnum_rate_trigger_start.Pos_loop_%29" class="tocviewlink" data-pltdoc="x">(play-<wbr></wbr>buf num<span class="mywbr"> </span>Channels bufnum rate trigger start<span class="mywbr"> </span>Pos loop)</a></td></tr><tr><td align="right">2.283 </td><td><a href="#%28part._.See_buf-delay-c%29" class="tocviewlink" data-pltdoc="x">See buf-<wbr></wbr>delay-<wbr></wbr>c</a></td></tr><tr><td align="right">2.284 </td><td><a href="#%28part.__delay2_in_%29" class="tocviewlink" data-pltdoc="x">(delay2 in)</a></td></tr><tr><td align="right">2.285 </td><td><a href="#%28part.__comb-n_in_max.Delay.Time_delay.Time_decay.Time_%29" class="tocviewlink" data-pltdoc="x">(comb-<wbr></wbr>n in max<span class="mywbr"> </span>Delay<span class="mywbr"> </span>Time delay<span class="mywbr"> </span>Time decay<span class="mywbr"> </span>Time)</a></td></tr><tr><td align="right">2.286 </td><td><a href="#%28part._.See_.Bufallpass-c%29" class="tocviewlink" data-pltdoc="x">See Bufallpass-<wbr></wbr>c</a></td></tr><tr><td align="right">2.287 </td><td><a href="#%28part.__allpass-n_in_max.Delay.Time_delay.Time_decay.Time_%29" class="tocviewlink" data-pltdoc="x">(allpass-<wbr></wbr>n in max<span class="mywbr"> </span>Delay<span class="mywbr"> </span>Time delay<span class="mywbr"> </span>Time decay<span class="mywbr"> </span>Time)</a></td></tr><tr><td align="right">2.288 </td><td><a href="#%28part._.See_comb-n%29" class="tocviewlink" data-pltdoc="x">See comb-<wbr></wbr>n</a></td></tr><tr><td align="right">2.289 </td><td><a href="#%28part.__buf-allpass-c_buf_in_delaytime_decaytime_%29" class="tocviewlink" data-pltdoc="x">(buf-<wbr></wbr>allpass-<wbr></wbr>c buf in delaytime decaytime)</a></td></tr><tr><td align="right">2.290 </td><td><a href="#%28part._.See_allpass-n%29" class="tocviewlink" data-pltdoc="x">See allpass-<wbr></wbr>n</a></td></tr><tr><td align="right">2.291 </td><td><a href="#%28part._.See_buf-delay-c%29" class="tocviewlink" data-pltdoc="x">See buf-<wbr></wbr>delay-<wbr></wbr>c</a></td></tr><tr><td align="right">2.292 </td><td><a href="#%28part.__buf-delay-c_buf_in_delaytime_%29" class="tocviewlink" data-pltdoc="x">(buf-<wbr></wbr>delay-<wbr></wbr>c buf in delaytime)</a></td></tr><tr><td align="right">2.293 </td><td><a href="#%28part.__pluck_in_tr_maxdelaytime_delaytime_decaytime_coef_%29" class="tocviewlink" data-pltdoc="x">(pluck in tr maxdelaytime delaytime decaytime coef)</a></td></tr><tr><td align="right">2.294 </td><td><a href="#%28part.__pitch-shift_in_win.Size_pch.Ratio_pch.Dispersion_time.Dispersion_%29" class="tocviewlink" data-pltdoc="x">(pitch-<wbr></wbr>shift in win<span class="mywbr"> </span>Size pch<span class="mywbr"> </span>Ratio pch<span class="mywbr"> </span>Dispersion time<span class="mywbr"> </span>Dispersion)</a></td></tr><tr><td align="right">2.295
|
||
|
|
||
|
(import (rsc3))
|
||
|
|
||
|
(audition (out 0 (mul (f-<wbr></wbr>sin-<wbr></wbr>osc ar (mce2 440 550) 0) 0.05)))
|
||
|
|
||
|
(let ((f (x-<wbr></wbr>line kr 200 4000 1 remove-<wbr></wbr>synth)))
|
||
|
(audition (out 0 (mul (f-<wbr></wbr>sin-<wbr></wbr>osc ar f 0) 0.25))))</a></td></tr><tr><td><span class="tocsublinknumber">2.103<tt> </tt></span><a href="#%28part.__v-osc_rate_bufpos_freq_phase_%29" class="tocsubseclink" data-pltdoc="x">(v-<wbr></wbr>osc rate bufpos freq phase)</a></td></tr><tr><td><span class="tocsublinknumber">2.104<tt> </tt></span><a href="#%28part.__var-saw_rate_freq_iphasewidth_%29" class="tocsubseclink" data-pltdoc="x">(var-<wbr></wbr>saw rate freq iphasewidth)</a></td></tr><tr><td><span class="tocsublinknumber">2.105<tt> </tt></span><a href="#%28part.__import__sosc___rsc3_____let___a__letc___r_1_______________let____r___mul__buf-rate-scale_kr_0__r______________________p__phasor_ar_0_r__0__buf-frames_kr_0__0______________________f__mul-add__lf-noise1_kr_2__300_400______________________i__mul__sin-osc_ar_f_0__0_1__________________mrg2__buf-wr_0_p_1_i______________________out_0_0_0_____________b__letc___r_1_______________let____r___mul__buf-rate-scale_kr_0__r______________________p__phasor_ar_0_r__0__buf-frames_kr_0__0__________________out_0__buf-rd_1_ar_0_p_1_2__________with-sc3_____lambda__fd________async_fd__b-alloc_0____44100_2__1_________send-synth_fd__a__a________send-synth_fd__b__b________send_fd__s-new0__a__1001_1_0_________send_fd__s-new0__b__1002_1_0________define__do-send_m_____with-sc3__lambda__fd___send_fd_m_______do-send__n-set1_1002__r__5_____do-send__n-set1_1001__r___random_0_2______do-send__n-set1_1002__r__2__%29" class="tocsubseclink" data-pltdoc="x">(import (sosc) (rsc3))
|
||
|
|
||
|
(let ((a (letc ((r 1))
|
||
|
(let* ((r* (mul (buf-<wbr></wbr>rate-<wbr></wbr>scale kr 0) r))
|
||
|
(p (phasor ar 0 r* 0 (buf-<wbr></wbr>frames kr 0) 0))
|
||
|
(f (mul-<wbr></wbr>add (lf-<wbr></wbr>noise1 kr 2) 300 400))
|
||
|
(i (mul (sin-<wbr></wbr>osc ar f 0) 0.1)))
|
||
|
(mrg2 (buf-<wbr></wbr>wr 0 p 1 i)
|
||
|
(out 0 0.0)))))
|
||
|
(b (letc ((r 1))
|
||
|
(let* ((r* (mul (buf-<wbr></wbr>rate-<wbr></wbr>scale kr 0) r))
|
||
|
(p (phasor ar 0 r* 0 (buf-<wbr></wbr>frames kr 0) 0)))
|
||
|
(out 0 (buf-<wbr></wbr>rd 1 ar 0 p 1 2))))))
|
||
|
(with-<wbr></wbr>sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-<wbr></wbr>alloc 0 (* 44100 2) 1))
|
||
|
(send-<wbr></wbr>synth fd "a" a)
|
||
|
(send-<wbr></wbr>synth fd "b" b)
|
||
|
(send fd (s-<wbr></wbr>new0 "a" 1001 1 0))
|
||
|
(send fd (s-<wbr></wbr>new0 "b" 1002 1 0)))))
|
||
|
|
||
|
(define (do-<wbr></wbr>send m)
|
||
|
(with-<wbr></wbr>sc3 (lambda (fd) (send fd m))))
|
||
|
|
||
|
(do-<wbr></wbr>send (n-<wbr></wbr>set1 1002 "r" 5))
|
||
|
|
||
|
(do-<wbr></wbr>send (n-<wbr></wbr>set1 1001 "r" (random 0 2)))
|
||
|
|
||
|
(do-<wbr></wbr>send (n-<wbr></wbr>set1 1002 "r" 2))</a></td></tr><tr><td><span class="tocsublinknumber">2.106<tt> </tt></span><a href="#%28part.__import__rsc3_____audition__out_0__mul__impulse_ar_800_0__0_1______let___f__x-line_kr_800_10_5_remove-synth_______audition__out_0__mul__impulse_ar_f_0_0__0_5_______let___f__mouse-y__kr_4_8_0_0_1__________p__mouse-x__kr_0_1_0_0_1_______audition__out_0__mul__impulse_ar_f__mce2_0_p___0_2____%29" class="tocsubseclink" data-pltdoc="x">(import (rsc3))
|
||
|
|
||
|
(audition (out 0 (mul (impulse ar 800 0) 0.1)))
|
||
|
|
||
|
(let ((f (x-<wbr></wbr>line kr 800 10 5 remove-<wbr></wbr>synth)))
|
||
|
(audition (out 0 (mul (impulse ar f 0.0) 0.5))))
|
||
|
|
||
|
(let ((f (mouse-<wbr></wbr>y* kr 4 8 0 0.1))
|
||
|
(p (mouse-<wbr></wbr>x* kr 0 1 0 0.1)))
|
||
|
(audition (out 0 (mul (impulse ar f (mce2 0 p)) 0.2))))</a></td></tr><tr><td><span class="tocsublinknumber">2.107<tt> </tt></span><a href="#%28part.__import__rsc3_____audition__out_0__mul__blip_ar_440_200__0_15___%29" class="tocsubseclink" data-pltdoc="x">(import (rsc3))
|
||
|
|
||
|
(audition (out 0 (mul (blip ar 440 200) 0.15)))</a></td></tr><tr><td><span class="tocsublinknumber">2.108<tt> </tt></span><a href="#%28part.__select_which_array_%29" class="tocsubseclink" data-pltdoc="x">(select which array)</a></td></tr><tr><td><span class="tocsublinknumber">2.109<tt> </tt></span><a href="#%28part.__import__rsc3__%29" class="tocsubseclink" data-pltdoc="x">(import (rsc3))</a></td></tr><tr><td><span class="tocsublinknumber">2.110<tt> </tt></span><a href="#%28part.__import__rsc3_____with-sc3___lambda__fd______async_fd__b-alloc_10_512_1_______async_fd__b-gen1_10__sine1___list____1_2_4__1_1_2_1_3_1_4_1_5_1_6_1_7_1_8_1_9_1_10________audition__out_0__mul__c-osc_ar_10_200_0_7__0_25______audition__out_0__mul__c-osc_ar_10_200__mouse-x__kr_0_4_0_0_1___0_25___%29" class="tocsubseclink" data-pltdoc="x">(import (rsc3))
|
||
|
|
||
|
(with-<wbr></wbr>sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-<wbr></wbr>alloc 10 512 1))
|
||
|
(async fd (b-<wbr></wbr>gen1 10 "sine1" (list (+<span class="mywbr"> </span> 1 2 4) 1 1/<span class="mywbr"> </span>2 1/<span class="mywbr"> </span>3 1/<span class="mywbr"> </span>4 1/<span class="mywbr"> </span>5 1/<span class="mywbr"> </span>6 1/<span class="mywbr"> </span>7 1/<span class="mywbr"> </span>8 1/<span class="mywbr"> </span>9 1/<span class="mywbr"> </span>10)))))
|
||
|
|
||
|
(audition (out 0 (mul (c-<wbr></wbr>osc ar 10 200 0.7) 0.25)))
|
||
|
|
||
|
(audition (out 0 (mul (c-<wbr></wbr>osc ar 10 200 (mouse-<wbr></wbr>x* kr 0 4 0 0.1)) 0.25)))</a></td></tr><tr><td><span class="tocsublinknumber">2.111<tt> </tt></span><a href="#%28part.__v-osc3_rate_bufpos_freq1_freq2_freq3_%29" class="tocsubseclink" data-pltdoc="x">(v-<wbr></wbr>osc3 rate bufpos freq1 freq2 freq3)</a></td></tr><tr><td><span class="tocsublinknumber">2.112<tt> </tt></span><a href="#%28part.__lf-cub_rate_freq_iphase_%29" class="tocsubseclink" data-pltdoc="x">(lf-<wbr></wbr>cub rate freq iphase)</a></td></tr><tr><td><span class="tocsublinknumber">2.113<tt> </tt></span><a href="#%28part.__lf-pulse_rate_freq_iphase_width_%29" class="tocsubseclink" data-pltdoc="x">(lf-<wbr></wbr>pulse rate freq iphase width)</a></td></tr><tr><td><span class="tocsublinknumber">2.114<tt> </tt></span><a href="#%28part.__import__sosc___rsc3__%29" class="tocsubseclink" data-pltdoc="x">(import (sosc) (rsc3))</a></td></tr><tr><td><span class="tocsublinknumber">2.115<tt> </tt></span><a href="#%28part._.See_lf-cub_%29" class="tocsubseclink" data-pltdoc="x">See lf-<wbr></wbr>cub.</a></td></tr><tr><td><span class="tocsublinknumber">2.116<tt> </tt></span><a href="#%28part.__sync-saw_rate_sync.Freq_saw.Freq_%29" class="tocsubseclink" data-pltdoc="x">(sync-<wbr></wbr>saw rate sync<span class="mywbr"> </span>Freq saw<span class="mywbr"> </span>Freq)</a></td></tr><tr><td><span class="tocsublinknumber">2.117<tt> </tt></span><a href="#%28part.__t-choose_trig_array_%29" class="tocsubseclink" data-pltdoc="x">(t-<wbr></wbr>choose trig array)</a></td></tr><tr><td><span class="tocsublinknumber">2.118<tt> </tt></span><a href="#%28part.__sin-osc_rate_freq_phase_%29" class="tocsubseclink" data-pltdoc="x">(sin-<wbr></wbr>osc rate freq phase)</a></td></tr><tr><td><span class="tocsublinknumber">2.119<tt> </tt></span><a href="#%28part.__klang_rate_freq.Scale_freq.Offset_spec_%29" class="tocsubseclink" data-pltdoc="x">(klang rate freq<span class="mywbr"> </span>Scale freq<span class="mywbr"> </span>Offset spec)</a></td></tr><tr><td><span class="tocsublinknumber">2.120<tt> </tt></span><a href="#%28part.__lag-in_num-channels_bus_lag_%29" class="tocsubseclink" data-pltdoc="x">(lag-<wbr></wbr>in num-<wbr></wbr>channels bus lag)</a></td></tr><tr><td><span class="tocsublinknumber">2.121<tt> </tt></span><a href="#%28part.__sound-in_channel_%29" class="tocsubseclink" data-pltdoc="x">(sound-<wbr></wbr>in channel)</a></td></tr><tr><td><span class="tocsublinknumber">2.122<tt> </tt></span><a href="#%28part.__in_num-channels_rate_bus_%29" class="tocsubseclink" data-pltdoc="x">(in num-<wbr></wbr>channels rate bus)</a></td></tr><tr><td><span class="tocsublinknumber">2.123<tt> </tt></span><a href="#%28part.__in-trig_num-channels_bus_%29" class="tocsubseclink" data-pltdoc="x">(in-<wbr></wbr>trig num-<wbr></wbr>channels bus)</a></td></tr><tr><td><span class="tocsublinknumber">2.124<tt> </tt></span><a href="#%28part.__replace-out_bufferindex_inputs_%29" class="tocsubseclink" data-pltdoc="x">(replace-<wbr></wbr>out bufferindex inputs)</a></td></tr><tr><td><span class="tocsublinknumber">2.125<tt> </tt></span><a href="#%28part.__local-in_num-channels_rate_%29" class="tocsubseclink" data-pltdoc="x">(local-<wbr></wbr>in num-<wbr></wbr>channels rate)</a></td></tr><tr><td><span class="tocsublinknumber">2.126<tt> </tt></span><a href="#%28part.__offset-out_bufferindex_inputs_%29" class="tocsubseclink" data-pltdoc="x">(offset-<wbr></wbr>out bufferindex inputs)</a></td></tr><tr><td><span class="tocsublinknumber">2.127<tt> </tt></span><a href="#%28part.__in-feedback_num-channels_bus_%29" class="tocsubseclink" data-pltdoc="x">(in-<wbr></wbr>feedback num-<wbr></wbr>channels bus)</a></td></tr><tr><td><span class="tocsublinknumber">2.128<tt> </tt></span><a href="#%28part.__x-out_buffer-index_xfade_inputs_%29" class="tocsubseclink" data-pltdoc="x">(x-<wbr></wbr>out buffer-<wbr></wbr>index xfade inputs)</a></td></tr><tr><td><span class="tocsublinknumber">2.129<tt> </tt></spa
|
||
|
|
||
|
(let ((n 6)
|
||
|
(o (lambda (_<span class="mywbr"> </span>) (mul (f-<wbr></wbr>sin-<wbr></wbr>osc ar (rand 200 700) 0) 0.1))))
|
||
|
(audition (out 0 (mix-<wbr></wbr>fill n o))))</a></td></tr><tr><td><span class="tocsublinknumber">2.132<tt> </tt></span><a href="#%28part.__latch_in_trig_%29" class="tocsubseclink" data-pltdoc="x">(latch in trig)</a></td></tr><tr><td><span class="tocsublinknumber">2.133<tt> </tt></span><a href="#%28part.__decay_in_decay.Time_%29" class="tocsubseclink" data-pltdoc="x">(decay in decay<span class="mywbr"> </span>Time)</a></td></tr><tr><td><span class="tocsublinknumber">2.134<tt> </tt></span><a href="#%28part.__wrap-index_bufnum_in_%29" class="tocsubseclink" data-pltdoc="x">(wrap-<wbr></wbr>index bufnum in)</a></td></tr><tr><td><span class="tocsublinknumber">2.135<tt> </tt></span><a href="#%28part.__mouse-y_rate_minval_maxval_warp_lag_%29" class="tocsubseclink" data-pltdoc="x">(mouse-<wbr></wbr>y rate minval maxval warp lag)</a></td></tr><tr><td><span class="tocsublinknumber">2.136<tt> </tt></span><a href="#%28part.__degree-to-key_bufnum_in_octave_%29" class="tocsubseclink" data-pltdoc="x">(degree-<wbr></wbr>to-<wbr></wbr>key bufnum in octave)</a></td></tr><tr><td><span class="tocsublinknumber">2.137<tt> </tt></span><a href="#%28part.__key-state_rate_keynum_minval_maxval_lag_%29" class="tocsubseclink" data-pltdoc="x">(key-<wbr></wbr>state rate keynum minval maxval lag)</a></td></tr><tr><td><span class="tocsublinknumber">2.138<tt> </tt></span><a href="#%28part.__mrg2_left_right_%29" class="tocsubseclink" data-pltdoc="x">(mrg2 left right)</a></td></tr><tr><td><span class="tocsublinknumber">2.139<tt> </tt></span><a href="#%28part.__mouse-button_rate_minval_maxval_lag_%29" class="tocsubseclink" data-pltdoc="x">(mouse-<wbr></wbr>button rate minval maxval lag)</a></td></tr><tr><td><span class="tocsublinknumber">2.140<tt> </tt></span><a href="#%28part.__slew_in_up_dn_%29" class="tocsubseclink" data-pltdoc="x">(slew in up dn)</a></td></tr><tr><td><span class="tocsublinknumber">2.141<tt> </tt></span><a href="#%28part.__mouse-x_rate_minval_maxval_warp_lag_%29" class="tocsubseclink" data-pltdoc="x">(mouse-<wbr></wbr>x rate minval maxval warp lag)</a></td></tr><tr><td><span class="tocsublinknumber">2.142<tt> </tt></span><a href="#%28part.__decay2_in_attack.Time_decay.Time_%29" class="tocsubseclink" data-pltdoc="x">(decay2 in attack<span class="mywbr"> </span>Time decay<span class="mywbr"> </span>Time)</a></td></tr><tr><td><span class="tocsublinknumber">2.143<tt> </tt></span><a href="#%28part.__k2a_in_%29" class="tocsubseclink" data-pltdoc="x">(k2a in)</a></td></tr><tr><td><span class="tocsublinknumber">2.144<tt> </tt></span><a href="#%28part.__mul-add_a_b_c_%29" class="tocsubseclink" data-pltdoc="x">(mul-<wbr></wbr>add a b c)</a></td></tr><tr><td><span class="tocsublinknumber">2.145<tt> </tt></span><a href="#%28part.__clip2_a_b_%29" class="tocsubseclink" data-pltdoc="x">(clip2 a b)</a></td></tr><tr><td><span class="tocsublinknumber">2.146<tt> </tt></span><a href="#%28part.__.Atan2_x_y_%29" class="tocsubseclink" data-pltdoc="x">(Atan2 x y)</a></td></tr><tr><td><span class="tocsublinknumber">2.147<tt> </tt></span><a href="#%28part.__trunc_a_b_%29" class="tocsubseclink" data-pltdoc="x">(trunc a b)</a></td></tr><tr><td><span class="tocsublinknumber">2.148<tt> </tt></span><a href="#%28part.__sub_a_b_%29" class="tocsubseclink" data-pltdoc="x">(sub a b)</a></td></tr><tr><td><span class="tocsublinknumber">2.149<tt> </tt></span><a href="#%28part.__round-up_a_b_%29" class="tocsubseclink" data-pltdoc="x">(round-<wbr></wbr>up a b)</a></td></tr><tr><td><span class="tocsublinknumber">2.150<tt> </tt></span><a href="#%28part.__ring4_a_b_%29" class="tocsubseclink" data-pltdoc="x">(ring4 a b)</a></td></tr><tr><td><span class="tocsublinknumber">2.151<tt> </tt></span><a href="#%28part.__pow_a_b_%29" class="tocsubseclink" data-pltdoc="x">(pow a b)</a></td></tr><tr><td><span class="tocsublinknumber">2.152<tt> </tt></span><a href="#%28part.__ring1_a_b_%29" class="tocsubseclink" data-pltdoc="x">(ring1 a b)</a></td></tr><tr><td><span cla
|
||
|
|
||
|
#|
|
||
|
|
||
|
fft feature detector for onset detection based on work described in
|
||
|
Jensen,K. & Andersen, T. H. (2003). Real-<wbr></wbr>time Beat Estimation Using
|
||
|
Feature Extraction. in Proceedings of the Computer Music Modeling and
|
||
|
Retrieval Symposium, Lecture Notes in Computer Science. springer
|
||
|
Verlag.
|
||
|
|
||
|
First order derivatives of the features are taken. Threshold may
|
||
|
need to be set low to pick up on changes.
|
||
|
|
||
|
buffer -<wbr></wbr> fft buffer to read from.
|
||
|
propsc -<wbr></wbr> Proportion of spectral centroid feature.
|
||
|
prophfe -<wbr></wbr> Proportion of high frequency energy feature.
|
||
|
prophfc -<wbr></wbr> Proportion of high frequency content feature.
|
||
|
propsf -<wbr></wbr> Proportion of spectral flux feature.
|
||
|
threshold -<wbr></wbr> Threshold level for allowing a detection
|
||
|
waittime -<wbr></wbr> If triggered, minimum wait until a further frame can
|
||
|
cause another spot (useful to stop multiple detects on
|
||
|
heavy signals)
|
||
|
|
||
|
Default values in sclang are:<span class="mywbr"> </span> propsc=0.25, prophfe=0.25,
|
||
|
prophfc=0.25, propsf=0.25, threshold=1.0, waittime=0.04.
|
||
|
|
||
|
|#
|
||
|
|
||
|
(with-<wbr></wbr>sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-<wbr></wbr>alloc 0 2048 1))))
|
||
|
|
||
|
(let* ((source (sound-<wbr></wbr>in 0))
|
||
|
(detect (pv-<wbr></wbr>jensen-<wbr></wbr>andersen (fft* 0 source)
|
||
|
0.25 0.25 0.25 0.25
|
||
|
(mouse-<wbr></wbr>x kr 0.01 1.0 1 0.1)
|
||
|
0.04)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-<wbr></wbr>osc ar (mce2 440 445) 0)
|
||
|
(decay (mul 0.1 detect) 0.1)))))</a></td></tr><tr><td><span class="tocsublinknumber">2.247<tt> </tt></span><a href="#%28part.__pv-phase-shift270_buffer_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>phase-<wbr></wbr>shift270 buffer)</a></td></tr><tr><td><span class="tocsublinknumber">2.248<tt> </tt></span><a href="#%28part.__pv-hainsworth-foote_buffer_proph_propf_threshold_waittime_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>hainsworth-<wbr></wbr>foote buffer proph propf threshold waittime)</a></td></tr><tr><td><span class="tocsublinknumber">2.249<tt> </tt></span><a href="#%28part.__pv-phase-shift_buffer_shift_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>phase-<wbr></wbr>shift buffer shift)</a></td></tr><tr><td><span class="tocsublinknumber">2.250<tt> </tt></span><a href="#%28part.__pv-copy_buffer.A_buffer.B_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>copy buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B)</a></td></tr><tr><td><span class="tocsublinknumber">2.251<tt> </tt></span><a href="#%28part.__pv-brick-wall_buffer_wipe_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>brick-<wbr></wbr>wall buffer wipe)</a></td></tr><tr><td><span class="tocsublinknumber">2.252<tt> </tt></span><a href="#%28part.__pv-mag-smear_buffer_bins_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>mag-<wbr></wbr>smear buffer bins)</a></td></tr><tr><td><span class="tocsublinknumber">2.253<tt> </tt></span><a href="#%28part.__pv-mag-above_buffer_threshold_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>mag-<wbr></wbr>above buffer threshold)</a></td></tr><tr><td><span class="tocsublinknumber">2.254<tt> </tt></span><a href="#%28part.__pv-bin-shift_buffer_stretch_shift_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>bin-<wbr></wbr>shift buffer stretch shift)</a></td></tr><tr><td><span class="tocsublinknumber">2.255<tt> </tt></span><a href="#%28part.__fft_buffer_in_hop_wintype_active_%29" class="tocsubseclink" data-pltdoc="x">(fft buffer in hop wintype active)</a></td></tr><tr><td><span class="tocsublinknumber">2.256<tt> </tt></span><a href="#%28part.__pv-bin-wipe_buffer.A_buffer.B_wipe_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>bin-<wbr></wbr>wipe buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B wipe)</a></td></tr><tr><td><span class="tocsublinknumber">2.257<tt> </tt></span><a href="#%28part.__pv-copy.Phase_buffer.A_buffer.B_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>copy<span class="mywbr"> </span>Phase buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B)</a></td></tr><tr><td><span class="tocsublinknumber">2.258<tt> </tt></span><a href="#%28part.__pv-phase-shift90_buffer_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>phase-<wbr></wbr>shift90 buffer)</a></td></tr><tr><td><span class="tocsublinknumber">2.259<tt> </tt></span><a href="#%28part.__convolution2_in_bufnum_trigger_framesize_______.Strict_convolution_with_fixed_kernel_which_can_be_updated_using_a_trigger_signal___in________-_processing_target_bufnum____-_buffer_index_for_the_fixed_kernel__may_be_modulated_in_____________combination_with_the_trigger_trigger___-_update_the_kernel_on_a_change_from__~3d0_to__0_framesize_-_size_of_fft_frame__must_be_a_power_of_two__convolution_____________uses_twice_this_number_internally__maximum_value_you_____________can_give_this_argument_is_2_16~3d65536__.Note_that_it_gets_____________progressively_more_expensive_to_run_for_higher_powers______________512__1024__2048__4096_standard________with-sc3___lambda__fd______for-each______lambda__b_________async_fd__b-alloc_b_2048_1_________list_10_11_12_______for-each______lambda__n_________send_fd__b-set1_10_______400_n__100__1_________enum-from-to_0_2_______for-each______lambda__n_________send_fd__b-set1_11_______20_n__10___random_0_1__________enum-from-to_0_49_______for-each______lambda__n_________send_fd__
|
||
|
|
||
|
#|
|
||
|
|
||
|
Strict convolution with fixed kernel which can be updated using a
|
||
|
trigger signal.
|
||
|
|
||
|
in -<wbr></wbr> processing target
|
||
|
bufnum -<wbr></wbr> buffer index for the fixed kernel, may be modulated in
|
||
|
combination with the trigger
|
||
|
trigger -<wbr></wbr> update the kernel on a change from <=0 to >0
|
||
|
framesize -<wbr></wbr> size of fft frame, must be a power of two. convolution
|
||
|
uses twice this number internally, maximum value you
|
||
|
can give this argument is 2^16=65536. Note that it gets
|
||
|
progressively more expensive to run for higher powers!
|
||
|
512, 1024, 2048, 4096 standard.
|
||
|
|
||
|
|#
|
||
|
|
||
|
(with-<wbr></wbr>sc3
|
||
|
(lambda (fd)
|
||
|
(for-<wbr></wbr>each
|
||
|
(lambda (b)
|
||
|
(async fd (b-<wbr></wbr>alloc b 2048 1)))
|
||
|
(list 10 11 12))
|
||
|
(for-<wbr></wbr>each
|
||
|
(lambda (n)
|
||
|
(send fd (b-<wbr></wbr>set1 10 (+<span class="mywbr"> </span> (* 400 n) 100) 1)))
|
||
|
(enum-<wbr></wbr>from-<wbr></wbr>to 0 2))
|
||
|
(for-<wbr></wbr>each
|
||
|
(lambda (n)
|
||
|
(send fd (b-<wbr></wbr>set1 11 (+<span class="mywbr"> </span> (* 20 n) 10) (random 0 1))))
|
||
|
(enum-<wbr></wbr>from-<wbr></wbr>to 0 49))
|
||
|
(for-<wbr></wbr>each
|
||
|
(lambda (n)
|
||
|
(send fd (b-<wbr></wbr>set1 12 (+<span class="mywbr"> </span> (* 40 n) 20) 1)))
|
||
|
(enum-<wbr></wbr>from-<wbr></wbr>to 0 19))
|
||
|
(send-<wbr></wbr>synth
|
||
|
fd "c"
|
||
|
(letc ((k 0) (t 0))
|
||
|
(let ((i (impulse ar 1 0)))
|
||
|
(out 0 (mul (convolution2 i k t 2048) 0.5)))))))
|
||
|
|
||
|
(define send-<wbr></wbr>to
|
||
|
(lambda (m)
|
||
|
(with-<wbr></wbr>sc3
|
||
|
(lambda (fd)
|
||
|
(send fd m)))))
|
||
|
|
||
|
(define async-<wbr></wbr>to
|
||
|
(lambda (m)
|
||
|
(with-<wbr></wbr>sc3
|
||
|
(lambda (fd)
|
||
|
(async fd m)))))
|
||
|
|
||
|
(send-<wbr></wbr>to (s-<wbr></wbr>new1 "c" 1001 1 1 "k" 10))
|
||
|
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "k" 11))
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "t" 0))
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "t" 1))
|
||
|
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "k" 12))
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "t" 0))
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "t" 1))
|
||
|
|
||
|
(async-<wbr></wbr>to (b-<wbr></wbr>zero 12))
|
||
|
|
||
|
(for-<wbr></wbr>each
|
||
|
(lambda (n)
|
||
|
(send-<wbr></wbr>to (b-<wbr></wbr>set1 12 (+<span class="mywbr"> </span> (* 20 n) 10) 1)))
|
||
|
(enum-<wbr></wbr>from-<wbr></wbr>to 0 39))
|
||
|
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "t" 0))
|
||
|
(send-<wbr></wbr>to (n-<wbr></wbr>set1 1001 "t" 1))</a></td></tr><tr><td><span class="tocsublinknumber">2.260<tt> </tt></span><a href="#%28part.__pv-rect-comb2_buffer.A_buffer.B_num.Teeth_phase_width_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>rect-<wbr></wbr>comb2 buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B num<span class="mywbr"> </span>Teeth phase width)</a></td></tr><tr><td><span class="tocsublinknumber">2.261<tt> </tt></span><a href="#%28part.__pv-add_buffer.A_buffer.B_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>add buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B)</a></td></tr><tr><td><span class="tocsublinknumber">2.262<tt> </tt></span><a href="#%28part.__pv-rand-comb_buffer_wipe_trig_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>rand-<wbr></wbr>comb buffer wipe trig)</a></td></tr><tr><td><span class="tocsublinknumber">2.263<tt> </tt></span><a href="#%28part.__pv-local-max_buffer_threshold_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>local-<wbr></wbr>max buffer threshold)</a></td></tr><tr><td><span class="tocsublinknumber">2.264<tt> </tt></span><a href="#%28part.__pv-mag-mul_buffer.A_buffer.B_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>mag-<wbr></wbr>mul buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B)</a></td></tr><tr><td><span class="tocsublinknumber">2.265<tt> </tt></span><a href="#%28part.__pv-conformal-map_buffer_real_imag_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>conformal-<wbr></wbr>map buffer real imag)</a></td></tr><tr><td><span class="tocsublinknumber">2.266<tt> </tt></span><a href="#%28part.__pv-diffuser_buffer_trig_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>diffuser buffer trig)</a></td></tr><tr><td><span class="tocsublinknumber">2.267<tt> </tt></span><a href="#%28part.__pv-max_buffer.A_buffer.B_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>max buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B)</a></td></tr><tr><td><span class="tocsublinknumber">2.268<tt> </tt></span><a href="#%28part.__.Ifft_buffer_wintype_%29" class="tocsubseclink" data-pltdoc="x">(Ifft buffer wintype)</a></td></tr><tr><td><span class="tocsublinknumber">2.269<tt> </tt></span><a href="#%28part.__pv-bin-scramble_buffer_wipe_width_trig_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>bin-<wbr></wbr>scramble buffer wipe width trig)</a></td></tr><tr><td><span class="tocsublinknumber">2.270<tt> </tt></span><a href="#%28part.__pv-rand-wipe_buffer.A_buffer.B_wipe_trig_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>rand-<wbr></wbr>wipe buffer<span class="mywbr"> </span>A buffer<span class="mywbr"> </span>B wipe trig)</a></td></tr><tr><td><span class="tocsublinknumber">2.271<tt> </tt></span><a href="#%28part.__.Packfft_chain_bufsize_frombin_tobin_zeroothers_magsphases_%29" class="tocsubseclink" data-pltdoc="x">(Packfft chain bufsize frombin tobin zeroothers magsphases)</a></td></tr><tr><td><span class="tocsublinknumber">2.272<tt> </tt></span><a href="#%28part.__pvcollect_chain_numframes_func_frombin_tobin_zeroothers_%29" class="tocsubseclink" data-pltdoc="x">(pvcollect chain numframes func frombin tobin zeroothers)</a></td></tr><tr><td><span class="tocsublinknumber">2.273<tt> </tt></span><a href="#%28part.__.P.V_.Magclip_buffer_threshold_%29" class="tocsubseclink" data-pltdoc="x">(PV_<span class="mywbr"> </span>Magclip buffer threshold)</a></td></tr><tr><td><span class="tocsublinknumber">2.274<tt> </tt></span><a href="#%28part.__.P.V_.Magfreeze_buffer_freeze_%29" class="tocsubseclink" data-pltdoc="x">(PV_<span class="mywbr"> </span>Magfreeze buffer freeze)</a></td></tr><tr><td><span class="tocsublinknumber">2.275<tt> </tt></span><a href="#%28part.__pv-rect-comb_buffer_num.Teeth_phase_width____with-sc3___lambda__fd______async_fd__b-alloc_10_2048_1_______let____dup__
|
||
|
|
||
|
(with-<wbr></wbr>sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-<wbr></wbr>alloc 10 2048 1))))
|
||
|
|
||
|
(let* ((dup (lambda (a) (mce2 a a)))
|
||
|
(x (mouse-<wbr></wbr>x kr 0 0.5 0 0.1))
|
||
|
(y (mouse-<wbr></wbr>y kr 0 0.5 0 0.1))
|
||
|
(n (dup (mul (white-<wbr></wbr>noise ar) 0.3)))
|
||
|
(c (pv-<wbr></wbr>rect-<wbr></wbr>comb (fft* 10 n) 8 x y)))
|
||
|
(audition (out 0 (ifft* c))))
|
||
|
|
||
|
(let* ((dup (lambda (a) (mce2 a a)))
|
||
|
(p (mul-<wbr></wbr>add (lf-<wbr></wbr>tri kr 0.097 0) 0.4 0.5))
|
||
|
(w (mul-<wbr></wbr>add (lf-<wbr></wbr>tri kr 0.24 0) -<wbr></wbr>0.5 0.5))
|
||
|
(n (dup (mul (white-<wbr></wbr>noise ar) 0.3)))
|
||
|
(c (pv-<wbr></wbr>rect-<wbr></wbr>comb (fft* 10 n) 8 p w)))
|
||
|
(audition (out 0 (ifft* c))))</a></td></tr><tr><td><span class="tocsublinknumber">2.276<tt> </tt></span><a href="#%28part.__pv-mag-shift_buffer_stretch_shift_%29" class="tocsubseclink" data-pltdoc="x">(pv-<wbr></wbr>mag-<wbr></wbr>shift buffer stretch shift)</a></td></tr><tr><td><span class="tocsublinknumber">2.277<tt> </tt></span><a href="#%28part._.See_allpass-n%29" class="tocsubseclink" data-pltdoc="x">See allpass-<wbr></wbr>n</a></td></tr><tr><td><span class="tocsublinknumber">2.278<tt> </tt></span><a href="#%28part._.See_comb-n%29" class="tocsubseclink" data-pltdoc="x">See comb-<wbr></wbr>n</a></td></tr><tr><td><span class="tocsublinknumber">2.279<tt> </tt></span><a href="#%28part._.See_.Bufallpass-c%29" class="tocsubseclink" data-pltdoc="x">See Bufallpass-<wbr></wbr>c</a></td></tr><tr><td><span class="tocsublinknumber">2.280<tt> </tt></span><a href="#%28part.__free-verb_in_mix_room_damp_%29" class="tocsubseclink" data-pltdoc="x">(free-<wbr></wbr>verb in mix room damp)</a></td></tr><tr><td><span class="tocsublinknumber">2.281<tt> </tt></span><a href="#%28part._.See_free.Verb%29" class="tocsubseclink" data-pltdoc="x">See free<span class="mywbr"> </span>Verb</a></td></tr><tr><td><span class="tocsublinknumber">2.282<tt> </tt></span><a href="#%28part.__play-buf_num.Channels_bufnum_rate_trigger_start.Pos_loop_%29" class="tocsubseclink" data-pltdoc="x">(play-<wbr></wbr>buf num<span class="mywbr"> </span>Channels bufnum rate trigger start<span class="mywbr"> </span>Pos loop)</a></td></tr><tr><td><span class="tocsublinknumber">2.283<tt> </tt></span><a href="#%28part._.See_buf-delay-c%29" class="tocsubseclink" data-pltdoc="x">See buf-<wbr></wbr>delay-<wbr></wbr>c</a></td></tr><tr><td><span class="tocsublinknumber">2.284<tt> </tt></span><a href="#%28part.__delay2_in_%29" class="tocsubseclink" data-pltdoc="x">(delay2 in)</a></td></tr><tr><td><span class="tocsublinknumber">2.285<tt> </tt></span><a href="#%28part.__comb-n_in_max.Delay.Time_delay.Time_decay.Time_%29" class="tocsubseclink" data-pltdoc="x">(comb-<wbr></wbr>n in max<span class="mywbr"> </span>Delay<span class="mywbr"> </span>Time delay<span class="mywbr"> </span>Time decay<span class="mywbr"> </span>Time)</a></td></tr><tr><td><span class="tocsublinknumber">2.286<tt> </tt></span><a href="#%28part._.See_.Bufallpass-c%29" class="tocsubseclink" data-pltdoc="x">See Bufallpass-<wbr></wbr>c</a></td></tr><tr><td><span class="tocsublinknumber">2.287<tt> </tt></span><a href="#%28part.__allpass-n_in_max.Delay.Time_delay.Time_decay.Time_%29" class="tocsubseclink" data-pltdoc="x">(allpass-<wbr></wbr>n in max<span class="mywbr"> </span>Delay<span class="mywbr"> </span>Time delay<span class="mywbr"> </span>Time decay<span class="mywbr"> </span>Time)</a></td></tr><tr><td><span class="tocsublinknumber">2.288<tt> </tt></span><a href="#%28part._.See_comb-n%29" class="tocsubseclink" data-pltdoc="x">See comb-<wbr></wbr>n</a></td></tr><tr><td><span class="tocsublinknumber">2.289<tt> </tt></span><a href="#%28part.__buf-allpass-c_buf_in_delaytime_decaytime_%29" class="tocsubseclink" data-pltdoc="x">(buf-<wbr></wbr>allpass-<wbr></wbr>c buf in delaytime decaytime)</a></td></tr><tr><td><span class="tocsublinknumber">2.290<tt> </tt></span><a href="#%28part._.See_allpass-n%29" class="tocsubseclink" data-pltdoc="x">See allpass-<wbr></wbr>n</a></td></tr><tr><td><span class="tocsublinknumber">2.291<tt> </tt></span><a href="#%28part._.See_buf-delay-c%29" class="tocsubseclink" data-pltdoc="x">See buf-<wbr></wbr>delay-<wbr></wbr>c</a></td></tr><tr><td><span class="tocsublinknumber">2.292<tt> </tt></span><a href="#%28part.__buf-delay-c_buf_in_delaytime_%29" class="tocsubseclink" data-pltdoc="x">(buf-<wbr></wbr>delay-<wbr></wbr>c buf in delaytime)</a></td></tr><tr><td><span class="tocsublinknumber">2.293<tt> </tt></span><a href="#%28part.__pluck_in_tr_maxdelaytime_delaytime_decaytime_coef_%29" class="tocsubseclink" data-pltdoc="x">(pluck in tr ma
|
||
|
|
||
|
(import (rsc3))
|
||
|
|
||
|
(audition (out 0 (mul (f-sin-osc ar (mce2 440 550) 0) 0.05)))
|
||
|
|
||
|
(let ((f (x-line kr 200 4000 1 remove-synth)))
|
||
|
(audition (out 0 (mul (f-sin-osc ar f 0) 0.25))))</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__v-osc_rate_bufpos_freq_phase_%29" class="toclink" data-pltdoc="x">2.103<span class="hspace"> </span>(v-osc rate bufpos freq phase)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__var-saw_rate_freq_iphasewidth_%29" class="toclink" data-pltdoc="x">2.104<span class="hspace"> </span>(var-saw rate freq iphasewidth)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__import__sosc___rsc3_____let___a__letc___r_1_______________let____r___mul__buf-rate-scale_kr_0__r______________________p__phasor_ar_0_r__0__buf-frames_kr_0__0______________________f__mul-add__lf-noise1_kr_2__300_400______________________i__mul__sin-osc_ar_f_0__0_1__________________mrg2__buf-wr_0_p_1_i______________________out_0_0_0_____________b__letc___r_1_______________let____r___mul__buf-rate-scale_kr_0__r______________________p__phasor_ar_0_r__0__buf-frames_kr_0__0__________________out_0__buf-rd_1_ar_0_p_1_2__________with-sc3_____lambda__fd________async_fd__b-alloc_0____44100_2__1_________send-synth_fd__a__a________send-synth_fd__b__b________send_fd__s-new0__a__1001_1_0_________send_fd__s-new0__b__1002_1_0________define__do-send_m_____with-sc3__lambda__fd___send_fd_m_______do-send__n-set1_1002__r__5_____do-send__n-set1_1001__r___random_0_2______do-send__n-set1_1002__r__2__%29" class="toclink" data-pltdoc="x">2.105<span class="hspace"> </span>(import (sosc) (rsc3))
|
||
|
|
||
|
(let ((a (letc ((r 1))
|
||
|
(let* ((r* (mul (buf-rate-scale kr 0) r))
|
||
|
(p (phasor ar 0 r* 0 (buf-frames kr 0) 0))
|
||
|
(f (mul-add (lf-noise1 kr 2) 300 400))
|
||
|
(i (mul (sin-osc ar f 0) 0.1)))
|
||
|
(mrg2 (buf-wr 0 p 1 i)
|
||
|
(out 0 0.0)))))
|
||
|
(b (letc ((r 1))
|
||
|
(let* ((r* (mul (buf-rate-scale kr 0) r))
|
||
|
(p (phasor ar 0 r* 0 (buf-frames kr 0) 0)))
|
||
|
(out 0 (buf-rd 1 ar 0 p 1 2))))))
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 0 (* 44100 2) 1))
|
||
|
(send-synth fd "a" a)
|
||
|
(send-synth fd "b" b)
|
||
|
(send fd (s-new0 "a" 1001 1 0))
|
||
|
(send fd (s-new0 "b" 1002 1 0)))))
|
||
|
|
||
|
(define (do-send m)
|
||
|
(with-sc3 (lambda (fd) (send fd m))))
|
||
|
|
||
|
(do-send (n-set1 1002 "r" 5))
|
||
|
|
||
|
(do-send (n-set1 1001 "r" (random 0 2)))
|
||
|
|
||
|
(do-send (n-set1 1002 "r" 2))</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__import__rsc3_____audition__out_0__mul__impulse_ar_800_0__0_1______let___f__x-line_kr_800_10_5_remove-synth_______audition__out_0__mul__impulse_ar_f_0_0__0_5_______let___f__mouse-y__kr_4_8_0_0_1__________p__mouse-x__kr_0_1_0_0_1_______audition__out_0__mul__impulse_ar_f__mce2_0_p___0_2____%29" class="toclink" data-pltdoc="x">2.106<span class="hspace"> </span>(import (rsc3))
|
||
|
|
||
|
(audition (out 0 (mul (impulse ar 800 0) 0.1)))
|
||
|
|
||
|
(let ((f (x-line kr 800 10 5 remove-synth)))
|
||
|
(audition (out 0 (mul (impulse ar f 0.0) 0.5))))
|
||
|
|
||
|
(let ((f (mouse-y* kr 4 8 0 0.1))
|
||
|
(p (mouse-x* kr 0 1 0 0.1)))
|
||
|
(audition (out 0 (mul (impulse ar f (mce2 0 p)) 0.2))))</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__import__rsc3_____audition__out_0__mul__blip_ar_440_200__0_15___%29" class="toclink" data-pltdoc="x">2.107<span class="hspace"> </span>(import (rsc3))
|
||
|
|
||
|
(audition (out 0 (mul (blip ar 440 200) 0.15)))</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__select_which_array_%29" class="toclink" data-pltdoc="x">2.108<span class="hspace"> </span>(select which array)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__import__rsc3__%29" class="toclink" data-pltdoc="x">2.109<span class="hspace"> </span>(import (rsc3))</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__import__rsc3_____with-sc3___lambda__fd______async_fd__b-alloc_10_512_1_______async_fd__b-gen1_10__sine1___list____1_2_4__1_1_2_1_3_1_4_1_5_1_6_1_7_1_8_1_9_1_10________audition__out_0__mul__c-osc_ar_10_200_0_7__0_25______audition__out_0__mul__c-osc_ar_10_200__mouse-x__kr_0_4_0_0_1___0_25___%29" class="toclink" data-pltdoc="x">2.110<span class="hspace"> </span>(import (rsc3))
|
||
|
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 512 1))
|
||
|
(async fd (b-gen1 10 "sine1" (list (+ 1 2 4) 1 1/2 1/3 1/4 1/5 1/6 1/7 1/8 1/9 1/10)))))
|
||
|
|
||
|
(audition (out 0 (mul (c-osc ar 10 200 0.7) 0.25)))
|
||
|
|
||
|
(audition (out 0 (mul (c-osc ar 10 200 (mouse-x* kr 0 4 0 0.1)) 0.25)))</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__v-osc3_rate_bufpos_freq1_freq2_freq3_%29" class="toclink" data-pltdoc="x">2.111<span class="hspace"> </span>(v-osc3 rate bufpos freq1 freq2 freq3)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__lf-cub_rate_freq_iphase_%29" class="toclink" data-pltdoc="x">2.112<span class="hspace"> </span>(lf-cub rate freq iphase)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__lf-pulse_rate_freq_iphase_width_%29" class="toclink" data-pltdoc="x">2.113<span class="hspace"> </span>(lf-pulse rate freq iphase width)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__import__sosc___rsc3__%29" class="toclink" data-pltdoc="x">2.114<span class="hspace"> </span>(import (sosc) (rsc3))</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part._.See_lf-cub_%29" class="toclink" data-pltdoc="x">2.115<span class="hspace"> </span>See lf-cub.</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__sync-saw_rate_sync.Freq_saw.Freq_%29" class="toclink" data-pltdoc="x">2.116<span class="hspace"> </span>(sync-saw rate syncFreq sawFreq)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__t-choose_trig_array_%29" class="toclink" data-pltdoc="x">2.117<span class="hspace"> </span>(t-choose trig array)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__sin-osc_rate_freq_phase_%29" class="toclink" data-pltdoc="x">2.118<span class="hspace"> </span>(sin-osc rate freq phase)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__klang_rate_freq.Scale_freq.Offset_spec_%29" class="toclink" data-pltdoc="x">2.119<span class="hspace"> </span>(klang rate freqScale freqOffset spec)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__lag-in_num-channels_bus_lag_%29" class="toclink" data-pltdoc="x">2.120<span class="hspace"> </span>(lag-in num-channels bus lag)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__sound-in_channel_%29" class="toclink" data-pltdoc="x">2.121<span class="hspace"> </span>(sound-in channel)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__in_num-channels_rate_bus_%29" class="toclink" data-pltdoc="x">2.122<span class="hspace"> </span>(in num-channels rate bus)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__in-trig_num-channels_bus_%29" class="toclink" data-pltdoc="x">2.123<span class="hspace"> </span>(in-trig num-channels bus)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__replace-out_bufferindex_inputs_%29" class="toclink" data-pltdoc="x">2.124<span class="hspace"> </span>(replace-out bufferindex inputs)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__local-in_num-channels_rate_%29" class="toclink" data-pltdoc="x">2.125<span class="hspace"> </span>(local-in num-channels rate)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__offset-out_bufferindex_inputs_%29" class="toclink" data-pltdoc="x">2.126<span class="hspace"> </span>(offset-out bufferindex inputs)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__in-feedback_num-channels_bus_%29" class="toclink" data-pltdoc="x">2.127<span class="hspace"> </span>(in-feedback num-channels bus)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28par
|
||
|
|
||
|
(let ((n 6)
|
||
|
(o (lambda (_) (mul (f-sin-osc ar (rand 200 700) 0) 0.1))))
|
||
|
(audition (out 0 (mix-fill n o))))</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__latch_in_trig_%29" class="toclink" data-pltdoc="x">2.132<span class="hspace"> </span>(latch in trig)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__decay_in_decay.Time_%29" class="toclink" data-pltdoc="x">2.133<span class="hspace"> </span>(decay in decayTime)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__wrap-index_bufnum_in_%29" class="toclink" data-pltdoc="x">2.134<span class="hspace"> </span>(wrap-index bufnum in)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__mouse-y_rate_minval_maxval_warp_lag_%29" class="toclink" data-pltdoc="x">2.135<span class="hspace"> </span>(mouse-y rate minval maxval warp lag)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__degree-to-key_bufnum_in_octave_%29" class="toclink" data-pltdoc="x">2.136<span class="hspace"> </span>(degree-to-key bufnum in octave)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__key-state_rate_keynum_minval_maxval_lag_%29" class="toclink" data-pltdoc="x">2.137<span class="hspace"> </span>(key-state rate keynum minval maxval lag)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__mrg2_left_right_%29" class="toclink" data-pltdoc="x">2.138<span class="hspace"> </span>(mrg2 left right)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__mouse-button_rate_minval_maxval_lag_%29" class="toclink" data-pltdoc="x">2.139<span class="hspace"> </span>(mouse-button rate minval maxval lag)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__slew_in_up_dn_%29" class="toclink" data-pltdoc="x">2.140<span class="hspace"> </span>(slew in up dn)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__mouse-x_rate_minval_maxval_warp_lag_%29" class="toclink" data-pltdoc="x">2.141<span class="hspace"> </span>(mouse-x rate minval maxval warp lag)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__decay2_in_attack.Time_decay.Time_%29" class="toclink" data-pltdoc="x">2.142<span class="hspace"> </span>(decay2 in attackTime decayTime)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__k2a_in_%29" class="toclink" data-pltdoc="x">2.143<span class="hspace"> </span>(k2a in)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__mul-add_a_b_c_%29" class="toclink" data-pltdoc="x">2.144<span class="hspace"> </span>(mul-add a b c)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__clip2_a_b_%29" class="toclink" data-pltdoc="x">2.145<span class="hspace"> </span>(clip2 a b)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__.Atan2_x_y_%29" class="toclink" data-pltdoc="x">2.146<span class="hspace"> </span>(Atan2 x y)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__trunc_a_b_%29" class="toclink" data-pltdoc="x">2.147<span class="hspace"> </span>(trunc a b)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__sub_a_b_%29" class="toclink" data-pltdoc="x">2.148<span class="hspace"> </span>(sub a b)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__round-up_a_b_%29" class="toclink" data-pltdoc="x">2.149<span class="hspace"> </span>(round-up a b)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__ring4_a_b_%29" cla
|
||
|
|
||
|
#|
|
||
|
|
||
|
fft feature detector for onset detection based on work described in
|
||
|
Jensen,K. & Andersen, T. H. (2003). Real-time Beat Estimation Using
|
||
|
Feature Extraction. in Proceedings of the Computer Music Modeling and
|
||
|
Retrieval Symposium, Lecture Notes in Computer Science. springer
|
||
|
Verlag.
|
||
|
|
||
|
First order derivatives of the features are taken. Threshold may
|
||
|
need to be set low to pick up on changes.
|
||
|
|
||
|
buffer - fft buffer to read from.
|
||
|
propsc - Proportion of spectral centroid feature.
|
||
|
prophfe - Proportion of high frequency energy feature.
|
||
|
prophfc - Proportion of high frequency content feature.
|
||
|
propsf - Proportion of spectral flux feature.
|
||
|
threshold - Threshold level for allowing a detection
|
||
|
waittime - If triggered, minimum wait until a further frame can
|
||
|
cause another spot (useful to stop multiple detects on
|
||
|
heavy signals)
|
||
|
|
||
|
Default values in sclang are: propsc=0.25, prophfe=0.25,
|
||
|
prophfc=0.25, propsf=0.25, threshold=1.0, waittime=0.04.
|
||
|
|
||
|
|#
|
||
|
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 0 2048 1))))
|
||
|
|
||
|
(let* ((source (sound-in 0))
|
||
|
(detect (pv-jensen-andersen (fft* 0 source)
|
||
|
0.25 0.25 0.25 0.25
|
||
|
(mouse-x kr 0.01 1.0 1 0.1)
|
||
|
0.04)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar (mce2 440 445) 0)
|
||
|
(decay (mul 0.1 detect) 0.1)))))</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-phase-shift270_buffer_%29" class="toclink" data-pltdoc="x">2.247<span class="hspace"> </span>(pv-phase-shift270 buffer)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-hainsworth-foote_buffer_proph_propf_threshold_waittime_%29" class="toclink" data-pltdoc="x">2.248<span class="hspace"> </span>(pv-hainsworth-foote buffer proph propf threshold waittime)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-phase-shift_buffer_shift_%29" class="toclink" data-pltdoc="x">2.249<span class="hspace"> </span>(pv-phase-shift buffer shift)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-copy_buffer.A_buffer.B_%29" class="toclink" data-pltdoc="x">2.250<span class="hspace"> </span>(pv-copy bufferA bufferB)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-brick-wall_buffer_wipe_%29" class="toclink" data-pltdoc="x">2.251<span class="hspace"> </span>(pv-brick-wall buffer wipe)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-mag-smear_buffer_bins_%29" class="toclink" data-pltdoc="x">2.252<span class="hspace"> </span>(pv-mag-smear buffer bins)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-mag-above_buffer_threshold_%29" class="toclink" data-pltdoc="x">2.253<span class="hspace"> </span>(pv-mag-above buffer threshold)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-bin-shift_buffer_stretch_shift_%29" class="toclink" data-pltdoc="x">2.254<span class="hspace"> </span>(pv-bin-shift buffer stretch shift)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__fft_buffer_in_hop_wintype_active_%29" class="toclink" data-pltdoc="x">2.255<span class="hspace"> </span>(fft buffer in hop wintype active)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-bin-wipe_buffer.A_buffer.B_wipe_%29" class="toclink" data-pltdoc="x">2.256<span class="hspace"> </span>(pv-bin-wipe bufferA bufferB wipe)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-copy.Phase_buffer.A_buffer.B_%29" class="toclink" data-pltdoc="x">2.257<span class="hspace"> </span>(pv-copyPhase bufferA bufferB)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-phase-shift90_buffer_%29" class="toclink" data-pltdoc="x">2.258<span class="hspace"> </span>(pv-phase-shift90 buffer)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__convolution2_in_bufnum_trigger_framesize_______.Strict_convolution_with_fixed_kernel_which_can_be_updated_using_a_trigger_signal___in________-_processing_target_bufnum____-_buffer_index_for_the_fixed_kernel__may_be_modulated_in_____________combination_with_the_trigger_trigger___-_update_the_kernel_on_a_change_from__~3d0_to__0_framesize_-_size_of_fft_frame__must_be_a_power_of_two__convolution_____________uses_twice_this_number_internally__maximum_value_you_____________can_give_this_argument_is_2_16~3d65536__.Note_that_it_gets_____________progressively_more_expensive_to_run_for_higher_powers______________512__1024__2048__4096_standard________with-sc3___lambda__fd______for-each______lambda__b_________async_fd__b-alloc_b_2048_1_________list_10_11_12_______for-each______lambda__n_________send_fd__b-set1_10_______400_n__100__1_________enum-from-to_0_2_______for-each______lambda__n_________send_fd__b-set1_11_______20_n__10___random_0_1__________enum-from-to_0_49_______for-each______lambda__n_________send_fd__b-set1_12_______40_n__20__1_________enum-from-to_
|
||
|
|
||
|
#|
|
||
|
|
||
|
Strict convolution with fixed kernel which can be updated using a
|
||
|
trigger signal.
|
||
|
|
||
|
in - processing target
|
||
|
bufnum - buffer index for the fixed kernel, may be modulated in
|
||
|
combination with the trigger
|
||
|
trigger - update the kernel on a change from <=0 to >0
|
||
|
framesize - size of fft frame, must be a power of two. convolution
|
||
|
uses twice this number internally, maximum value you
|
||
|
can give this argument is 2^16=65536. Note that it gets
|
||
|
progressively more expensive to run for higher powers!
|
||
|
512, 1024, 2048, 4096 standard.
|
||
|
|
||
|
|#
|
||
|
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(for-each
|
||
|
(lambda (b)
|
||
|
(async fd (b-alloc b 2048 1)))
|
||
|
(list 10 11 12))
|
||
|
(for-each
|
||
|
(lambda (n)
|
||
|
(send fd (b-set1 10 (+ (* 400 n) 100) 1)))
|
||
|
(enum-from-to 0 2))
|
||
|
(for-each
|
||
|
(lambda (n)
|
||
|
(send fd (b-set1 11 (+ (* 20 n) 10) (random 0 1))))
|
||
|
(enum-from-to 0 49))
|
||
|
(for-each
|
||
|
(lambda (n)
|
||
|
(send fd (b-set1 12 (+ (* 40 n) 20) 1)))
|
||
|
(enum-from-to 0 19))
|
||
|
(send-synth
|
||
|
fd "c"
|
||
|
(letc ((k 0) (t 0))
|
||
|
(let ((i (impulse ar 1 0)))
|
||
|
(out 0 (mul (convolution2 i k t 2048) 0.5)))))))
|
||
|
|
||
|
(define send-to
|
||
|
(lambda (m)
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send fd m)))))
|
||
|
|
||
|
(define async-to
|
||
|
(lambda (m)
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd m)))))
|
||
|
|
||
|
(send-to (s-new1 "c" 1001 1 1 "k" 10))
|
||
|
|
||
|
(send-to (n-set1 1001 "k" 11))
|
||
|
(send-to (n-set1 1001 "t" 0))
|
||
|
(send-to (n-set1 1001 "t" 1))
|
||
|
|
||
|
(send-to (n-set1 1001 "k" 12))
|
||
|
(send-to (n-set1 1001 "t" 0))
|
||
|
(send-to (n-set1 1001 "t" 1))
|
||
|
|
||
|
(async-to (b-zero 12))
|
||
|
|
||
|
(for-each
|
||
|
(lambda (n)
|
||
|
(send-to (b-set1 12 (+ (* 20 n) 10) 1)))
|
||
|
(enum-from-to 0 39))
|
||
|
|
||
|
(send-to (n-set1 1001 "t" 0))
|
||
|
(send-to (n-set1 1001 "t" 1))</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-rect-comb2_buffer.A_buffer.B_num.Teeth_phase_width_%29" class="toclink" data-pltdoc="x">2.260<span class="hspace"> </span>(pv-rect-comb2 bufferA bufferB numTeeth phase width)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-add_buffer.A_buffer.B_%29" class="toclink" data-pltdoc="x">2.261<span class="hspace"> </span>(pv-add bufferA bufferB)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-rand-comb_buffer_wipe_trig_%29" class="toclink" data-pltdoc="x">2.262<span class="hspace"> </span>(pv-rand-comb buffer wipe trig)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-local-max_buffer_threshold_%29" class="toclink" data-pltdoc="x">2.263<span class="hspace"> </span>(pv-local-max buffer threshold)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-mag-mul_buffer.A_buffer.B_%29" class="toclink" data-pltdoc="x">2.264<span class="hspace"> </span>(pv-mag-mul bufferA bufferB)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-conformal-map_buffer_real_imag_%29" class="toclink" data-pltdoc="x">2.265<span class="hspace"> </span>(pv-conformal-map buffer real imag)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-diffuser_buffer_trig_%29" class="toclink" data-pltdoc="x">2.266<span class="hspace"> </span>(pv-diffuser buffer trig)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-max_buffer.A_buffer.B_%29" class="toclink" data-pltdoc="x">2.267<span class="hspace"> </span>(pv-max bufferA bufferB)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__.Ifft_buffer_wintype_%29" class="toclink" data-pltdoc="x">2.268<span class="hspace"> </span>(Ifft buffer wintype)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-bin-scramble_buffer_wipe_width_trig_%29" class="toclink" data-pltdoc="x">2.269<span class="hspace"> </span>(pv-bin-scramble buffer wipe width trig)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-rand-wipe_buffer.A_buffer.B_wipe_trig_%29" class="toclink" data-pltdoc="x">2.270<span class="hspace"> </span>(pv-rand-wipe bufferA bufferB wipe trig)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__.Packfft_chain_bufsize_frombin_tobin_zeroothers_magsphases_%29" class="toclink" data-pltdoc="x">2.271<span class="hspace"> </span>(Packfft chain bufsize frombin tobin zeroothers magsphases)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pvcollect_chain_numframes_func_frombin_tobin_zeroothers_%29" class="toclink" data-pltdoc="x">2.272<span class="hspace"> </span>(pvcollect chain numframes func frombin tobin zeroothers)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__.P.V_.Magclip_buffer_threshold_%29" class="toclink" data-pltdoc="x">2.273<span class="hspace"> </span>(PV_Magclip buffer threshold)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__.P.V_.Magfreeze_buffer_freeze_%29" class="toclink" data-pltdoc="x">2.274<span class="hspace"> </span>(PV_Magfreeze buffer freeze)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-rect-comb_buffer_num.Teeth_phase_width____with-sc3___lambda__fd______async_fd__b-alloc_10_2048_1_______let____dup__lambda__a___mce2_a_a____________x__mouse-x_kr_0_0_5_0_0_1___________y__mouse-y_kr_0_0_5_0_0_1___________n__dup__mul__white-noise_ar__0_3____
|
||
|
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))))
|
||
|
|
||
|
(let* ((dup (lambda (a) (mce2 a a)))
|
||
|
(x (mouse-x kr 0 0.5 0 0.1))
|
||
|
(y (mouse-y kr 0 0.5 0 0.1))
|
||
|
(n (dup (mul (white-noise ar) 0.3)))
|
||
|
(c (pv-rect-comb (fft* 10 n) 8 x y)))
|
||
|
(audition (out 0 (ifft* c))))
|
||
|
|
||
|
(let* ((dup (lambda (a) (mce2 a a)))
|
||
|
(p (mul-add (lf-tri kr 0.097 0) 0.4 0.5))
|
||
|
(w (mul-add (lf-tri kr 0.24 0) -0.5 0.5))
|
||
|
(n (dup (mul (white-noise ar) 0.3)))
|
||
|
(c (pv-rect-comb (fft* 10 n) 8 p w)))
|
||
|
(audition (out 0 (ifft* c))))</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pv-mag-shift_buffer_stretch_shift_%29" class="toclink" data-pltdoc="x">2.276<span class="hspace"> </span>(pv-mag-shift buffer stretch shift)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part._.See_allpass-n%29" class="toclink" data-pltdoc="x">2.277<span class="hspace"> </span>See allpass-n</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part._.See_comb-n%29" class="toclink" data-pltdoc="x">2.278<span class="hspace"> </span>See comb-n</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part._.See_.Bufallpass-c%29" class="toclink" data-pltdoc="x">2.279<span class="hspace"> </span>See Bufallpass-c</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__free-verb_in_mix_room_damp_%29" class="toclink" data-pltdoc="x">2.280<span class="hspace"> </span>(free-verb in mix room damp)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part._.See_free.Verb%29" class="toclink" data-pltdoc="x">2.281<span class="hspace"> </span>See freeVerb</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__play-buf_num.Channels_bufnum_rate_trigger_start.Pos_loop_%29" class="toclink" data-pltdoc="x">2.282<span class="hspace"> </span>(play-buf numChannels bufnum rate trigger startPos loop)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part._.See_buf-delay-c%29" class="toclink" data-pltdoc="x">2.283<span class="hspace"> </span>See buf-delay-c</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__delay2_in_%29" class="toclink" data-pltdoc="x">2.284<span class="hspace"> </span>(delay2 in)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__comb-n_in_max.Delay.Time_delay.Time_decay.Time_%29" class="toclink" data-pltdoc="x">2.285<span class="hspace"> </span>(comb-n in maxDelayTime delayTime decayTime)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part._.See_.Bufallpass-c%29" class="toclink" data-pltdoc="x">2.286<span class="hspace"> </span>See Bufallpass-c</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__allpass-n_in_max.Delay.Time_delay.Time_decay.Time_%29" class="toclink" data-pltdoc="x">2.287<span class="hspace"> </span>(allpass-n in maxDelayTime delayTime decayTime)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part._.See_comb-n%29" class="toclink" data-pltdoc="x">2.288<span class="hspace"> </span>See comb-n</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__buf-allpass-c_buf_in_delaytime_decaytime_%29" class="toclink" data-pltdoc="x">2.289<span class="hspace"> </span>(buf-allpass-c buf in delaytime decaytime)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part._.See_allpass-n%29" class="toclink" data-pltdoc="x">2.290<span class="hspace"> </span>See allpass-n</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part._.See_buf-delay-c%29" class="toclink" data-pltdoc="x">2.291<span class="hspace"> </span>See buf-delay-c</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__buf-delay-c_buf_in_delaytime_%29" class="toclink" data-pltdoc="x">2.292<span class="hspace"> </span>(buf-delay-c buf in delaytime)</a></p></td></tr><tr><td><p><span class="hspace"> </span><a href="#%28part.__pluck_in_tr_maxdelaytime_delaytime_decaytime_coef_%29" class="toclink" data-pltdoc="x">2.293<span class="hspace"> </sp
|
||
|
(f2 (mul-add (f-sin-osc kr f1 0) 3600 4000)))
|
||
|
(audition
|
||
|
(out 0 (rlpf (mul (saw ar 200) 0.1) f2 0.2))))</p><h4>2.2<tt> </tt><a name="(part.__fold_in_lo_hi_)"></a>(fold in lo hi)</h4><p>fold a signal outside given thresholds.</p><p>This differs from the BinaryOpUGen fold2 in that it allows one to
|
||
|
set both low and high thresholds.</p><p>in - signal to be foldped
|
||
|
lo - low threshold of foldping
|
||
|
hi - high threshold of foldping</p><p>(let ((o (mul (sin-osc ar 440 0) 0.2))
|
||
|
(l (rand -0.175 -0.025))
|
||
|
(r (rand 0.025 0.175)))
|
||
|
(audition (out 0 (fold o l r))))</p><p>lo and hi are i-rate only.</p><p>(let ((o (mul (sin-osc ar 440 0) 0.2))
|
||
|
(x (mouse-x kr -0.175 -0.025 1 0.1))
|
||
|
(y (mouse-y kr 0.025 0.175 1 0.1)))
|
||
|
(audition (out 0 (fold o x y))))</p><h4>2.3<tt> </tt><a name="(part.__formlet_in_freq_attack.Time_decay.Time_)"></a>(formlet in freq attackTime decayTime)</h4><p>FOF-like filter</p><p>(let ((i (impulse ar 20 0.5)))
|
||
|
(audition (out 0 (formlet i 1000 0.01 0.1))))</p><p>(let* ((f (x-line kr 10 400 8 remove-synth))
|
||
|
(i (mul (blip ar f 1000) 0.1)))
|
||
|
(audition (out 0 (formlet i 1000 0.01 0.1))))</p><p>Modulating formant frequency.</p><p>(let ((i (mul (blip ar (mul-add (sin-osc kr 5 0) 20 300) 1000) 0.1))
|
||
|
(f (x-line kr 1500 700 8 remove-synth)))
|
||
|
(audition (out 0 (formlet i f 0.005 0.04))))</p><h4>2.4<tt> </tt><a name="(part.__lin-lin_in_srclo_srchi_dstlo_dsthi_)"></a>(lin-lin in srclo srchi dstlo dsthi)</h4><p>Map a linear range to another linear range.</p><p>in - input to convert - kr, ar
|
||
|
srclo - lower limit of input range - ir
|
||
|
srchi - upper limit of input range - ir
|
||
|
dstlo - lower limit of output range - ir
|
||
|
dsthi - upper limit of output range - ir</p><p>(audition
|
||
|
(out 0 (mul (sin-osc ar (lin-lin (mouse-x kr 0 1 0 0.1) 0 1 440 660) 0)
|
||
|
(lin-lin (mouse-y kr 0 1 0 0.1) 0 1 0.01 0.25))))</p><h4>2.5<tt> </tt><a name="(part.__fos_in_a0_a1_b1_)"></a>(fos in a0 a1 b1)</h4><p>First order filter section.</p><p>Same as one-pole.</p><p>(let ((x (mul (lf-tri ar 0.4 0) 0.99))
|
||
|
(i (mul (lf-saw ar 200 0) 0.2)))
|
||
|
(audition (out 0 (fos i (sub 1 (u:abs x)) 0 x))))</p><p>Same as one-zero</p><p>(let ((x (mul (lf-tri ar 0.4 0) 0.99))
|
||
|
(i (mul (lf-saw ar 200 0) 0.2)))
|
||
|
(audition (out 0 (fos i (sub 1 (u:abs x)) x 0))))</p><h4>2.6<tt> </tt><a name="(part.__bpf_in_freq_rq_)"></a>(bpf in freq rq)</h4><p>Second order Butterworth bandpass filter</p><p>in - input signal to be processed
|
||
|
freq - cutoff frequency in Hertz.
|
||
|
rq - the reciprocal of Q. bandwidth / cutoffFreq.</p><p>(let* ((f1 (x-line kr 0.7 300 20 remove-synth))
|
||
|
(f2 (mul-add (f-sin-osc kr f1 0) 3600 4000)))
|
||
|
(audition (out 0 (bpf (mul (saw ar 200) 0.25) f2 0.3))))</p><p>(let* ((f1 (mouse-x kr 220 440 0 0.1))
|
||
|
(f2 (mce2 f1 (sub 550 f1)))
|
||
|
(rq (mouse-y kr 0 0.01 0 0.1)))
|
||
|
(audition (out 0 (bpf (white-noise ar) f2 rq))))</p><h4>2.7<tt> </tt><a name="(part.__wrap_in_lo_hi_)"></a>(wrap in lo hi)</h4><p>wrap a signal outside given thresholds.</p><p>This differs from the BinaryOpUGen wrap2 in that it allows one to
|
||
|
set both low and high thresholds.</p><p>in - signal to be wrapped
|
||
|
lo - low threshold of wrapping
|
||
|
hi - high threshold of wrapping</p><p>(let ((o (mul (sin-osc ar 440 0) 0.2))
|
||
|
(l (rand -0.175 -0.025))
|
||
|
(r (rand 0.025 0.175)))
|
||
|
(audition (out 0 (wrap o l r))))</p><p>lo and hi are i-rate only.</p><p>(let ((o (mul (sin-osc ar 440 0) 0.2))
|
||
|
(x (mouse-x kr -0.175 -0.025 1 0.1))
|
||
|
(y (mouse-y kr 0.025 0.175 1 0.1)))
|
||
|
(audition (out 0 (wrap o x y))))</p><h4>2.8<tt> </tt><a name="(part.__bpz2_in_)"></a>(bpz2 in)</h4><p>Two zero fixed midpass. This filter cuts out 0 Hz and the Nyquist
|
||
|
frequency.</p><p>(audition (out 0 (bpz2 (mul (white-noise ar) 0.25))))</p><h4>2.9<tt> </tt><a name="(part.__amp-comp_freq_root_exp_)"></a>(amp-comp freq root exp)</h4><p>Basic psychoacoustic amplitude compensation.</p><p>Implements the (optimized) formula: compensationFactor = (root /
|
||
|
freq) ** exp. Higher frequencies are normally perceived as louder,
|
||
|
which amp-comp compensates.</p><p>See also amp-compA</p><p>freq - input frequency value. For freq == root, the output is 1.0.</p><p>root - root freq relative to which the curve is calculated (usually
|
||
|
lowest freq) default value: C (60.midicps)</p><p>exp - exponent. how steep the curve decreases for increasing freq
|
||
|
(see plots below). default value 0.3333</p><p>Note that for frequencies very much smaller than root the
|
||
|
amplitudes can become very high. in this case limit the freq with
|
||
|
freq.max(minval), or use amp-compA.</p><p>compare a sine without compensation with one that uses amplitude
|
||
|
compensation</p><p>(let* ((x (mouse-x kr 300 15000 1 0.1))
|
||
|
(y (mouse-y kr 0 1 0 0.1))
|
||
|
(o (mul (sin-osc ar x 0) 0.1))
|
||
|
(c (amp-comp x 300 0.333)))
|
||
|
(audition (out 0 (mce2 (mul o y) (mul3 o (sub 1 y) c)))))</p><p>different sounds cause quite different loudness perception, and the
|
||
|
desired musical behavior can vary, so the exponent can be tuned:</p><p>(let* ((x (mouse-x kr 300 15000 1 0.1))
|
||
|
(o (mul (pulse ar x 0.5) 0.1))
|
||
|
(c (amp-comp x 300 1.3)))
|
||
|
(audition (out 0 (mul o c))))</p><p>amplitude compensation in frequency modulation</p><p>(let* ((x (mouse-x kr 300 15000 1 0.1))
|
||
|
(y (mouse-y kr 3 200 1 0.1))
|
||
|
(m (mul x (mul-add (sin-osc ar y 0) 0.5 1)))
|
||
|
(a (amp-comp m 300 0.333))
|
||
|
(c (mul3 (sin-osc ar m 0) 0.1 a)))
|
||
|
(audition (out 0 c)))</p><h4>2.10<tt> </tt><a name="(part.__lag2_in_lag.Time_)"></a>(lag2 in lagTime)</h4><p>lag2 is the same as (lag kr (Lag kr in time) time).</p><p>(let* ((x (mouse-x kr 220 440 0 0.1))
|
||
|
(f (mce2 x (lag2 x 1))))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.11<tt> </tt><a name="(part.__one-zero_in_coef_)"></a>(one-zero in coef)</h4><p>One zero filter</p><p>(audition
|
||
|
(out 0 (one-zero (mul (white-noise ar) 0.5) 0.5)))</p><p>(audition
|
||
|
(out 0 (one-zero (mul (white-noise ar) 0.5) -0.5)))</p><p>(audition
|
||
|
(out 0 (one-zero (mul (white-noise ar) 0.5)
|
||
|
(line kr -0.5 0.5 10 remove-synth))))</p><h4>2.12<tt> </tt><a name="(part.__klank_in_freq.Scale_freq.Offset_decay.Scale_spec_)"></a>(klank in freqScale freqOffset decayScale spec)</h4><p>klank is a bank of fixed frequency resonators which can be used to
|
||
|
simulate the resonant modes of an object. Each mode is given a ring
|
||
|
time, which is the time for the mode to decay by 60 dB.</p><p>The UGen assistant klank-data can help create the ’spec’ entry.
|
||
|
Note that the SC3 language reorders the inputs, the RSC client does
|
||
|
not.</p><p>input - the excitation input to the resonant filter bank.</p><p>freqscale - a scale factor multiplied by all frequencies at
|
||
|
initialization time.</p><p>freqoffset - an offset added to all frequencies at initialization
|
||
|
time.</p><p>decayscale - a scale factor multiplied by all ring times at
|
||
|
initialization time.</p><p>(let ((i (mul (impulse ar 2 0) 0.1))
|
||
|
(d (klank-data ’(800 1071 1153 1723)
|
||
|
(replicate 5 1)
|
||
|
(replicate 5 1))))
|
||
|
(audition (out 0 (klank i 1 0 1 d))))</p><p>(let ((i (mul (dust ar 8) 0.1))
|
||
|
(d (klank-data ’(800 1071 1353 1723)
|
||
|
(replicate 4 1)
|
||
|
(replicate 4 1))))
|
||
|
(audition (out 0 (klank i 1 0 1 d))))</p><p>(let ((i (mul (pink-noise ar) 0.007))
|
||
|
(d (klank-data ’(800 1071 1353 1723)
|
||
|
(replicate 4 1)
|
||
|
(replicate 4 1))))
|
||
|
(audition (out 0 (klank i 1 0 1 d))))</p><p>(let ((i (mul (pink-noise ar) (mce2 0.007 0.007)))
|
||
|
(d (klank-data ’(200 671 1153 1723)
|
||
|
(replicate 4 1)
|
||
|
(replicate 4 1))))
|
||
|
(audition (out 0 (klank i 1 0 1 d))))</p><p>(let ((i (mul (decay (impulse ar 4 0) 0.03) (mul (clip-noise ar) 0.01)))
|
||
|
(d (klank-data (replicate-m 12 (rand 800 4000))
|
||
|
(replicate 12 1)
|
||
|
(replicate-m 12 (rand 0.1 2)))))
|
||
|
(audition (out 0 (klank i 1 0 1 d))))</p><h4>2.13<tt> </tt><a name="(part.__lpz2_ar_in_)"></a>(lpz2 ar in)</h4><p>Two zero fixed lowpass filter</p><p>(audition
|
||
|
(out 0 (lpz2 (mul (white-noise ar) 0.25))))</p><h4>2.14<tt> </tt><a name="(part.__lin-exp_in_srclo_srchi_dstlo_dsthi_)"></a>(lin-exp in srclo srchi dstlo dsthi)</h4><p>Map a linear range to an exponential range.</p><p>in - input to convert - kr, ar
|
||
|
srclo - lower limit of input range - ir
|
||
|
srchi - upper limit of input range - ir
|
||
|
dstlo - lower limit of output range - ir
|
||
|
dsthi - upper limit of output range - ir</p><p>(audition
|
||
|
(out 0 (mul (sin-osc ar (lin-exp (mouse-x kr 0 1 0 0.1) 0 1 440 660) 0)
|
||
|
(lin-exp (mouse-y kr 0 1 0 0.1) 0 1 0.01 0.25))))</p><h4>2.15<tt> </tt><a name="(part.__hpz2_in_)"></a>(hpz2 in)</h4><p>Two zero fixed highpass filter.</p><p>(audition (out 0 (hpz2 (mul (white-noise ar) 0.25))))</p><h4>2.16<tt> </tt><a name="(part.__leak-dc_in_coef_)"></a>(leak-dc in coef)</h4><p>Remove DC. This filter removes a DC offset from a signal.</p><p>in - input signal
|
||
|
coef - leak coefficient</p><p>(let ((a (mul (lf-pulse ar 800 0.5 0.5) 0.1)))
|
||
|
(audition (out 0 (mce2 a (leak-dc a 0.995)))))</p><h4>2.17<tt> </tt><a name="(part.__hpf_in_freq_)"></a>(hpf in freq)</h4><p>Second order Butterworth highpass filter.</p><p>(let* ((i (mul (saw ar 200) 0.1))
|
||
|
(f1 (x-line kr 0.7 300 20 do-nothing))
|
||
|
(f2 (mul-add (f-sin-osc kr f1 0) 3600 4000)))
|
||
|
(audition (out 0 (mul (hpf i f2) 5))))</p><h4>2.18<tt> </tt><a name="(part.__sos_in_a0_a1_a2_b1_b2_)"></a>(sos in a0 a1 a2 b1 b2)</h4><p>Second order filter section (biquad). A standard second order
|
||
|
filter section. Filter coefficients are given directly rather than
|
||
|
calculated for you.</p><p>Same as two-pole</p><p>(let* ((theta (line kr (* 0.2 pi) pi 5 remove-synth))
|
||
|
(rho (line kr 0.6 0.99 5 remove-synth))
|
||
|
(b1 (mul 2 (mul rho (u:cos theta))))
|
||
|
(b2 (neg (squared rho))))
|
||
|
(audition (out 0 (sos (lf-saw ar 200 0.1) 1 0 0 b1 b2))))</p><h4>2.19<tt> </tt><a name="(part.__normalizer_in_level_dur_)"></a>(normalizer in level dur)</h4><p>Flattens dynamics.</p><p>(let ((z (mul (decay2 (impulse ar 8 (mul (lf-saw kr 0.25 -0.6) 0.7))
|
||
|
0.001
|
||
|
0.3)
|
||
|
(f-sin-osc ar 500 0))))
|
||
|
(audition (out 0 (mce2 z (normalizer z 0.4 0.01)))))</p><h4>2.20<tt> </tt><a name="(part.__two-zero_in_freq_radius_)"></a>(two-zero in freq radius)</h4><p>Two zero filter</p><p>(audition
|
||
|
(out 0 (two-zero (mul (white-noise ar) 0.125)
|
||
|
(x-line kr 20 20000 8 remove-synth)
|
||
|
1)))</p><h4>2.21<tt> </tt><a name="(part.__clip_in_lo_hi_)"></a>(clip in lo hi)</h4><p>clip ‘in’ to lie between ‘lo’ and ‘hi’, which are i-rate inputs.</p><p>(audition (out 0 (clip (mul (sin-osc ar 440 0) 0.4) -0.25 0.25)))</p><h4>2.22<tt> </tt><a name="(part.__limiter_input_level_look.Ahead.Time_)"></a>(limiter input level lookAheadTime)</h4><p>peak limiter. Limits the input amplitude to the given
|
||
|
level. limiter will not overshoot like compander will, but it needs
|
||
|
to look ahead in the audio. Thus there is a delay equal to twice
|
||
|
the lookAheadTime. limiter, unlike compander, is completely
|
||
|
transparent for an in range signal.</p><p>(let* ((t (impulse ar 8 (mul (lf-saw kr 0.25 -0.6) 0.7)))
|
||
|
(i (mul (decay2 t 0.001 0.3) (f-sin-osc ar 500 0))))
|
||
|
(audition (out 0 (mce2 (mul i 0.1) (limiter i 0.2 0.01)))))</p><h4>2.23<tt> </tt><a name="(part.__median_length_in_)"></a>(median length in)</h4><p>median filter.</p><p>Signal with impulse noise.</p><p>(audition
|
||
|
(out 0 (median 3 (add (mul (saw ar 500) 0.1) (mul (dust2 ar 100) 0.9)))))</p><p>The median length can be increased for longer duration noise.</p><p>(audition
|
||
|
(out 0 (median 5 (add (mul (saw ar 500) 0.1) (lpz1 (mul (dust2 ar 100) 0.9))))))</p><p>Long median filters begin chopping off the peaks of the waveform</p><p>(audition
|
||
|
(out 0 (let ((x (mul (sin-osc ar 1000 0) 0.2)))
|
||
|
(mce2 x (median 31 x)))))</p><p>Another noise reduction application. Use median filter for high
|
||
|
frequency noise. Use leak-dc for low frequency noise.</p><p>(audition
|
||
|
(out 0 (let* ((s0 (mul-add (white-noise ar) 0.1 (mul (sin-osc ar 800 0) 0.1)))
|
||
|
(s1 (median 31 s0)))
|
||
|
(leak-dc s1 0.9))))</p><h4>2.24<tt> </tt><a name="(part.__lag3_in_lag.Time_)"></a>(lag3 in lagTime)</h4><p>lag3 is the same as (lag (Lag (Lag in time) time) time).</p><p>(let* ((x (mouse-x kr 220 440 0 0.1))
|
||
|
(f (mce2 x (lag3 x 1))))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.25<tt> </tt><a name="(part.__amp-comp.A_freq_root_min.Amp_root.Amp_)"></a>(amp-compA freq root minAmp rootAmp)</h4><p>ANSI A-weighting curve.</p><p>Basic psychoacoustic amplitude compensation</p><p>Higher frequencies are normally perceived as louder, which amp-compA
|
||
|
compensates. Following the measurings by Fletcher and Munson, the
|
||
|
ANSI standard describes a function for loudness vs. frequency.
|
||
|
Note that this curve is only valid for standardized amplitude.
|
||
|
For a simpler but more flexible curve, see amp-comp.</p><p>freq - input frequency value. For freq == root, the output is
|
||
|
rootAmp. (default freq 0 Hz)</p><p>root - root freq relative to which the curve is calculated (usually
|
||
|
lowest freq) (default 0 Hz) default value: C (60.midicps)</p><p>minAmp - amplitude at the minimum point of the curve (around 2512
|
||
|
Hz) (default -10dB)</p><p>rootAmp - amplitude at the root frequency. (default 1) apart from
|
||
|
freq, the values are not modulatable</p><p>compare a sine without compensation with one that uses amplitude
|
||
|
compensation</p><p>(let* ((x (mouse-x kr 300 15000 1 0.1))
|
||
|
(y (mouse-y kr 0 1 0 0.1))
|
||
|
(o (mul (sin-osc ar x 0) 0.1))
|
||
|
(c (amp-comp-a x 300 (db-amp -10) 1)))
|
||
|
(audition (out 0 (mce2 (mul o y) (mul3 o (sub 1 y) c)))))</p><p>adjust the minimum and root amp (in this way one can flatten out
|
||
|
the curve for higher amplitudes)</p><p>(let* ((x (mouse-x kr 300 18000 1 0.1))
|
||
|
(y (mouse-y kr 0 1 0 0.1))
|
||
|
(o (mul (formant ar 300 x 20) 0.1))
|
||
|
(c (amp-comp-a x 300 0.6 0.3)))
|
||
|
(audition (out 0 (mce2 (mul o y) (mul3 o (sub 1 y) c)))))</p><p>amplitude compensation in frequency modulation (using
|
||
|
Fletscher-Munson curve)</p><p>(let* ((x (mouse-x kr 300 15000 1 0.1))
|
||
|
(y (mouse-y kr 3 200 1 0.1))
|
||
|
(m (mul x (mul-add (sin-osc ar y 0) 0.5 1)))
|
||
|
(a (amp-comp-a m 300 (db-amp -10) 1))
|
||
|
(c (mul3 (sin-osc ar m 0) 0.1 a)))
|
||
|
(audition (out 0 c)))</p><h4>2.26<tt> </tt><a name="(part.__two-pole_in_freq_radius_)"></a>(two-pole in freq radius)</h4><p>Two pole filter. This provides lower level access to setting of
|
||
|
pole location. For general purposes resonz is better.</p><p>(audition
|
||
|
(out 0 (two-pole (mul (white-noise ar) 0.005) 2000 0.95)))</p><p>(audition
|
||
|
(out 0 (two-pole (mul (white-noise ar) 0.005)
|
||
|
(x-line kr 800 8000 8 remove-synth)
|
||
|
0.95)))</p><h4>2.27<tt> </tt><a name="(part.__lpf_in_freq_)"></a>(lpf in freq)</h4><p>Second order Butterworth lowpass filter.</p><p>(audition
|
||
|
(let ((f (x-line kr 0.7 300 20 remove-synth)))
|
||
|
(out 0 (lpf (mul (saw ar 200) 0.1)
|
||
|
(mul-add (f-sin-osc kr f 0) 3600 4000)))))</p><h4>2.28<tt> </tt><a name="(part.__hpz1_in_)"></a>(hpz1 in)</h4><p>Two point difference filter.</p><p>(audition (out 0 (hpz1 (mul (white-noise ar) 0.25))))</p><h4>2.29<tt> </tt><a name="(part.__freq-shift_input_shift_phase_)"></a>(freq-shift input shift phase)</h4><p>freq-shift implements single sideband amplitude modulation, also
|
||
|
known as frequency shifting, but not to be confused with pitch
|
||
|
shifting. Frequency shifting moves all the components of a signal
|
||
|
by a fixed amount but does not preserve the original harmonic
|
||
|
relationships.</p><p>input - audio input
|
||
|
shift - amount of shift in cycles per second
|
||
|
phase - phase of the frequency shift (0 - 2pi)</p><p>shifting a 100Hz tone by 1 Hz rising to 500Hz</p><p>(let ((i (sin-osc ar 100 0))
|
||
|
(s (x-line kr 1 500 5 remove-synth)))
|
||
|
(audition (out 0 (mul (freq-shift i s 0) 0.1))))</p><p>shifting a complex tone by 1 Hz rising to 500Hz</p><p>(let ((i (klang ar 1 0 (klang-data (list 101 303 606 808)
|
||
|
(replicate 4 1)
|
||
|
(replicate 4 1))))
|
||
|
(s (x-line kr 1 500 5 remove-synth)))
|
||
|
(audition (out 0 (mul (freq-shift i s 0) 0.1))))</p><p>modulating shift and phase</p><p>(let ((i (sin-osc ar 10 0))
|
||
|
(s (mul (lf-noise2 ar 0.3) 1500))
|
||
|
(p (lin-lin (sin-osc ar 500 0) -1 1 0 (* 2 pi))))
|
||
|
(audition (out 0 (mul (freq-shift i s p) 0.1))))</p><p>shifting bandpassed noise</p><p>(let ((i (bpf (white-noise ar) 1000 0.001))
|
||
|
(s (mul (lf-noise0 ar 5.5) 1000)))
|
||
|
(audition (out 0 (mul (freq-shift i s 0) 32))))</p><h4>2.30<tt> </tt><a name="(part.__lpz1_ar_in_)"></a>(lpz1 ar in)</h4><p>Two point average filter</p><p>(audition
|
||
|
(out 0 (lpz1 (mul (white-noise ar) 0.25))))</p><h4>2.31<tt> </tt><a name="(part.__moog-ff_in_freq_gain_reset_)"></a>(moog-ff in freq gain reset)</h4><p>Moog VCF implementation, designed by Federico Fontana. A digital
|
||
|
implementation of the Moog VCF (filter).</p><p>in - the input signal
|
||
|
freq - the cutoff frequency
|
||
|
gain - the filter resonance gain, between zero and 4
|
||
|
reset - when greater than zero, this will reset the
|
||
|
state of the digital filters at the beginning
|
||
|
of a computational block.</p><p>The design of this filter is described in the conference paper
|
||
|
Fontana, F. (2007) Preserving the Digital Structure of the Moog
|
||
|
VCF. in Proc. ICMC07, Copenhagen, 25-31 August 2007</p><p>(let ((n (mul (white-noise ar) 0.1))
|
||
|
(y (mouse-y kr 100 10000 1 0.1))
|
||
|
(x (mouse-x kr 0 4 0 0.1)))
|
||
|
(audition (out 0 (moog-ff n y x 0))))</p><p>(let* ((p (pulse ar (mce2 40 121) (mce2 0.3 0.7)))
|
||
|
(f0 (lin-lin (lf-noise0 kr 0.43) -1 1 0.001 2.2))
|
||
|
(f1 (lin-lin (sin-osc kr f0 0) -1 1 30 4200))
|
||
|
(y (mouse-y kr 1 4 0 0.1)))
|
||
|
(audition (out 0 (moog-ff p f1 (mul 0.83 y) 0))))</p><h4>2.32<tt> </tt><a name="(part.__resonz_in_freq_bwr_)"></a>(resonz in freq bwr)</h4><p>Resonant filter.</p><p>A two pole resonant filter with zeroes at z = +/- 1. Based on
|
||
|
K. Steiglitz, "A Note on Constant-Gain Digital Resonators,"
|
||
|
Computer Music Journal, vol 18, no. 4, pp. 8-10, Winter 1994. The
|
||
|
reciprocal of Q is used rather than Q because it saves a divide
|
||
|
operation inside the unit generator.</p><p>in - input signal to be processed
|
||
|
freq - resonant frequency in Hertz
|
||
|
rq - bandwidth ratio (reciprocal of Q). rq = bandwidth / centerFreq</p><p>(audition (out 0 (resonz (mul (white-noise ar) 0.5) 2000 0.1)))</p><p>Modulate frequency</p><p>(let ((f (x-line kr 1000 8000 10 remove-synth)))
|
||
|
(audition (out 0 (resonz (mul (white-noise ar) 0.5) f 0.05))))</p><p>Modulate bandwidth</p><p>(let ((rq (x-line kr 1 0.001 8 remove-synth)))
|
||
|
(audition (out 0 (resonz (mul (white-noise ar) 0.5) 2000 rq))))</p><p>Modulate bandwidth opposite direction</p><p>(let ((rq (x-line kr 0.001 1 8 remove-synth)))
|
||
|
(audition (out 0 (resonz (mul (white-noise ar) 0.5) 2000 rq))))</p><p>random resonator at a random location, run as often as you like...</p><p>(let ((freq (choose (map (lambda (z) (* z 120)) (enum-from-to 1 16))))
|
||
|
(bw 1/4)
|
||
|
(gain 8))
|
||
|
(audition (out 0 (pan2 (resonz (white-noise ar) freq (/ bw freq))
|
||
|
(rand -1 1)
|
||
|
gain))))</p><h4>2.33<tt> </tt><a name="(part.__brz2_in_)"></a>(brz2 in)</h4><p>A two zero fixed midcut filter. A special case fixed
|
||
|
filter. Implements the formula:</p><p>out(i) = 0.5 * (in(i) + in(i-2))</p><p>This filter cuts out frequencies around 1/2 of the Nyquist
|
||
|
frequency.</p><p>Compare:</p><p>(audition (out 0 (mul (white-noise ar) 0.15)))</p><p>(audition (out 0 (brz2 (mul (white-noise ar) 0.15))))</p><h4>2.34<tt> </tt><a name="(part.__.Rhpf_in_freq_rq_)"></a>(Rhpf in freq rq)</h4><p>A resonant high pass filter.</p><p>(audition
|
||
|
(out
|
||
|
0
|
||
|
(rhpf (mul (saw ar 200) 0.1)
|
||
|
(mul-add (f-sin-osc kr (x-line kr 0.7 300 20 remove-synth) 0) 3600 4000)
|
||
|
0.2)))</p><h4>2.35<tt> </tt><a name="(part.__brf_in_freq_rq_)"></a>(brf in freq rq)</h4><p>Second order Butterworth band reject filter.</p><p>(let* ((f1 (x-line kr 0.7 300 20 remove-synth))
|
||
|
(f2 (mul-add (f-sin-osc kr f1 0) 3600 4000)))
|
||
|
(audition (out 0 (brf (mul (saw ar 200) 0.1) f2 0.3))))</p><h4>2.36<tt> </tt><a name="(part.__one-pole_in_coef_)"></a>(one-pole in coef)</h4><p>A one pole filter. Implements the formula: out(i) = ((1 -
|
||
|
abs(coef)) * in(i)) + (coef * out(i-1)).</p><p>in - input signal to be processed
|
||
|
coef - feedback coefficient. Should be between -1 and +1</p><p>(audition
|
||
|
(out 0 (one-pole (mul (white-noise ar) 0.5) 0.95)))</p><p>(audition
|
||
|
(out 0 (one-pole (mul (white-noise ar) 0.5) -0.95)))</p><p>(audition
|
||
|
(out 0 (one-pole (mul (white-noise ar) 0.5)
|
||
|
(line kr -0.99 0.99 10 remove-synth))))</p><h4>2.37<tt> </tt><a name="(part.__lag_in_lag.Time_)"></a>(lag in lagTime)</h4><p>A simple averaging filter.</p><p>(let* ((x (mouse-x kr 220 440 0 0.1))
|
||
|
(f (mce2 x (lag x 1))))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.38<tt> </tt><a name="(part.__ringz_in_freq_decay.Time_)"></a>(ringz in freq decayTime)</h4><p>Ringing filter. This is the same as resonz, except that instead of
|
||
|
a resonance parameter, the bandwidth is specified in a 60dB ring
|
||
|
decay time. One ringz is equivalent to one component of the klank
|
||
|
UGen.</p><p>(audition
|
||
|
(out 0 (ringz (mul (dust ar 3) 0.3) 2000 2)))</p><p>(audition
|
||
|
(out 0 (ringz (mul (white-noise ar) 0.005) 2000 0.5)))</p><p>Modulate frequency</p><p>(audition
|
||
|
(out 0 (ringz (mul (white-noise ar) 0.005)
|
||
|
(x-line kr 100 3000 10 do-nothing)
|
||
|
0.5)))</p><p>(audition
|
||
|
(out 0 (ringz (mul (impulse ar 6 0) 0.3)
|
||
|
(x-line kr 100 3000 10 do-nothing)
|
||
|
0.5)))</p><p>Modulate ring time</p><p>(audition
|
||
|
(out 0 (ringz (mul (impulse ar 6 0) 0.3)
|
||
|
2000
|
||
|
(x-line kr 4 0.04 8 do-nothing))))</p><p>Modulate ring time opposite direction</p><p>(audition
|
||
|
(out 0 (ringz (mul (impulse ar 6 0) 0.3)
|
||
|
2000
|
||
|
(x-line kr 0.04 4 8 do-nothing))))</p><p>(audition
|
||
|
(out 0 (let ((n (mul (white-noise ar) 0.001)))
|
||
|
(mix-fill
|
||
|
10
|
||
|
(lambda (_)
|
||
|
(let ((f (x-line kr (rand 100 5000) (rand 100 5000) 20 do-nothing)))
|
||
|
(ringz n f 0.5)))))))</p><h4>2.39<tt> </tt><a name="(part.__dyn-klank_in_freq.Scale_freq.Offset_decay.Scale_spec_)"></a>(dyn-klank in freqScale freqOffset decayScale spec)</h4><p>Dynklank is a bank of frequency resonators which can be used to
|
||
|
simulate the resonant modes of an object. Each mode is given a ring
|
||
|
time, which is the time for the mode to decay by 60 dB.</p><p>Unlike klank, the parameters in specificationsArrayRef can be
|
||
|
changed after it has been started.</p><p>(let ((i (mul (impulse ar 2 0) 0.1))
|
||
|
(d (klank-data ’(800 1071 1153 1723)
|
||
|
(replicate 4 1)
|
||
|
(replicate 4 1))))
|
||
|
(audition (out 0 (dyn-klank i 1 0 1 d))))</p><p>(let ((i (mul (dust ar 8) 0.1))
|
||
|
(d (klank-data ’(800 1071 1353 1723)
|
||
|
(replicate 4 1)
|
||
|
(replicate 4 1))))
|
||
|
(audition (out 0 (dyn-klank i 1 0 1 d))))</p><p>(let* ((i (mul (impulse ar 3 0) 0.1))
|
||
|
(f (list 800 1071 1153 1723))
|
||
|
(r (list 1 1 1 1))
|
||
|
(x (mouse-x kr 0.5 2 1 0.1))
|
||
|
(y (mouse-y kr 0.1 10 1 0.1))
|
||
|
(d (klank-data (map (lambda (e) (mul e x)) f)
|
||
|
(replicate 4 1)
|
||
|
(map (lambda (e) (mul e y)) r))))
|
||
|
(audition (out 0 (dyn-klank i 1 0 1 d))))</p><p>(let* ((i (lambda (f)
|
||
|
(mul (impulse ar (lin-lin (lf-noise0 kr f) -1 1 3 12) 0) 0.1)))
|
||
|
(t (lambda (i d l r)
|
||
|
(map (lambda (e) (mul e (t-rand l r i))) d)))
|
||
|
(d (lambda (i f r)
|
||
|
(klank-data (t i f 0.5 2)
|
||
|
(replicate 4 1)
|
||
|
(t i r 0.1 10))))
|
||
|
(f1 (list 800 1071 1153 1723))
|
||
|
(f2 (list 786 1083 1169 1715))
|
||
|
(r1 (list 1 0.95 0.75 1.25))
|
||
|
(r2 (list 1 1.35 0.95 1.15))
|
||
|
(i1 (i 1.5))
|
||
|
(i2 (i 1.25)))
|
||
|
(audition (out 0 (mce2 (dyn-klank i1 1 0 1 (d i1 f1 r1))
|
||
|
(dyn-klank i2 1 0 1 (d i2 f2 r2))))))</p><h4>2.40<tt> </tt><a name="(part.__.Grainin_nc_tr_dur_in_pan_envbuf_)"></a>(Grainin nc tr dur in pan envbuf)</h4><p>Granulate an input signal</p><p>nc - the number of channels to output. If 1, mono is
|
||
|
returned and pan is ignored.</p><p>tr - a kr or ar trigger to start a new grain. If ar, grains
|
||
|
after the start of the synth are sample accurate.</p><p>The following args are polled at grain creation time</p><p>dur - size of the grain.</p><p>in - the input to granulate</p><p>pan - a value from -1 to 1. Determines where to pan the output in
|
||
|
the same manner as pan-az.</p><p>envbuf - the buffer number containing a singal to use for the
|
||
|
grain envelope. -1 uses a built-in Hanning envelope.</p><p>(let* ((x (mouse-x kr -0.5 0.5 0 0.1))
|
||
|
(y (mouse-y kr 5 25 0 0.1))
|
||
|
(n (pink-noise ar))
|
||
|
(t (impulse kr y 0)))
|
||
|
(audition (out 0 (mul (grain-in 2 t 0.1 n x -1) 0.1))))</p><h4>2.41<tt> </tt><a name="(part.__grain-buf_nc_tr_dur_sndbuf_rate_pos_interp_pan_envbuf_)"></a>(grain-buf nc tr dur sndbuf rate pos interp pan envbuf)</h4><p>Granular synthesis with sound stored in a buffer</p><p>nc - the number of channels to output. If 1, mono is returned and
|
||
|
pan is ignored.</p><p>tr - a kr or ar trigger to start a new grain. If ar, grains after
|
||
|
the start of the synth are sample accurate.</p><p>The following args are polled at grain creation time</p><p>dur - size of the grain.</p><p>sndbuf - the buffer holding an audio signal</p><p>rate - the playback rate of the sampled sound</p><p>pos - the playback position for the grain to start with (0 is
|
||
|
beginning, 1 is end of file)</p><p>interp - the interpolation method used for pitchshifting grains.
|
||
|
1 = no interpolation. 2 = linear. 4 = cubic interpolation
|
||
|
(more computationally intensive).</p><p>pan - a value from -1 to 1. Determines where to pan the output in
|
||
|
the same manner as pan-az.</p><p>envb - the buffer number containing a singal to use for the
|
||
|
grain envelope. -1 uses a built-in Hanning envelope.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc-read 10 "/home/rohan/audio/metal.wav" 0 0))
|
||
|
(let ((g (letc ((gate 1)
|
||
|
(amp 1)
|
||
|
(sndbuf 0)
|
||
|
(envbuf -1))
|
||
|
(let* ((x (mouse-x kr -1 1 0 0.1))
|
||
|
(y (mouse-y kr 10 45 0 0.1))
|
||
|
(i (impulse kr y 0))
|
||
|
(r (lin-lin (lf-noise1 kr 500) -1 1 0.5 2))
|
||
|
(p (lin-lin (lf-noise2 kr 0.1) -1 1 0 1)))
|
||
|
(out 0 (grain-buf 2 i 0.1 sndbuf r p 2 x envbuf))))))
|
||
|
(send-synth fd "g" g)
|
||
|
(send fd (s-new2 "g" -1 add-to-tail 1 "sndbuf" 10 "envbuf" -1)))))</p><h4>2.42<tt> </tt><a name="(part.__grain-sin_nc_tr_dur_freq_pan_envbuf_)"></a>(grain-sin nc tr dur freq pan envbuf)</h4><p>Granular synthesis with sine tones</p><p>nc - the number of channels to output. If 1, mono is returned and
|
||
|
pan is ignored.</p><p>tr - a kr or ar trigger to start a new grain. If ar, grains after
|
||
|
the start of the synth are sample accurate.</p><p>The following args are polled at grain creation time</p><p>dur - size of the grain.</p><p>freq - the input to granulate</p><p>pan - a value from -1 to 1. Determines where to pan the output in
|
||
|
the same manner as pan-az.</p><p>envbuf - the buffer number containing a singal to use for the grain
|
||
|
envelope. -1 uses a built-in Hanning envelope.</p><p>(let* ((x (mouse-x kr -0.5 0.5 0 0.1))
|
||
|
(y (mouse-y kr 0 400 0 0.1))
|
||
|
(n (white-noise kr))
|
||
|
(f (add 440 (mul n y)))
|
||
|
(t (impulse kr 10 0)))
|
||
|
(audition (out 0 (mul (grain-sin 2 t 0.1 f x -1) 0.1))))</p><h4>2.43<tt> </tt><a name="(part.__warp1_nc_buf_ptr_freq.Scale_window.Size_envbuf_overlaps_windowrand.Ratio_interp_)"></a>(warp1 nc buf ptr freqScale windowSize envbuf overlaps windowrandRatio interp)</h4><p>Warp a buffer with a time pointer</p><p>inspired by Chad Kirby’s SuperCollider2 warp1 class, which was
|
||
|
inspired by Richard Karpen’s sndwarp for CSound. A granular time
|
||
|
strecher and pitchshifter.</p><p>nc - the number of channels in the soundfile used in bufnum.</p><p>buf - the buffer number of a mono soundfile.</p><p>ptr - the position in the buffer. The value should be between 0
|
||
|
and 1, with 0 being the begining of the buffer, and 1 the
|
||
|
end.</p><p>freqScale - the amount of frequency shift. 1.0 is normal, 0.5 is
|
||
|
one octave down, 2.0 is one octave up. Negative values
|
||
|
play the soundfile backwards.</p><p>windowSize - the size of each grain window.</p><p>envbuf - the buffer number containing a singal to use for the grain
|
||
|
envelope. -1 uses a built-in Hanning envelope.</p><p>overlaps - the number of overlaping windows.</p><p>windowrandRatio - the amount of randomness to the windowing
|
||
|
function. Must be between 0 (no randomness) to
|
||
|
1.0 (probably to random actually)</p><p>interp - the interpolation method used for pitchshifting grains. 1
|
||
|
= no interpolation. 2 = linear. 4 = cubic interpolation
|
||
|
(more computationally intensive).</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc-read 10 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let* ((p (lin-lin (lf-saw kr 0.05 0) -1 1 0 1))
|
||
|
(x (mouse-x kr 0.5 2 0 0.1))
|
||
|
(w (warp1 1 10 p x 0.1 -1 8 0.1 2)))
|
||
|
(audition (out 0 w)))</p><h4>2.44<tt> </tt><a name="(part.__grain-fm_nc_tr_dur_carfreq_modfreq_index_pan_envbuf_)"></a>(grain-fm nc tr dur carfreq modfreq index pan envbuf)</h4><p>Granular synthesis with frequency modulated sine tones</p><p>nc - the number of channels to output. If 1, mono is returned and
|
||
|
pan is ignored.</p><p>tr - a kr or ar trigger to start a new grain. If ar, grains after
|
||
|
the start of the synth are sample accurate.</p><p>The following args are polled at grain creation time</p><p>dur - size of the grain.</p><p>carfreq - the carrier freq of the grain generators internal
|
||
|
oscillator</p><p>modfreq - the modulating freq of the grain generators internal
|
||
|
oscillator</p><p>index - the index of modulation</p><p>pan - a value from -1 to 1. Determines where to pan the output in
|
||
|
the same manner as pan-az.</p><p>envbuf - the buffer number containing a singal to use for the grain
|
||
|
envelope. -1 uses a built-in Hanning envelope.</p><p>(let* ((x (mouse-x kr -0.5 0.5 0 0.1))
|
||
|
(y (mouse-y kr 0 400 0 0.1))
|
||
|
(n (white-noise kr))
|
||
|
(fd (add 440 (mul n y)))
|
||
|
(t (impulse kr 10 0))
|
||
|
(i (lin-lin (lf-noise1 kr 500) -1 1 1 10)))
|
||
|
(audition (out 0 (mul (grain-fm 2 t 0.1 fd 200 i x -1) 0.1))))</p><h4>2.45<tt> </tt><a name="(part.__disk-in_num-channels_rate_bufnum_)"></a>(disk-in num-channels rate bufnum)</h4><p>Continously play a soundfile from disk. This requires a buffer to
|
||
|
be preloaded with one buffer size of sound. The buffer size must
|
||
|
be a multiple of twice the synth block size. The default block size
|
||
|
is 64.</p><p>Note that disk-in reads the number of outputs to create from what
|
||
|
looks like an input, but it is not an input, and cannot be set
|
||
|
using a control.</p><p>(let ((f "/home/rohan/audio/metal.wav")
|
||
|
(n 1))
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 0 8192 n))
|
||
|
(async fd (b-read 0 f 0 -1 0 1))
|
||
|
(play fd (out 0 (disk-in n ar 0))))))</p><p>(with-sc3 reset)</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-close 0))
|
||
|
(async fd (b-free 0))))</p><h4>2.46<tt> </tt><a name="(part.__disk-out_bufnum_channels_)"></a>(disk-out bufnum channels)</h4><p>Note: There are constraints on the size of the buffer, it must be
|
||
|
greater than or equal to twice the size of the audio bus. There
|
||
|
must be the same number of channels at the buffer and the disk-out
|
||
|
ugen.</p><p>(let ((bus-size 1024)
|
||
|
(bufferexpt 15))
|
||
|
(= 0 (fxand (expt 2 bufferexpt)
|
||
|
(- (fxarithmetic-shift bus-size 1) 1))))</p><p>(let ((g (letc ((bufnum 0))
|
||
|
(let ((z (clip2
|
||
|
(rlpf
|
||
|
(lf-pulse ar
|
||
|
(mul-add (sin-osc kr 0.2 0) 10 21)
|
||
|
(mce2 0 0.1)
|
||
|
0.1)
|
||
|
100
|
||
|
0.1)
|
||
|
0.4)))
|
||
|
(mrg2 (disk-out bufnum z)
|
||
|
(out 0 z))))))
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send-synth fd "disk-out-help" g)
|
||
|
(async fd (b-alloc 10 32768 2))
|
||
|
(async fd (b-write 10
|
||
|
"/tmp/test.aiff"
|
||
|
"aiff"
|
||
|
"float"
|
||
|
32768
|
||
|
0
|
||
|
1))
|
||
|
(send fd (s-new1 "disk-out-help" 1001 1 1 "bufnum" 10)))))</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send fd (n-free1 1001))
|
||
|
(async fd (b-close 10))
|
||
|
(async fd (b-free 10))))</p><p>(system "sndfile-info /tmp/test.aiff")
|
||
|
(system "jack.play /tmp/test.aiff")</p><h4>2.47<tt> </tt><a name="(part._num-input-buses)"></a>num-input-buses</h4><p>The number of audio buses allocated to input. input buses follow
|
||
|
output buses which begin at zero.</p><p>(let ((bus (add num-output-buses num-input-buses)))
|
||
|
(audition (mrg2 (out 0 (in 1 ar bus))
|
||
|
(out bus (mul (sin-osc ar 440 0) 0.1)))))</p><h4>2.48<tt> </tt><a name="(part._num-control-buses)"></a>num-control-buses</h4><h4>2.49<tt> </tt><a name="(part._num-buffers)"></a>num-buffers</h4><h4>2.50<tt> </tt><a name="(part._num-output-buses)"></a>num-output-buses</h4><p>The number of audio buses allocated to output.</p><p>(let ((bus num-output-buses))
|
||
|
(audition (out 0 (mul (pulse ar 90 0.3)
|
||
|
(amplitude kr (lag (in 1 ar bus) 0.1) 0.01 0.01)))))</p><h4>2.51<tt> </tt><a name="(part.__buf-frames_rate_bufnum_)"></a>(buf-frames rate bufnum)</h4><p>Current duration of buffer.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc-read 0 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let ((p (phasor ar 0 (buf-rate-scale kr 0) 0 (buf-frames kr 0) 0)))
|
||
|
(audition (out 0 (buf-rd 1 ar 0 p 0 2))))</p><p>(let ((p (k2a (mouse-x kr 0 (buf-frames kr 0) 0 0.1))))
|
||
|
(audition (out 0 (buf-rd 1 ar 0 p 0 2))))</p><h4>2.52<tt> </tt><a name="(part.__buf-rate-scale_rate_bufnum_)"></a>(buf-rate-scale rate bufnum)</h4><p>Buffer rate scaling in respect to server samplerate. Returns a
|
||
|
ratio by which the playback of a soundfile is to be scaled.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc-read 0 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let* ((r (mul (rand 0.5 2) (buf-rate-scale kr 0)))
|
||
|
(p (phasor ar 0 r 0 (buf-frames kr 0) 0)))
|
||
|
(audition (out 0 (buf-rd 1 ar 0 p 0 2))))</p><h4>2.53<tt> </tt><a name="(part._sample-dur)"></a>sample-dur</h4><p>Duration of one sample. Equivalent to 1 / sample-rate.</p><p>Compare a sine tone derived from sample rate with a 440Hz tone.</p><p>(let ((freq (mce2 (mul (recip sample-dur) 0.01) 440)))
|
||
|
(audition (out 0 (mul (sin-osc ar freq 0) 0.1))))</p><h4>2.54<tt> </tt><a name="(part._sample-rate)"></a>sample-rate</h4><p>Server sample rate.</p><p>Compare a sine tone derived from sample rate with a 440Hz tone.</p><p>(let ((freq (mce2 (mul sample-rate 0.01) 440)))
|
||
|
(audition (out 0 (mul (sin-osc ar freq 0) 0.1))))</p><h4>2.55<tt> </tt><a name="(part._radians-per-sample)"></a>radians-per-sample</h4><h4>2.56<tt> </tt><a name="(part.__buf-dur_rate_bufnum_)"></a>(buf-dur rate bufnum)</h4><p>Current duration of buffer.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc-read 0 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let* ((t (impulse ar (recip (buf-dur kr 0)) 0))
|
||
|
(p (sweep t (buf-sample-rate kr 0))))
|
||
|
(audition (out 0 (buf-rd 1 ar 0 p 0 2))))</p><h4>2.57<tt> </tt><a name="(part.__buf-channels_rate_bufnum_)"></a>(buf-channels rate bufnum)</h4><p>Current number of channels of buffer. Using at .ir is not the
|
||
|
safest choice. Since a buffer can be reallocated at any time, using
|
||
|
ir will not track the changes.</p><h4>2.58<tt> </tt><a name="(part.__buf-sample-rate_rate_bufnum_)"></a>(buf-sample-rate rate bufnum)</h4><p>Buffer sample rate.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc-read 0 "/home/rohan/audio/metal.wav" 0 0))))</p><p>Compare a sine tone derived from sample rate of a buffer with a
|
||
|
440Hz tone.</p><p>(let ((freq (mce2 (mul (buf-sample-rate ir 0) 0.01) 440)))
|
||
|
(audition (out 0 (mul (sin-osc ar freq 0) 0.1))))</p><h4>2.59<tt> </tt><a name="(part._num-audio-buses)"></a>num-audio-buses</h4><h4>2.60<tt> </tt><a name="(part._num-running-synths)"></a>num-running-synths</h4><p>Number of currently running synths.</p><p>(audition
|
||
|
(out 0 (mul (sin-osc ar (mul-add num-running-synths 200 400) 0)
|
||
|
0.1)))</p><h4>2.61<tt> </tt><a name="(part._subsample-offset)"></a>subsample-offset</h4><p>Offset from synth start within one sample.</p><p>When a synth is created from a time stamped osc-bundle, it starts
|
||
|
calculation at the next possible block (normally 64 samples). Using
|
||
|
an offset-out ugen, one can delay the audio so that it matches
|
||
|
sample accurately. For some synthesis methods, one needs subsample
|
||
|
accuracy. subsample-offset provides the information where, within
|
||
|
the current sample, the synth was scheduled. It can be used to
|
||
|
offset envelopes or resample the audio output.</p><p>See also offset-out.</p><p>Demonstrate cubic subsample interpolation. An impulse train that
|
||
|
can be moved between samples.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send-synth
|
||
|
fd
|
||
|
"s"
|
||
|
(letc ((out 0)
|
||
|
(add-offset 0))
|
||
|
(let* ((i (mul (impulse ar 2000 0) 0.3))
|
||
|
(d sample-dur)
|
||
|
(x 4)
|
||
|
(o (add (sub 1 subsample-offset)
|
||
|
(mouse-x kr 0 add-offset 0 0.1)))
|
||
|
(r (delay-c i (mul d (add 1 x)) (mul d (add o x)))))
|
||
|
(offset-out out r))))))</p><p>Create two pulse trains one sample apart, move one relative to the
|
||
|
other. When cursor is at the left, the impulses are adjacent, on
|
||
|
the right, they are exactly 1 sample apart. View this with an
|
||
|
oscilloscope.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(let ((t (utc))
|
||
|
(dt (/ 1 (server-sample-rate-actual fd))))
|
||
|
(send fd (bundle (+ t 0.2)
|
||
|
(list (s-new1 "s" -1 1 1 "addOffset" 3))))
|
||
|
(send fd (bundle (+ t 0.2 dt)
|
||
|
(list (s-new1 "s" -1 1 1 "addOffset" 0)))))))</p><h4>2.62<tt> </tt><a name="(part.__zero-crossing_in_)"></a>(zero-crossing in)</h4><p>Zero crossing frequency follower.</p><p>outputs a frequency based upon the distance between interceptions
|
||
|
of the X axis. The X intercepts are determined via linear
|
||
|
interpolation so this gives better than just integer wavelength
|
||
|
resolution. This is a very crude pitch follower, but can be useful
|
||
|
in some situations.</p><p>in - input signal.</p><p>(let* ((a (mul (sin-osc ar (mul-add (sin-osc kr 1 0) 600 700) 0) 0.1))
|
||
|
(b (mul (impulse ar (zero-crossing a) 0) 0.25)))
|
||
|
(audition (out 0 (mce2 a b))))</p><h4>2.63<tt> </tt><a name="(part.__slope_in_)"></a>(slope in)</h4><p>slope of signal. Measures the rate of change per second of a
|
||
|
signal. Formula implemented is:</p><p>out[i] = (in[i] - in[i-1]) * sampling_rate</p><p>in - input signal to measure.</p><p>a = quadratic noise, b = first derivative line segments, c = second
|
||
|
derivative constant segments</p><p>(let* ((r 2)
|
||
|
(a (lf-noise2 kr r))
|
||
|
(scale (recip r))
|
||
|
(b (mul (slope a) scale))
|
||
|
(c (mul (slope b) (squared scale)))
|
||
|
(o (sin-osc ar (mul-add (mce3 a b c) 220 220) 0)))
|
||
|
(audition (out 0 (mix (mul o 1/3)))))</p><h4>2.64<tt> </tt><a name="(part.__running-sum_in_numsamp_)"></a>(running-sum in numsamp)</h4><p>A running sum over a user specified number of samples, useful for
|
||
|
running RMS power windowing.</p><p>in - input signal
|
||
|
numsamp - How many samples to take the running sum over
|
||
|
(initialisation rate)</p><p>(let ((n 40))
|
||
|
(audition
|
||
|
(out 0 (foldl1 mul (list (sin-osc ar 440 0)
|
||
|
(running-sum (sound-in (mce2 0 1)) n)
|
||
|
(recip n))))))</p><h4>2.65<tt> </tt><a name="(part.__pitch_in_init.Freq_min.Freq_max.Freq_exec.Freq_max.Bins.Per.Octave)"></a>(pitch in initFreq minFreq maxFreq execFreq maxBinsPerOctave</h4><p>median ampThreshold peakThreshold downSample)</p><p>Autocorrelation pitch follower</p><p>This is a better pitch follower than zero-crossing, but more costly
|
||
|
of CPU. For most purposes the default settings can be used and only
|
||
|
in needs to be supplied. pitch returns two values (via an Array of
|
||
|
outputProxys, see the outputProxy help file), a freq which is the
|
||
|
pitch estimate and hasFreq, which tells whether a pitch was
|
||
|
found. Some vowels are still problematic, for instance a wide open
|
||
|
mouth sound somewhere between a low pitched short ’a’ sound as in
|
||
|
’sat’, and long ’i’ sound as in ’fire’, contains enough overtone
|
||
|
energy to confuse the algorithm.</p><p>sclang default argument values are: in = 0.0, initFreq = 440.0,
|
||
|
minFreq = 60.0, maxFreq = 4000.0, execFreq = 100.0,
|
||
|
maxBinsPerOctave = 16, median = 1, ampThreshold = 0.01,
|
||
|
peakThreshold = 0.5, downSample = 1.</p><p>(define (pitch* in median ampThreshold)
|
||
|
(pitch in 444.0 60.0 4000.0 100.0 16 median ampThreshold 0.5 1))</p><p>(let* ((in (mul (sin-osc ar (mouse-x kr 220 660 0 0.1) 0)
|
||
|
(mouse-y kr 0.05 0.25 0 0.1)))
|
||
|
(amp (amplitude kr in 0.05 0.05))
|
||
|
(freq+ (pitch* in 7 0.02))
|
||
|
(f (fdiv (car (mce-channels freq+)) 2))
|
||
|
(o (mul (sin-osc ar f 0) amp)))
|
||
|
(audition (out 0 (mce2 in o))))</p><p>(let* ((in (sound-in 0))
|
||
|
(amp (amplitude kr in 0.05 0.05))
|
||
|
(freq+ (pitch* in 7 0.02))
|
||
|
(f (car (mce-channels freq+)))
|
||
|
(o (mul (sin-osc ar f 0) amp)))
|
||
|
(audition (out 0 (mce2 in o))))</p><h4>2.66<tt> </tt><a name="(part.__compander_input_control_thresh_slope.Below_slope.Above_clamp.Time_relax.Time_)"></a>(compander input control thresh slopeBelow slopeAbove clampTime relaxTime)</h4><p>Compressor, expander, limiter, gate, ducker. General purpose
|
||
|
dynamics processor.</p><p>input: The signal to be compressed / expanded / gated.</p><p>control: The signal whose amplitude determines the gain applied to
|
||
|
the input signal. Often the same as in (for standard
|
||
|
gating or compression) but should be different for
|
||
|
ducking.</p><p>thresh: Control signal amplitude threshold, which determines the
|
||
|
break point between slopeBelow and slopeAbove. Usually
|
||
|
0..1. The control signal amplitude is calculated using RMS.</p><p>slopeBelow: slope of the amplitude curve below the threshold. If
|
||
|
this slope > 1.0, the amplitude will drop off more
|
||
|
quickly the softer the control signal gets when the
|
||
|
control signal is close to 0 amplitude, the output
|
||
|
should be exactly zero – hence, noise gating. Values <
|
||
|
1.0 are possible, but it means that a very low-level
|
||
|
control signal will cause the input signal to be
|
||
|
amplified, which would raise the noise floor.</p><p>slopeAbove: Same thing, but above the threshold. Values < 1.0
|
||
|
achieve compression (louder signals are attenuated) >
|
||
|
1.0, you get expansion (louder signals are made even
|
||
|
louder). For 3:1 compression, you would use a value of
|
||
|
1/3 here.</p><p>clampTime: The amount of time it takes for the amplitude adjustment
|
||
|
to kick in fully. This is usually pretty small, not much
|
||
|
more than 10 milliseconds (the default value).</p><p>relaxTime: The amount of time for the amplitude adjustment to be
|
||
|
released. Usually a bit longer than clampTime if both
|
||
|
times are too short, you can get some (possibly
|
||
|
unwanted) artifacts.</p><p>Example signal to process.</p><p>(define z
|
||
|
(mul (decay2 (mul (impulse ar 8 0) (mul (lf-saw kr 0.3 0) 0.3)) 0.001 0.3)
|
||
|
(mix (pulse ar (mce2 80 81) 0.3))))</p><p>(audition (out 0 z))</p><p>Noise gate</p><p>(let ((x (mouse-x kr 0.01 1 0 0.1)))
|
||
|
(audition (out 0 (mce2 z (compander z z x 10 1 0.01 0.01)))))</p><p>Compressor</p><p>(let ((x (mouse-x kr 0.01 1 0 0.1)))
|
||
|
(audition (out 0 (mce2 z (compander z z x 1 0.5 0.01 0.01)))))</p><p>limiter</p><p>(let ((x (mouse-x kr 0.01 1 0 0.1)))
|
||
|
(audition (out 0 (mce2 z (compander z z x 1 0.1 0.01 0.01)))))</p><p>Sustainer</p><p>(let ((x (mouse-x kr 0.01 1 0 0.1)))
|
||
|
(audition (out 0 (mce2 z (compander z z x 0.1 1.0 0.01 0.01)))))</p><h4>2.67<tt> </tt><a name="(part.__amplitude_rate_in_attack.Time_release.Time_)"></a>(amplitude rate in attackTime releaseTime)</h4><p>Amplitude follower. Tracks the peak amplitude of a signal.</p><p>(audition
|
||
|
(out 0 (mul (pulse ar 90 0.3)
|
||
|
(amplitude kr (in 1 ar num-output-buses) 0.01 0.01))))</p><p>(let* ((a (amplitude kr (in 1 ar num-output-buses) 0.01 0.01))
|
||
|
(f (mul-add a 1200 400)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.3))))</p><h4>2.68<tt> </tt><a name="(part.__pulse-divider_trig_div_start_)"></a>(pulse-divider trig div start)</h4><p>outputs one impulse each time it receives a certain number of
|
||
|
triggers at its input. A trigger happens when the signal changes
|
||
|
from non-positive to positive.</p><p>(let* ((p (impulse ar 8 0))
|
||
|
(d (pulse-divider p (mce2 4 7) 0))
|
||
|
(a (mul (sin-osc ar 1200 0) (decay2 p 0.005 0.1)))
|
||
|
(b (mul (sin-osc ar 600 0) (decay2 d 0.005 0.5))))
|
||
|
(audition (out 0 (mul (add a b) 0.4))))</p><h4>2.69<tt> </tt><a name="(part.__gate_in_trig_)"></a>(gate in trig)</h4><p>The signal at ‘in’ is passed while ‘trig’ is greater than zero.</p><p>(let ((s (mul (f-sin-osc ar 500 0) 1/4))
|
||
|
(t (lf-pulse ar 1 0 1/10)))
|
||
|
(audition (out 0 (gate s t))))</p><h4>2.70<tt> </tt><a name="(part.__poll_trig_in_trigid_label_)"></a>(poll trig in trigid label)</h4><p>Print/query the current output value of a UGen.</p><p>trig - a non-positive to positive transition telling poll to return
|
||
|
a value</p><p>in - the signal you want to poll</p><p>trigid - if greater then 0, a ’/tr’ message is sent back to the
|
||
|
client (similar to send-trig)</p><p>label - a string or symbol to be printed with the polled value</p><p>poll returns its in signal (and is therefore transparent).
|
||
|
WARNING: Printing values from the Server in intensive for the
|
||
|
CPU. poll should be used for debugging purposes.</p><p>(define (string->ugen s)
|
||
|
(make-mce
|
||
|
(cons (string-length s)
|
||
|
(map char->integer (string->list s)))))</p><p>(let ((t (impulse kr 2 0))
|
||
|
(i (line kr 0 1 5 remove-synth)))
|
||
|
(audition (poll t i 0 (string->ugen "Test"))))</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(letrec ((print (lambda (e) (display e) (newline)))
|
||
|
(showing (lambda (f) (lambda () (let ((v (f))) (print v) v))))
|
||
|
(repeat (lambda (f) (if (f) (repeat f) #f))))
|
||
|
(async fd (/notify 1))
|
||
|
(repeat (showing (lambda () (wait fd "/tr"))))
|
||
|
(async fd (/notify 0)))))</p><p>multichannel Expansion (Broken...)</p><p>(define (poll* trig in trigId label)
|
||
|
(poll trig in trigId (string->ugen label)))</p><p>(poll* (impulse kr (mce2 10 5) 0)
|
||
|
(line kr 0 (mce2 1 5) (mce2 1 2) do-nothing)
|
||
|
0
|
||
|
"Test")</p><p>(with-sc3 server-status)</p><h4>2.71<tt> </tt><a name="(part.__most-change_a_b_)"></a>(most-change a b)</h4><p>output the input that changed most.</p><p>(let* ((x (mouse-x kr 200 300 0 0.1))
|
||
|
(f (most-change (mul-add (lf-noise0 kr 1) 400 900) x)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.72<tt> </tt><a name="(part.__trig_in_dur_)"></a>(trig in dur)</h4><p>When ‘in’ is trigerred output the trigger value for ‘dur’ seconds.</p><p>(let ((s (f-sin-osc ar 800 0))
|
||
|
(g (trig (dust ar 1) 0.2)))
|
||
|
(audition (out 0 (mul3 s g 0.5))))</p><p>(audition (out 0 (trig (dust ar 4) 0.1)))</p><h4>2.73<tt> </tt><a name="(part.__pulse-count_trig_reset_)"></a>(pulse-count trig reset)</h4><p>This outputs the number of pulses received at ‘trig’ and outputs
|
||
|
that value until ‘reset’ is triggered.</p><p>(let ((f (mul (pulse-count (impulse ar 10 0) (impulse ar 0.4 0)) 200)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.05))))</p><h4>2.74<tt> </tt><a name="(part.__stepper_trig_reset_min_max_step_resetval_)"></a>(stepper trig reset min max step resetval)</h4><p>stepper pulse counter. Each trigger increments a counter which is
|
||
|
output as a signal. The counter wraps between min and max.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(let ((a (list 97.999 195.998 523.251 466.164 195.998
|
||
|
233.082 87.307 391.995 87.307 261.626
|
||
|
195.998 77.782 233.082 195.998 97.999
|
||
|
155.563)))
|
||
|
(async fd (b-alloc 10 128 1))
|
||
|
(send fd (b-setn1 10 0 a)))))</p><p>Function composition...</p><p>(define (seq s l)
|
||
|
(if (null? l)
|
||
|
s
|
||
|
(seq ((car l) s) (cdr l))))</p><p>(let* ((rate (mouse-x kr 1 5 1 0.1))
|
||
|
(clock (impulse kr rate 0))
|
||
|
(env (decay2 clock 0.002 2.5))
|
||
|
(index (stepper clock 0 0 15 1 0))
|
||
|
(freq (buf-rd 1 kr 10 index 1 1))
|
||
|
(ffreq (add (if #t
|
||
|
(lag2 freq 0.1)
|
||
|
(mul (mouse-y kr 80 1600 1 0.1) (add (Mul env 4) 2)))
|
||
|
(mce2 0 0.3)))
|
||
|
(lfo (sin-osc kr 0.2 (mce4 0 (/ pi 2) 0.0024 0.0025)))
|
||
|
(rvb (lambda (s) (allpass-n s
|
||
|
0.05
|
||
|
(clone 2 (rand 0 0.05))
|
||
|
(rand 1.5 2.0))))
|
||
|
(proc (list
|
||
|
(lambda (s) (mul (rlpf s ffreq 0.3) env))
|
||
|
(lambda (s) (mul (rlpf s ffreq 0.3) env))
|
||
|
(lambda (s) (mul s 0.2))
|
||
|
Echo
|
||
|
(lambda (s) (mul-add (comb-l s 1 (fdiv 0.66 rate) 2) 0.8 s))
|
||
|
Reverb
|
||
|
(lambda (s) (add s (mul (seq s (replicate 5 rvb)) 0.3)))
|
||
|
(lambda (s) (leak-dc s 0.1))
|
||
|
Flanger
|
||
|
(lambda (s) (add (delay-l s 0.1 lfo) s))
|
||
|
Slight bass emphasis
|
||
|
(lambda (s) (one-pole s 0.9))))
|
||
|
(init (mix (lf-pulse ar (mul freq (mce3 1 3/2 2)) 0 0.3))))
|
||
|
(audition (out 0 (seq init proc))))</p><p>Pattern randomizer....</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(let ((p (map (lambda (e)
|
||
|
(midi-cps (+ 36 (s:degree-to-key e (list 0 3 5 7 10) 12))))
|
||
|
(map floor (replicate-m 16 (random 0 15))))))
|
||
|
(send fd (b-setn1 10 0 p)))))</p><p>A shorter variant, using some simple syntax...</p><p>(define-syntax seq*
|
||
|
(syntax-rules ()
|
||
|
((_ i s f ...)
|
||
|
(seq i (list (lambda (s) f) ...)))))</p><p>(let* ((rate (mouse-x kr 1 5 1 0.1))
|
||
|
(clock (impulse kr rate 0))
|
||
|
(env (decay2 clock 0.002 2.5))
|
||
|
(index (stepper clock 0 0 15 1 0))
|
||
|
(freq (buf-rd 1 kr 10 index 1 1))
|
||
|
(ffreq (add (lag2 freq 0.1) (mce2 0 0.3)))
|
||
|
(lfo (sin-osc kr 0.2 (mce4 0 (/ pi 2) 0.0024 0.0025)))
|
||
|
(rvb (lambda (s) (allpass-n s
|
||
|
0.05
|
||
|
(clone 2 (rand 0 0.05))
|
||
|
(rand 1.5 2.0))))
|
||
|
(init (mix (lf-pulse ar (mul freq (mce3 1 3/2 2)) 0 0.3)))
|
||
|
(proc (seq* init
|
||
|
s
|
||
|
(mul (rlpf s ffreq 0.3) env)
|
||
|
(mul (rlpf s ffreq 0.3) env)
|
||
|
(mul s 0.2)
|
||
|
(mul-add (comb-l s 1 (fdiv 0.66 rate) 2) 0.8 s)
|
||
|
(add s (mul (seq s (replicate 5 rvb)) 0.3))
|
||
|
(leak-dc s 0.1)
|
||
|
(add (delay-l s 0.1 lfo) s)
|
||
|
(one-pole s 0.9))))
|
||
|
(audition (out 0 proc)))</p><h4>2.75<tt> </tt><a name="(part.__last-value_in_diff_)"></a>(last-value in diff)</h4><p>output the last value before the input changed more than a
|
||
|
threshhold.</p><p>(let ((f (last-value (mouse-x kr 100 400 0 0.1) 40)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><p>(let* ((x (mouse-x kr 0.1 4 0 0.1))
|
||
|
(f (mul-add (u:abs (sub x (last-value x 0.5))) 400 200)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><h4>2.76<tt> </tt><a name="(part.__peak-follower_in_decay_)"></a>(peak-follower in decay)</h4><p>Track peak signal amplitude. outputs the peak amplitude of the
|
||
|
signal received at the input. If level is below maximum, the level
|
||
|
decreases by the factor given in decay.</p><p>in - input signal.
|
||
|
decay - decay factor.</p><p>internally, the absolute value of the signal is used, to prevent
|
||
|
underreporting the peak value if there is a negative DC offset. To
|
||
|
obtain the minimum and maximum values of the signal as is, use the
|
||
|
running-min and running-max UGens.</p><p>No decay</p><p>(let* ((s (mul (dust ar 20) (line kr 0 1 4 do-nothing)))
|
||
|
(f (mul-add (peak-follower s 1.0) 1500 200)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><p>A little decay</p><p>(let* ((s (mul (dust ar 20) (line kr 0 1 4 do-nothing)))
|
||
|
(f (mul-add (peak-follower s 0.999) 1500 200)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><p>Mouse x controls decay</p><p>(let* ((x (mouse-x kr 0.99 1.0001 1 0.1))
|
||
|
(s (mul (dust ar 20) (line kr 0 1 4 do-nothing)))
|
||
|
(f (mul-add (peak-follower s (u:min x 1.0)) 1500 200)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><p>Follow a sine lfo</p><p>(let* ((x (mouse-x kr 0.99 1.0001 1 0.1))
|
||
|
(s (sin-osc kr 0.2 0))
|
||
|
(f (mul-add (peak-follower s (u:min x 1.0)) 200 500)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><h4>2.77<tt> </tt><a name="(part.__running-max_in_trig_)"></a>(running-max in trig)</h4><p>Track maximum level. outputs the maximum value received at the
|
||
|
input. When triggered, the maximum output value is reset to the
|
||
|
current value.</p><p>in - input signal
|
||
|
trig - reset the output value to the current input value</p><p>(let* ((t (impulse ar 0.4 0))
|
||
|
(f (mul-add (running-max (dust ar 20) t) 500 200)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><p>(let* ((t (impulse kr (mouse-x kr 0.01 2 1 0.1) 0))
|
||
|
(f (mul-add (running-max (sin-osc kr 2 0) t) 500 200)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><h4>2.78<tt> </tt><a name="(part.__trig1_in_dur_)"></a>(trig1 in dur)</h4><p>When ‘in’ is trigered output a unit signal for ‘dur’ seconds.</p><p>(let ((a (trig1 (dust ar 1) 0.2)))
|
||
|
(audition (out 0 (mul3 (f-sin-osc ar 800 0) a 0.2))))</p><h4>2.79<tt> </tt><a name="(part.__phasor_trig_rate_start_end_resetpos_)"></a>(phasor trig rate start end resetpos)</h4><p>triggered linear ramp between two levels. Starts a linear ramp
|
||
|
when trig input crosses from non-positive to positive.</p><p>trig - sets phase to resetPos (default: 0, equivalent to start)
|
||
|
rate - rate value in 1 / frameDur (at 44.1 kHz sample rate: rate
|
||
|
1 is eqivalent to 44100/sec)
|
||
|
start, end - start and end points of ramp
|
||
|
resetPos - determines where to jump to on recieving a trigger. the
|
||
|
value at that position can be calculated as follows:
|
||
|
(end - start) * resetPos</p><p>phasor controls sine frequency: end frequency matches a second sine wave.</p><p>(let* ((r (mouse-x kr 0.2 2 1 0.1))
|
||
|
(t (impulse ar r 0))
|
||
|
(x (phasor ar t (fdiv r sample-rate) 0 1 0))
|
||
|
(f (mce2 (lin-lin x 0 1 600 1000) 1000)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><h4>2.80<tt> </tt><a name="(part.__schmidt_in_lo_hi_)"></a>(schmidt in lo hi)</h4><p>schmidt trigger. When in crosses to greater than hi, output 1.0,
|
||
|
then when signal crosses lower than lo output 0.0. output is
|
||
|
initially zero.</p><p>in - signal to be tested
|
||
|
lo - low threshold
|
||
|
hi - high threshold</p><p>(let* ((in (lf-noise1 kr 3))
|
||
|
(octave (add (schmidt in -0.15 0.15) 1))
|
||
|
(f (add (mul in 200) (mul 500 octave))))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.81<tt> </tt><a name="(part.__peak_trig_reset_)"></a>(peak trig reset)</h4><p>outputs the maximum value read at the ‘trig’ input until ‘reset’ is
|
||
|
triggered.</p><p>(let* ((p (peak (dust ar 20) (impulse ar 0.4 0)))
|
||
|
(f (mul-add p 500 200)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><h4>2.82<tt> </tt><a name="(part.__toggle-ff_trig_)"></a>(toggle-ff trig)</h4><p>Toggle flip flop. Toggles between zero and one upon receiving a trigger.</p><p>trig - trigger input</p><p>(let* ((t (dust ar (x-line kr 1 1000 60 do-nothing)))
|
||
|
(s (sin-osc ar (mul-add (toggle-ff t) 400 800) 0)))
|
||
|
(audition (out 0 (mul s 0.1))))</p><h4>2.83<tt> </tt><a name="(part.__sweep_trig_rate_)"></a>(sweep trig rate)</h4><p>triggered linear ramp. Starts a linear raise by rate/sec from zero
|
||
|
when trig input crosses from non-positive to positive.</p><p>Using sweep to modulate sine frequency</p><p>(let* ((t (impulse kr (mouse-x kr 0.5 20 1 0.1) 0))
|
||
|
(f (add (sweep t 700) 500)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><p>Using sweep to index into a buffer</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc-read 0 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let* ((t (impulse ar (mouse-x kr 0.5 20 1 0.1) 0))
|
||
|
(i (sweep t (buf-sample-rate ir 0))))
|
||
|
(audition (out 0 (buf-rd 1 ar 0 i 0 2))))</p><p>Backwards, variable offset</p><p>(let* ((t (impulse ar (mouse-x kr 0.5 10 1 0.1) 0))
|
||
|
(r (buf-sample-rate ir 0))
|
||
|
(i (add (sweep t (neg r)) (mul (buf-frames ir 0) (lf-noise0 kr 15)))))
|
||
|
(audition (out 0 (buf-rd 1 ar 0 i 0 2))))</p><p>Raising rate</p><p>(let* ((t (impulse ar (mouse-x kr 0.5 10 1 0.1) 0))
|
||
|
(r (add (sweep t 2) 0.5))
|
||
|
(i (sweep t (mul (buf-sample-rate ir 0) r))))
|
||
|
(audition (out 0 (buf-rd 1 ar 0 i 0 2))))</p><h4>2.84<tt> </tt><a name="(part.__send-trig_in_id_value_)"></a>(send-trig in id value)</h4><p>On receiving a trigger (0 to non-zero transition), send a trigger
|
||
|
message from the server back to all registered clients. Clients
|
||
|
register by sending a /notify message to the server.</p><p>input - the trigger</p><p>id - an integer that will be passed with the trigger message. This
|
||
|
is useful if you have more than one send-trig in a SynthDef</p><p>value - a UGen or float that will be polled at the time of trigger,
|
||
|
and its value passed with the trigger message</p><p>(let ((s (lf-noise0 kr 10)))
|
||
|
(audition (mrg2 (send-trig s 0 s)
|
||
|
(out 0 (mul (sin-osc ar (mul-add s 200 500) 0) 0.1)))))</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (notify 1))
|
||
|
(sleep 2.0)
|
||
|
(let ((r (wait fd "/tr")))
|
||
|
(async fd (notify 0))
|
||
|
r)))</p><h4>2.85<tt> </tt><a name="(part.__in-range_in_lo_hi_)"></a>(in-range in lo hi)</h4><p>Tests if a signal is within a given range.</p><p>If in is >= lo and <= hi output 1.0, otherwise output 0.0. output
|
||
|
is initially zero.</p><p>in - signal to be tested
|
||
|
lo - low threshold
|
||
|
hi - high threshold</p><p>(let ((a (in-range (mul (sin-osc kr 1 0) 0.2) -0.15 0.15)))
|
||
|
(audition (out 0 (mul a (mul (brown-noise ar) 0.1)))))</p><h4>2.86<tt> </tt><a name="(part.__timer_trig_)"></a>(timer trig)</h4><p>Returns time since last triggered</p><p>Using timer to modulate sine frequency: the slower the trigger is
|
||
|
the higher the frequency</p><p>(let* ((t (impulse kr (mouse-x kr 0.5 20 1 0.1) 0))
|
||
|
(s (sin-osc ar (mul-add (timer t) 500 500) 0)))
|
||
|
(audition (out 0 (mul s 0.2))))</p><h4>2.87<tt> </tt><a name="(part.__t-delay_trigger_delay.Time_)"></a>(t-delay trigger delayTime)</h4><p>Delays a trigger by a given time. Any triggers which arrive in the
|
||
|
time between an input trigger and its delayed output, are ignored.</p><p>trigger - input trigger signal.
|
||
|
delayTime - delay time in seconds.</p><p>(let* ((s (mul (sin-osc ar 440 0) 0.1))
|
||
|
(z (impulse ar 2 0))
|
||
|
(l (mul z 0.1))
|
||
|
(r (mul (toggle-ff (t-delay z 0.5)) s)))
|
||
|
(audition (out 0 (mce2 l r))))</p><h4>2.88<tt> </tt><a name="(part.__running-min_in_trig_)"></a>(running-min in trig)</h4><p>Track minimum level. outputs the minimum value received at the
|
||
|
input. When triggered, the minimum output value is reset to the
|
||
|
current value.</p><p>in - input signal
|
||
|
trig - reset the output value to the current input value</p><p>(let* ((t (impulse ar 2.0 0))
|
||
|
(f (mul-add (running-min (sub 1 (dust ar 20)) t) 500 200)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><p>(let* ((t (impulse kr (mouse-x kr 0.5 4 1 0.1) 0))
|
||
|
(f (mul-add (running-min (sub 2 (sin-osc kr 2 0)) t) 500 200)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><h4>2.89<tt> </tt><a name="(part.__set-reset-ff_trig_reset_)"></a>(set-reset-ff trig reset)</h4><p>Set-reset flip flop. output is set to 1.0 upon receiving a trigger
|
||
|
in the set input, and to 0.0 upon receiving a trigger in the reset
|
||
|
input. Once the flip flop is set to zero or one further triggers in
|
||
|
the same input are have no effect. One use of this is to have some
|
||
|
precipitating event cause something to happen until you reset it.</p><p>trig - trigger sets output to one
|
||
|
reset - trigger resets output to zero</p><p>(let ((n (brown-noise ar))
|
||
|
(g (set-reset-ff (dust ar 5) (dust ar 5))))
|
||
|
(audition (out 0 (mul3 n g 0.2))))</p><h4>2.90<tt> </tt><a name="(part.__saw_rate_freq_)"></a>(saw rate freq)</h4><p>Band limited sawtooth wave generator.</p><p>(let ((f (x-line kr 40 4000 6 do-nothing)))
|
||
|
(audition (out 0 (mul (saw ar f) 0.2))))</p><p>Two band limited sawtooth waves thru a resonant low pass filter</p><p>(let ((f (x-line kr 8000 400 5 do-nothing)))
|
||
|
(audition (out 0 (rlpf (mul (saw ar (mce2 100 250)) 0.1) f 0.05))))</p><h4>2.91<tt> </tt><a name="(part.__pm-osc_rate_carfreq_modfreq_index_modphase_)"></a>(pm-osc rate carfreq modfreq index modphase)</h4><p>Phase modulation oscillator pair.</p><p>carfreq - carrier frequency in cycles per second.
|
||
|
modfreq - modulator frequency in cycles per second.
|
||
|
index - modulation index in radians.
|
||
|
modphase - a modulation input for the modulator’s phase in radians</p><p>(let* ((f (line kr 600 900 5 remove-synth))
|
||
|
(o (mul (pm-osc ar f 600 3 0) 0.1)))
|
||
|
(audition (out 0 o)))</p><p>(let* ((mf (line kr 600 900 5 remove-synth))
|
||
|
(o (mul (pm-osc ar 300 mf 3 0) 0.1)))
|
||
|
(audition (out 0 o)))</p><p>(let* ((i (line kr 0 20 8 remove-synth))
|
||
|
(o (mul (pm-osc ar 300 550 i 0) 0.1)))
|
||
|
(audition (out 0 o)))</p><h4>2.92<tt> </tt><a name="(part.__lf-tri_rate_freq_iphase_)"></a>(lf-tri rate freq iphase)</h4><p>A non-band-limited triangular waveform oscillator. output ranges
|
||
|
from -1 to +1.</p><p>(audition (out 0 (mul (lf-tri ar 500 1) 0.1)))</p><p>Used as both oscillator and LFO.</p><p>(let ((f (mul-add (lf-tri kr 4 0) 400 400)))
|
||
|
(audition (out 0 (mul (lf-tri ar f 0) 0.1))))</p><h4>2.93<tt> </tt><a name="(part.__t-grains_num.Channels_trigger_bufnum_rate_center.Pos_dur_pan_amp_interp_)"></a>(t-grains numChannels trigger bufnum rate centerPos dur pan amp interp)</h4><p>Buffer granulator. triggers generate grains from a buffer. Each
|
||
|
grain has a Hanning envelope (sin^2(x) for x from 0 to pi) and is
|
||
|
panned between two channels of multiple outputs.</p><p>numChannels - number of output channels.</p><p>trigger - at each trigger, the following arguments are sampled and
|
||
|
used as the arguments of a new grain. A trigger occurs
|
||
|
when a signal changes from <= 0 to > 0. If the trigger
|
||
|
is audio rate then the grains will start with sample
|
||
|
accuracy.</p><p>bufnum - the index of the buffer to use. It must be a one channel
|
||
|
(mono) buffer.</p><p>rate - 1.0 is normal, 2.0 is one octave up, 0.5 is one octave down
|
||
|
and -1.0 is backwards normal rate ... etc. Unlike play-buf,
|
||
|
the rate is multiplied by BufRate, so you needn’t do that
|
||
|
yourself.</p><p>centerPos - the position in the buffer in seconds at which the
|
||
|
grain envelope will reach maximum amplitude.</p><p>dur - duration of the grain in seconds.</p><p>pan - a value from -1 to 1. Determines where to pan the output in
|
||
|
the same manner as pan-az.</p><p>amp - amplitude of the grain.</p><p>interp - 1, 2, or 4. Determines whether the grain uses (1) no
|
||
|
interpolation, (2) linear interpolation, or (4) cubic
|
||
|
interpolation.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc-read 10 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(audition
|
||
|
(let* ((b 10)
|
||
|
(trate (mouse-y kr 2 200 1 0.1))
|
||
|
(dur (fdiv 4 trate))
|
||
|
(t (impulse ar trate 0))
|
||
|
(i (mouse-x kr 0 (buf-dur kr b) 0 0.1)))
|
||
|
(out 0 (t-grains 2 t b 1 i dur 0 0.1 2))))</p><p>(audition
|
||
|
(let* ((b 10)
|
||
|
(trate (mouse-y kr 8 120 1 0.1))
|
||
|
(dur (fdiv 12 trate))
|
||
|
(clk (impulse ar trate 0))
|
||
|
(x (mouse-x kr 0 (buf-dur kr b) 0 0.1))
|
||
|
(pos (add x (t-rand 0 0.01 clk)))
|
||
|
(pan (mul (white-noise kr) 0.6)))
|
||
|
(out 0 (t-grains 2 clk b 1 pos dur pan 0.1 2))))</p><p>(audition
|
||
|
(let* ((b 10)
|
||
|
(trate (mouse-y kr 8 120 1 0.1))
|
||
|
(dur (fdiv 4 trate))
|
||
|
(clk (dust ar trate))
|
||
|
(x (mouse-x kr 0 (buf-dur kr b) 0 0.1))
|
||
|
(pos (add x (t-rand 0 0.01 clk)))
|
||
|
(pan (mul (white-noise kr) 0.6)))
|
||
|
(out 0 (t-grains 2 clk b 1 pos dur pan 0.1 2))))</p><p>The SC3 ** operator is the ShiftLeft binary UGen.</p><p>(audition
|
||
|
(let* ((b 10)
|
||
|
(trate (mouse-y kr 2 120 1 0.1))
|
||
|
(dur (fdiv 1.2 trate))
|
||
|
(clk (impulse ar trate 0))
|
||
|
(pos (mouse-x kr 0 (buf-dur kr b) 0 0.1))
|
||
|
(pan (mul (white-noise kr) 0.6))
|
||
|
(rate (shift-left 1.2 (u:round (mul (white-noise kr) 3) 1))))
|
||
|
(out 0 (t-grains 2 clk b rate pos dur pan 0.1 2))))</p><h4>2.94<tt> </tt><a name="(part.__tw-index_in_normalize_array_)"></a>(tw-index in normalize array)</h4><p>triggered windex. When triggered, returns a random index value
|
||
|
based on array as a list of probabilities. By default the list of
|
||
|
probabilities should sum to 1.0, when the normalize flag is set to
|
||
|
1, the values get normalized by the ugen (less efficient)</p><p>Assuming normalized values</p><p>(audition
|
||
|
(let* ((prob (mce3 1/5 2/5 2/5))
|
||
|
(freq (mce3 400 500 600))
|
||
|
(f (select (tw-index (impulse kr 6 0) 0.0 prob) freq)))
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.2))))</p><p>Modulating probability values</p><p>(audition
|
||
|
(let* ((t (impulse kr 6 0))
|
||
|
(a (mce3 1/4 1/2 (mul-add (sin-osc kr 0.3 0) 0.5 0.5)))
|
||
|
(f (select (tw-index t 1.0 a) (mce3 400 500 600))))
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.2))))</p><h4>2.95<tt> </tt><a name="(part.__osc-n_rate_bufnum_freq_phase_)"></a>(osc-n rate bufnum freq phase)</h4><p>Noninterpolating wavetable lookup oscillator with frequency and
|
||
|
phase modulation inputs. It is usually better to use the
|
||
|
interpolating oscillator.</p><p>The buffer size must be a power of 2. The buffer should NOT be
|
||
|
filled using Wavetable format (b_gen commands should set wavetable
|
||
|
flag to false.</p><h4>2.96<tt> </tt><a name="(part.__osc_rate_bufnum_freq_phase_)"></a>(osc rate bufnum freq phase)</h4><p>linear interpolating wavetable lookup oscillator with frequency and
|
||
|
phase modulation inputs.</p><p>This oscillator requires a buffer to be filled with a wavetable
|
||
|
format signal. This preprocesses the Signal into a form which can
|
||
|
be used efficiently by the oscillator. The buffer size must be a
|
||
|
power of 2.</p><p>This can be acheived by creating a Buffer object and sending it one
|
||
|
of the "b_gen" messages ( sine1, sine2, sine3 ) with the wavetable
|
||
|
flag set to true.</p><p>Note about wavetables: oscN requires the b_gen sine1 wavetable flag
|
||
|
to be OFF. osc requires the b_gen sine1 wavetable flag to be ON.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 512 1))
|
||
|
(async fd (b-gen1 10 "sine1" (list (+ 1 2 4) 1 1/2 1/3 1/4 1/5)))))</p><p>(audition (out 0 (mul (osc ar 10 220 0) 0.1)))</p><p>Modulate freq</p><p>(let ((f (x-line kr 2000 200 1 remove-synth)))
|
||
|
(audition (out 0 (mul (osc ar 10 f 0) 0.5))))</p><p>Modulate freq</p><p>(let* ((f1 (x-line kr 1 1000 9 remove-synth))
|
||
|
(f2 (mul-add (osc ar 10 f1 0) 200 800)))
|
||
|
(audition (out 0 (mul (osc ar 10 f2 0) 0.25))))</p><p>Modulate phase</p><p>(let* ((f (x-line kr 20 8000 10 remove-synth))
|
||
|
(p (mul (osc ar 10 f 0) (* 2 pi))))
|
||
|
(audition (out 0 (mul (osc ar 10 800 p) 0.25))))</p><p>Change the buffer while its playing</p><p>(audition (out 0 (mul (osc ar 10 220 0) 0.1)))</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-gen1 10 "sine1" (list (+ 1 2 4) 1 (random 0 1) 1/4)))))</p><h4>2.97<tt> </tt><a name="(part.__lf-saw_rate_freq_iphase_)"></a>(lf-saw rate freq iphase)</h4><p>sawtooth oscillator. A non-band-limited sawtooth
|
||
|
oscillator. output ranges from -1 to +1.</p><p>freq - frequency in Hertz
|
||
|
iphase - phase in radians</p><p>(audition (out 0 (mul (lf-saw ar 500 1) 0.1)))</p><p>Used as both oscillator and LFO.</p><p>(let ((f (mul-add (lf-saw kr 4 0) 400 400)))
|
||
|
(audition (out 0 (mul (lf-saw ar f 0) 0.1))))</p><h4>2.98<tt> </tt><a name="(part.__tw-choose_trig_array_weights_normalize_)"></a>(tw-choose trig array weights normalize)</h4><p>The output is selected randomly on recieving a trigger from an
|
||
|
array of inputs. The weights of this choice are determined from
|
||
|
the weights array. If normalize is set to 1 the weights are
|
||
|
continuously normalized, which means an extra calculation overhead.
|
||
|
When using fixed values the normalizeSum method can be used to
|
||
|
normalize the values. TWChoose is a composite of TWindex and
|
||
|
select</p><p>(let ((a (mce3 (sin-osc ar 220 0)
|
||
|
(saw ar 440)
|
||
|
(pulse ar 110 0.1)))
|
||
|
(t (dust ar (mouse-x kr 1 1000 1 0.1)))
|
||
|
(w (mce3 0.6 0.15 0.05)))
|
||
|
(audition (out 0 (mul (tw-choose t a w 1) 0.1))))</p><p>Note: all the ugens are continously running. This may not be the
|
||
|
most efficient way if each input is cpu-expensive.</p><h4>2.99<tt> </tt><a name="(part.__import__rsc3__)"></a>(import (rsc3))</h4><p>sclang defaults
|
||
|
(audition (out 0 (pan2 (gendy1 ar 1 1 1 1 440 660 0.5 0.5 12 12) 0 0.15)))</p><p>Wandering bass
|
||
|
(audition (out 0 (pan2 (gendy1 ar 1 1 1.0 1.0 30 100 0.3 0.05 5 5) 0 0.15)))</p><p>Play me
|
||
|
(let* ((x (mouse-x* kr 100 1000 1 0.1))
|
||
|
(g (gendy1 ar 2 3 1 1 20 x 0.5 0.0 40 40)))
|
||
|
(audition (out 0 (pan2 (mul (rlpf g 500 0.3) 0.2) 0.0 0.25))))</p><p>Scream!
|
||
|
(let ((x (mouse-x kr 220 440 1 0.1))
|
||
|
(y (mouse-y kr 0.0 1.0 0 0.1)))
|
||
|
(audition (out 0 (pan2 (gendy1 ar 2 3 1 1 x (mul 8 x) y y 7 7) 0.0 0.3))))</p><p>1 CP = random noise
|
||
|
(audition (out 0 (pan2 (gendy1 ar 1 1 1 1 440 660 0.5 0.5 1 1) 0 0.15)))</p><p>2 CPs = an oscillator
|
||
|
(audition (out 0 (pan2 (gendy1 ar 1 1 1 1 440 660 0.5 0.5 2 2) 0 0.15)))</p><p>Used as an LFO
|
||
|
(let* ((ad (mul-add (sin-osc kr 0.1 0) 0.49 0.51))
|
||
|
(dd (mul-add (sin-osc kr 0.13 0) 0.49 0.51))
|
||
|
(as (mul-add (sin-osc kr 0.17 0) 0.49 0.51))
|
||
|
(ds (mul-add (sin-osc kr 0.19 0) 0.49 0.51))
|
||
|
(g (gendy1 kr 2 4 ad dd 3.4 3.5 as ds 10 10)))
|
||
|
(audition (out 0 (pan2 (sin-osc ar (mul-add g 50 350) 0) 0.0 0.3))))</p><p>Wasp
|
||
|
(let ((ad (mul-add (sin-osc kr 0.1 0) 0.1 0.9)))
|
||
|
(audition (out 0 (pan2 (gendy1 ar 0 0 ad 1.0 50 1000 1 0.005 12 12) 0.0 0.2))))</p><p>Modulate distributions. Change of pitch as distributions change
|
||
|
the duration structure and spectrum
|
||
|
(let* ((x (mouse-x* kr 0 7 0 0.1))
|
||
|
(y (mouse-y* kr 0 7 0 0.1))
|
||
|
(g (gendy1 ar x y 1 1 440 660 0.5 0.5 12 12)))
|
||
|
(audition (out 0 (pan2 g 0 0.2))))</p><p>Modulate number of CPs.
|
||
|
(let* ((x (mouse-x* kr 1 13 0 0.1))
|
||
|
(g (gendy1 ar 1 1 1 1 440 660 0.5 0.5 12 x)))
|
||
|
(audition (out 0 (pan2 g 0 0.2))))</p><p>Self modulation.
|
||
|
(let* ((x (mouse-x* kr 1 13 0 0.1))
|
||
|
(y (mouse-y* kr 0.1 10 0 0.1))
|
||
|
(g0 (gendy1 kr 5 4 0.3 0.7 0.1 y 1.0 1.0 5 5))
|
||
|
(g1 (gendy1 ar 1 1 1 1 440 (mul-add g0 500 600) 0.5 0.5 12 x)))
|
||
|
(audition (out 0 (pan2 g1 0.0 0.2))))</p><p>Use SINUS to track any oscillator and take CP positions from it use
|
||
|
adparam and ddparam as the inputs to sample.
|
||
|
(let* ((p (lf-pulse kr 100 0 0.4))
|
||
|
(s (mul (sin-osc kr 30 0) 0.5))
|
||
|
(g (gendy1 ar 6 6 p s 440 660 0.5 0.5 12 12)))
|
||
|
(audition (out 0 (pan2 g 0.0 0.2))))</p><p>Near the corners are interesting.
|
||
|
(let* ((x (mouse-x* kr 0 200 0 0.1))
|
||
|
(y (mouse-y* kr 0 200 0 0.1))
|
||
|
(p (lf-pulse kr x 0 0.4))
|
||
|
(s (mul (sin-osc kr y 0) 0.5))
|
||
|
(g (gendy1 ar 6 6 p s 440 660 0.5 0.5 12 12)))
|
||
|
(audition (out 0 (pan2 g 0.0 0.2))))</p><p>Texture
|
||
|
(let*
|
||
|
((o (let* ((f (rand 130.0 160.3))
|
||
|
(ad (mul-add (sin-osc kr 0.1 0) 0.49 0.51))
|
||
|
(dd (mul-add (sin-osc kr 0.13 0) 0.49 0.51))
|
||
|
(as (mul-add (sin-osc kr 0.17 0) 0.49 0.51))
|
||
|
(ds (mul-add (sin-osc kr 0.19 0) 0.49 0.51))
|
||
|
(g (gendy1 ar (rand 0 6) (rand 0 6) ad dd f f as ds 12 12)))
|
||
|
(pan2 (sin-osc ar (mul-add g 200 400) 0)
|
||
|
(rand -1 1)
|
||
|
0.1)))
|
||
|
(x (mix-fill 10 (lambda (_) o))))
|
||
|
(audition (out 0 x)))</p><p>Try durscale 10.0 and 0.0 too.
|
||
|
(let* ((x (mouse-x* kr 10 700 0 0.1))
|
||
|
(y (mouse-y* kr 50 1000 0 0.1))
|
||
|
(g (gendy1 ar 2 3 1 1 1 x 0.5 0.1 10 10)))
|
||
|
(audition (out 0 (pan2 (comb-n (resonz g y 0.1) 0.1 0.1 5) 0.0 0.6))))</p><p>Overkill
|
||
|
(define (overkill i)
|
||
|
(mix-fill
|
||
|
i
|
||
|
(lambda (_)
|
||
|
(let* ((f (rand 50 560.3))
|
||
|
(n (rand 2 20))
|
||
|
(k (mul-add (sin-osc kr (exp-rand 0.02 0.2) 0)
|
||
|
(fdiv n 2)
|
||
|
(fdiv n 2)))
|
||
|
(g (gendy1 ar
|
||
|
(rand 0 6) (rand 0 6) (rand 0 1) (rand 0 1) f f
|
||
|
(rand 0 1) (rand 0 1) n k)))
|
||
|
(pan2 g (rand -1 1) (fdiv 0.5 (sqrt i)))))))</p><p>(audition (out 0 (overkill 10)))</p><p>Another traffic moment
|
||
|
(let ((x (mouse-x* kr 100 2000 0 0.1))
|
||
|
(y (mouse-y* kr 0.01 1.0 0 0.1)))
|
||
|
(audition (out 0 (resonz (overkill 10) x y))))</p><h4>2.100<tt> </tt><a name="(part.__pulse_rate_freq_width_)"></a>(pulse rate freq width)</h4><p>Bandlimited pulse wave generator.</p><p>Modulate frequency</p><p>(audition
|
||
|
(let ((f (x-line kr 40 4000 6 remove-synth)))
|
||
|
(out 0 (mul (pulse ar f 0.1) 0.2))))</p><p>modulate pulse width</p><p>(audition
|
||
|
(let ((w (line kr 0.01 0.99 8 remove-synth)))
|
||
|
(out 0 (mul (pulse ar 200 w) 0.2))))</p><p>two band limited square waves thru a resonant low pass filter</p><p>(audition
|
||
|
(out 0 (rlpf (mul (pulse ar (mce2 100 250) 0.5) 0.1)
|
||
|
(x-line kr 8000 400 5 remove-synth)
|
||
|
0.05)))</p><h4>2.101<tt> </tt><a name="(part.__shaper_bufnum_in_)"></a>(shaper bufnum in)</h4><p>Wave shaper. Performs waveshaping on the input signal by indexing
|
||
|
into the table.</p><p>bufnum - the number of a buffer filled in wavetable format
|
||
|
containing the transfer function.
|
||
|
in - the input signal.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 512 1))
|
||
|
(async fd (b-gen1 10 "cheby" (list 0 1 0 1 1 0 1)))))</p><p>(audition
|
||
|
(let* ((a (line kr 0 1 6 remove-synth))
|
||
|
(s (mul (sin-osc ar 300 0) a)))
|
||
|
(out 0 (mul (shaper 10 s) 0.5))))</p><h4>2.102<tt> </tt><a name="(part._.S.C2__.Note_extra_iphase_argument____import__rsc3_____audition__out_0__mul__f-sin-osc_ar__mce2_440_550__0__0_05______let___f__x-line_kr_200_4000_1_remove-synth_______audition__out_0__mul__f-sin-osc_ar_f_0__0_25____)"></a>SC2: Note extra iphase argument.
|
||
|
|
||
|
(import (rsc3))
|
||
|
|
||
|
(audition (out 0 (mul (f-sin-osc ar (mce2 440 550) 0) 0.05)))
|
||
|
|
||
|
(let ((f (x-line kr 200 4000 1 remove-synth)))
|
||
|
(audition (out 0 (mul (f-sin-osc ar f 0) 0.25))))</h4><p>Loses amplitude towards the end
|
||
|
(let ((f (mul-add (f-sin-osc ar (x-line kr 4 401 8 remove-synth) 0)
|
||
|
200
|
||
|
800)))
|
||
|
(audition (out 0 (mul (f-sin-osc ar f 0) 0.25))))</p><h4>2.103<tt> </tt><a name="(part.__v-osc_rate_bufpos_freq_phase_)"></a>(v-osc rate bufpos freq phase)</h4><p>Variable wavetable oscillator. A wavetable lookup oscillator which
|
||
|
can be swept smoothly across wavetables. All the wavetables must be
|
||
|
allocated to the same size. Fractional values of table will
|
||
|
interpolate between two adjacent tables.</p><p>This oscillator requires a buffer to be filled with a wavetable
|
||
|
format signal. This preprocesses the Signal into a form which can
|
||
|
be used efficiently by the oscillator. The buffer size must be a
|
||
|
power of 2.</p><p>This can be acheived by creating a Buffer object and sending it one
|
||
|
of the "b_gen" messages ( sine1, sine2, sine3 ) with the wavetable
|
||
|
flag set to true.</p><p>This can also be acheived by creating a Signal object and sending
|
||
|
it the ’asWavetable’ message, saving it to disk, and having the
|
||
|
server load it from there.</p><p>Note about wavetables: Vosc requires the b_gen sine1 wavetable flag
|
||
|
to be ON.</p><p>Allocate and fill tables 0 to 7 [see also Vosc3]</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(let* ((square
|
||
|
(lambda (a) (* a a)))
|
||
|
(nth
|
||
|
(lambda (i)
|
||
|
(async fd (b-alloc i 1024 1))
|
||
|
(let* ((n (expt (+ i 1) 2))
|
||
|
(a (map1 (lambda (j) (square (/ (- n j) n)))
|
||
|
(enum-from-to 0 (- n 1)))))
|
||
|
(async fd (b-gen1 i "sine1" (cons 7 a)))))))
|
||
|
(for-each nth (enum-from-to 0 7)))))</p><p>oscillator at buffers 0 through 7.</p><p>(let ((b (mouse-x kr 0 7 0 0.1))
|
||
|
(f (mce2 120 121)))
|
||
|
(audition (out 0 (mul (v-osc ar b f 0) 0.3))))</p><p>Reallocate buffers while oscillator is running.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(for-each
|
||
|
(lambda (i)
|
||
|
(async fd (b-gen1 i "sine1" (cons 7 (replicate-m 16 (random 0 1))))))
|
||
|
(enum-from-to 0 7))))</p><h4>2.104<tt> </tt><a name="(part.__var-saw_rate_freq_iphasewidth_)"></a>(var-saw rate freq iphasewidth)</h4><p>Variable duty saw</p><p>freq - frequency in Hertz
|
||
|
iphase - initial phase offset in cycles ( 0..1 )
|
||
|
width - duty cycle from zero to one.</p><p>(let ((f (mul-add (lf-pulse kr (mce2 3 3.03) 0 0.3) 200 200))
|
||
|
(w (lin-lin (lf-tri kr 1 0) -1 1 0 1)))
|
||
|
(audition (out 0 (mul (var-saw ar f 0 w) 0.1))))</p><h4>2.105<tt> </tt><a name="(part.__import__sosc___rsc3_____let___a__letc___r_1_______________let____r___mul__buf-rate-scale_kr_0__r______________________p__phasor_ar_0_r__0__buf-frames_kr_0__0______________________f__mul-add__lf-noise1_kr_2__300_400______________________i__mul__sin-osc_ar_f_0__0_1__________________mrg2__buf-wr_0_p_1_i______________________out_0_0_0_____________b__letc___r_1_______________let____r___mul__buf-rate-scale_kr_0__r______________________p__phasor_ar_0_r__0__buf-frames_kr_0__0__________________out_0__buf-rd_1_ar_0_p_1_2__________with-sc3_____lambda__fd________async_fd__b-alloc_0____44100_2__1_________send-synth_fd__a__a________send-synth_fd__b__b________send_fd__s-new0__a__1001_1_0_________send_fd__s-new0__b__1002_1_0________define__do-send_m_____with-sc3__lambda__fd___send_fd_m_______do-send__n-set1_1002__r__5_____do-send__n-set1_1001__r___random_0_2______do-send__n-set1_1002__r__2__)"></a>(import (sosc) (rsc3))
|
||
|
|
||
|
(let ((a (letc ((r 1))
|
||
|
(let* ((r* (mul (buf-rate-scale kr 0) r))
|
||
|
(p (phasor ar 0 r* 0 (buf-frames kr 0) 0))
|
||
|
(f (mul-add (lf-noise1 kr 2) 300 400))
|
||
|
(i (mul (sin-osc ar f 0) 0.1)))
|
||
|
(mrg2 (buf-wr 0 p 1 i)
|
||
|
(out 0 0.0)))))
|
||
|
(b (letc ((r 1))
|
||
|
(let* ((r* (mul (buf-rate-scale kr 0) r))
|
||
|
(p (phasor ar 0 r* 0 (buf-frames kr 0) 0)))
|
||
|
(out 0 (buf-rd 1 ar 0 p 1 2))))))
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 0 (* 44100 2) 1))
|
||
|
(send-synth fd "a" a)
|
||
|
(send-synth fd "b" b)
|
||
|
(send fd (s-new0 "a" 1001 1 0))
|
||
|
(send fd (s-new0 "b" 1002 1 0)))))
|
||
|
|
||
|
(define (do-send m)
|
||
|
(with-sc3 (lambda (fd) (send fd m))))
|
||
|
|
||
|
(do-send (n-set1 1002 "r" 5))
|
||
|
|
||
|
(do-send (n-set1 1001 "r" (random 0 2)))
|
||
|
|
||
|
(do-send (n-set1 1002 "r" 2))</h4><h4>2.106<tt> </tt><a name="(part.__import__rsc3_____audition__out_0__mul__impulse_ar_800_0__0_1______let___f__x-line_kr_800_10_5_remove-synth_______audition__out_0__mul__impulse_ar_f_0_0__0_5_______let___f__mouse-y__kr_4_8_0_0_1__________p__mouse-x__kr_0_1_0_0_1_______audition__out_0__mul__impulse_ar_f__mce2_0_p___0_2____)"></a>(import (rsc3))
|
||
|
|
||
|
(audition (out 0 (mul (impulse ar 800 0) 0.1)))
|
||
|
|
||
|
(let ((f (x-line kr 800 10 5 remove-synth)))
|
||
|
(audition (out 0 (mul (impulse ar f 0.0) 0.5))))
|
||
|
|
||
|
(let ((f (mouse-y* kr 4 8 0 0.1))
|
||
|
(p (mouse-x* kr 0 1 0 0.1)))
|
||
|
(audition (out 0 (mul (impulse ar f (mce2 0 p)) 0.2))))</h4><h4>2.107<tt> </tt><a name="(part.__import__rsc3_____audition__out_0__mul__blip_ar_440_200__0_15___)"></a>(import (rsc3))
|
||
|
|
||
|
(audition (out 0 (mul (blip ar 440 200) 0.15)))</h4><p>Modulate frequency
|
||
|
(let ((f (x-line kr 20000 200 6 remove-synth)))
|
||
|
(audition (out 0 (mul (blip ar f 100) 0.2))))</p><p>Modulate number of harmonics.
|
||
|
(let ((h (line kr 1 100 20 remove-synth)))
|
||
|
(audition (out 0 (mul (blip ar 200 h) 0.2))))</p><h4>2.108<tt> </tt><a name="(part.__select_which_array_)"></a>(select which array)</h4><p>The output is selected from an array of inputs.</p><p>(audition
|
||
|
(let* ((a (mce3 (sin-osc ar 440 0) (saw ar 440) (pulse ar 440 0.1)))
|
||
|
(cycle 3/2)
|
||
|
(w (mul-add (lf-saw kr 1 0) cycle cycle)))
|
||
|
(out 0 (mul (select w a) 0.2))))</p><p>Note: all the ugens are continously running. This may not be the
|
||
|
most efficient way if each input is cpu-expensive.</p><p>Here used as a sequencer:</p><p>(audition
|
||
|
(let* ((n 32)
|
||
|
(a (make-mce (map (compose midi-cps u:floor)
|
||
|
(replicate-m n (rand 30 80)))))
|
||
|
(cycle (/ n 2))
|
||
|
(w (mul-add (lf-saw kr 1/2 0) cycle cycle)))
|
||
|
(out 0 (mul (saw ar (select w a)) 0.2))))</p><h4>2.109<tt> </tt><a name="(part.__import__rsc3__)"></a>(import (rsc3))</h4><p>Modulate fundamental frequency, formant frequency stays constant.
|
||
|
(audition
|
||
|
(let ((f (x-line kr 400 1000 8 remove-synth)))
|
||
|
(out 0 (mul (formant ar f 2000 800) 0.125))))</p><p>Modulate formant frequency, fundamental frequency stays constant.
|
||
|
(audition
|
||
|
(let ((f (x-line kr 400 4000 8 remove-synth)))
|
||
|
(out 0 (mul (formant ar (mce2 200 300) f 200) 0.125))))</p><p>Modulate width frequency, other frequencies stay constant.
|
||
|
(audition
|
||
|
(let ((w (x-line kr 800 8000 8 remove-synth)))
|
||
|
(out 0 (mul (formant ar 400 2000 w) 0.125))))</p><h4>2.110<tt> </tt><a name="(part.__import__rsc3_____with-sc3___lambda__fd______async_fd__b-alloc_10_512_1_______async_fd__b-gen1_10__sine1___list____1_2_4__1_1_2_1_3_1_4_1_5_1_6_1_7_1_8_1_9_1_10________audition__out_0__mul__c-osc_ar_10_200_0_7__0_25______audition__out_0__mul__c-osc_ar_10_200__mouse-x__kr_0_4_0_0_1___0_25___)"></a>(import (rsc3))
|
||
|
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 512 1))
|
||
|
(async fd (b-gen1 10 "sine1" (list (+ 1 2 4) 1 1/2 1/3 1/4 1/5 1/6 1/7 1/8 1/9 1/10)))))
|
||
|
|
||
|
(audition (out 0 (mul (c-osc ar 10 200 0.7) 0.25)))
|
||
|
|
||
|
(audition (out 0 (mul (c-osc ar 10 200 (mouse-x* kr 0 4 0 0.1)) 0.25)))</h4><p>Compare with:
|
||
|
(audition (out 0 (mul (osc ar 10 200 0.0) 0.25)))</p><h4>2.111<tt> </tt><a name="(part.__v-osc3_rate_bufpos_freq1_freq2_freq3_)"></a>(v-osc3 rate bufpos freq1 freq2 freq3)</h4><p>Three variable wavetable oscillators.</p><p>A wavetable lookup oscillator which can be swept smoothly across
|
||
|
wavetables. All the wavetables must be allocated to the same
|
||
|
size. Fractional values of table will interpolate between two
|
||
|
adjacent tables. This unit generator contains three oscillators at
|
||
|
different frequencies, mixed together.</p><p>This oscillator requires a buffer to be filled with a wavetable
|
||
|
format signal. This preprocesses the Signal into a form which can
|
||
|
be used efficiently by the oscillator. The buffer size must be a
|
||
|
power of 2.</p><p>This can be acheived by creating a Buffer object and sending it one
|
||
|
of the "b_gen" messages ( sine1, sine2, sine3 ) with the wavetable
|
||
|
flag set to true.</p><p>Note about wavetables: Vosc3 requires the b_gen sine1 wavetable
|
||
|
flag to be ON.</p><p>Allocate and fill tables 0 to 7 with a generated list of harmonic
|
||
|
amplitudes.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(let* ((square
|
||
|
(lambda (a) (* a a)))
|
||
|
(nth
|
||
|
(lambda (i)
|
||
|
(async fd (b-alloc i 1024 1))
|
||
|
(let* ((n (expt (+ i 1) 2))
|
||
|
(a (map (lambda (j)
|
||
|
(square (/ (- n j) n)))
|
||
|
(enum-from-to 0 (- n 1)))))
|
||
|
(async fd (b-gen1 i "sine1" (cons 7 a)))))))
|
||
|
(for-each nth (enum-from-to 0 7)))))</p><p>oscillator at buffers 0 through 7.</p><p>(let ((p (mouse-x kr 0 7 0 0.1))
|
||
|
(f1 (mce2 240 241))
|
||
|
(f2 (mce2 240.27 241.1))
|
||
|
(f3 (mce2 240.43 239.71)))
|
||
|
(audition (out 0 (mul (v-osc3 ar p f1 f2 f3) 0.2))))</p><p>Reallocate buffers while oscillator is running.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(for-each
|
||
|
(lambda (i)
|
||
|
(async fd (b-gen1 i "sine1" (cons 7 (replicate-m 16 (random 0 1))))))
|
||
|
(enum-from-to 0 7))))</p><h4>2.112<tt> </tt><a name="(part.__lf-cub_rate_freq_iphase_)"></a>(lf-cub rate freq iphase)</h4><p>a sine like shape made of two cubic pieces. smoother than lf-par.</p><p>(let ((f (mul-add (lf-cub kr (mul-add (lf-cub kr 0.2 0) 8 10) 0) 400 800)))
|
||
|
(mul (lf-cub ar f 0) 0.1))</p><p>(mul (lf-cub ar (mul-add (lf-cub kr 0.2 0) 400 800) 0) 0.1)
|
||
|
(mul (lf-cub ar 800 0) 0.1)
|
||
|
(mul (lf-cub ar (x-line kr 100 8000 30 do-nothing) 0) 0.1)</p><p>compare:</p><p>(let ((f (mul-add (lf-par kr (mul-add (lf-par kr 0.2 0) 8 10) 0) 400 800)))
|
||
|
(mul (lf-par ar f 0) 0.1))</p><p>(mul (lf-par ar (mul-add (lf-par kr 0.2 0) 400 800) 0) 0.1)
|
||
|
(mul (lf-par ar 800 0) 0.1)
|
||
|
(mul (lf-par ar (x-line kr 100 8000 30 do-nothing) 0) 0.1)</p><p>compare:</p><p>(let ((f (mul-add (sin-osc kr (mul-add (sin-osc kr 0.2 0) 8 10) 0) 400 800)))
|
||
|
(mul (sin-osc ar f 0) 0.1))</p><p>(mul (sin-osc ar (mul-add (sin-osc kr 0.2 0) 400 800) 0) 0.1)
|
||
|
(mul (sin-osc ar 800 0) 0.1)
|
||
|
(mul (sin-osc ar (x-line kr 100 8000 30 do-nothing) 0) 0.1)</p><p>compare:</p><p>(let ((f (mul-add (lf-tri kr (mul-add (lf-tri kr 0.2 0) 8 10) 0) 400 800)))
|
||
|
(mul (lf-tri ar f 0) 0.1))</p><p>(mul (lf-tri ar (mul-add (lf-tri kr 0.2 0) 400 800) 0) 0.1)
|
||
|
(mul (lf-tri ar 800 0) 0.1)
|
||
|
(mul (lf-tri ar (x-line kr 100 8000 30 do-nothing) 0) 0.1)</p><h4>2.113<tt> </tt><a name="(part.__lf-pulse_rate_freq_iphase_width_)"></a>(lf-pulse rate freq iphase width)</h4><p>A non-band-limited pulse oscillator. outputs a high value of one
|
||
|
and a low value of zero. Note that the iphase argument was not
|
||
|
present in SC2.</p><p>freq - frequency in Hertz
|
||
|
iphase - initial phase offset in cycles ( 0..1 )
|
||
|
width - pulse width duty cycle from zero to one.</p><p>(let ((f (mul-add (lf-pulse kr 3 0 0.3) 200 200)))
|
||
|
(audition (out 0 (mul (lf-pulse ar f 0 0.2) 0.1))))</p><h4>2.114<tt> </tt><a name="(part.__import__sosc___rsc3__)"></a>(import (sosc) (rsc3))</h4><p>Allocate and set values at buffer 10.
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 6 1))
|
||
|
(send fd (b-setn1 10 0 (list 50 100 200 400 800 1600)))))</p><p>Index into the above buffer for frequency values.
|
||
|
(let ((f (mul (index 10 (mul (lf-saw kr 2 3) 4)) (mce2 1 9))))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><p>Free buffer
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-free 10))))</p><h4>2.115<tt> </tt><a name="(part._.See_lf-cub_)"></a>See lf-cub.</h4><p>A sine-like shape made of two parabolas. Has audible odd harmonics.</p><h4>2.116<tt> </tt><a name="(part.__sync-saw_rate_sync.Freq_saw.Freq_)"></a>(sync-saw rate syncFreq sawFreq)</h4><p>A sawtooth wave that is hard synched to a fundamental pitch. This
|
||
|
produces an effect similar to moving formants or pulse width
|
||
|
modulation. The sawtooth oscillator has its phase reset when the
|
||
|
sync oscillator completes a cycle. This is not a band limited
|
||
|
waveform, so it may alias.</p><p>The frequency of the slave synched sawtooth wave should always be
|
||
|
greater than the syncFreq.</p><p>(audition
|
||
|
(let ((f (line kr 100 800 12 remove-synth)))
|
||
|
(out 0 (mul (sync-saw ar 100 f) 0.1))))</p><h4>2.117<tt> </tt><a name="(part.__t-choose_trig_array_)"></a>(t-choose trig array)</h4><p>The output is selected randomly on recieving a trigger from an
|
||
|
array of inputs. t-choose is a composite of ti-rand and select.</p><p>(audition
|
||
|
(let* ((t (dust ar (mouse-x kr 1 1000 1 0.1)))
|
||
|
(f (midi-cps (ti-rand 48 60 t)))
|
||
|
(a (mce3 (sin-osc ar f 0)
|
||
|
(saw ar (mul f 2))
|
||
|
(pulse ar (mul f 0.5) 0.1))))
|
||
|
(out 0 (mul (t-choose t a) 0.1))))</p><p>Note: all the ugens are continously running. This may not be the
|
||
|
most efficient way if each input is cpu-expensive.</p><h4>2.118<tt> </tt><a name="(part.__sin-osc_rate_freq_phase_)"></a>(sin-osc rate freq phase)</h4><p>interpolating sine wavetable oscillator. This is the same as osc
|
||
|
except that the table is a sine table of 8192 entries.</p><p>freq - frequency in Hertz
|
||
|
phase - phase offset or modulator in radians</p><p>(audition (out 0 (mul (sin-osc ar 440 0) (mce2 0.15 0.25))))</p><p>Modulate freq</p><p>(let ((f (x-line kr 2000 200 1 remove-synth)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.5))))</p><p>Modulate freq</p><p>(let* ((f1 (x-line kr 1 1000 9 remove-synth))
|
||
|
(f2 (mul-add (sin-osc ar f1 0) 200 800)))
|
||
|
(audition (out 0 (mul (sin-osc ar f2 0) 0.25))))</p><p>Modulate phase</p><p>(let* ((f (x-line kr 20 8000 10 remove-synth))
|
||
|
(p (mul (sin-osc ar f 0) (* pi 2))))
|
||
|
(audition (out 0 (mul (sin-osc ar 800 p) 0.25))))</p><h4>2.119<tt> </tt><a name="(part.__klang_rate_freq.Scale_freq.Offset_spec_)"></a>(klang rate freqScale freqOffset spec)</h4><p>Bank of fixed oscillators. The UGen assistant klang.spec can help
|
||
|
create the ’spec’ entry. Note that the SC3 language reorders the
|
||
|
inputs, the rsc3 client does not.</p><p>(let ((d (klang-data ’(440 550 660 770 880 990 1000)
|
||
|
’(0.05 0.02 0.07 0.04 0.05 0.02 0.03)
|
||
|
(replicate 7 0))))
|
||
|
(audition (out 0 (klang ar 1 0 d))))</p><h4>2.120<tt> </tt><a name="(part.__lag-in_num-channels_bus_lag_)"></a>(lag-in num-channels bus lag)</h4><p>Set bus 10.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send fd (c-set1 10 (random 200 8000)))))</p><p>Smooth a control rate input signal.</p><p>(audition (out 0 (mul (sin-osc ar (lag-in 1 10 1) 0) 0.1)))</p><h4>2.121<tt> </tt><a name="(part.__sound-in_channel_)"></a>(sound-in channel)</h4><p>Read audio from the sound input hardware.</p><p>channel - input channel number to read,
|
||
|
indexed from zero, can be mce.</p><p>(audition (out 0 (sound-in 0)))</p><p>(audition (out 0 (sound-in (mce2 0 1))))</p><p>(audition (out 0 (sound-in (mce4 0 2 1 3))))</p><h4>2.122<tt> </tt><a name="(part.__in_num-channels_rate_bus_)"></a>(in num-channels rate bus)</h4><p>Read signal from an audio or control bus.</p><p>Patching input to output.</p><p>(audition (out 0 (in 2 ar num-output-buses)))</p><p>Patching input to output, with summed delay.</p><p>(let ((i (in 2 ar num-input-buses)))
|
||
|
(audition (out 0 (add i (delay-n i 0.5 0.5)))))</p><p>Write noise to bus 10, then read it out. The Mrg is ordered.</p><p>(audition (mrg2 (out 0 (in 1 ar 10))
|
||
|
(out 10 (mul (pink-noise ar) 0.3))))</p><p>Reading a control bus.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send fd (c-set1 0 (random 200 5000)))))</p><p>(audition (out 0 (mul (sin-osc ar (in 1 kr 0) 0) 0.1)))</p><h4>2.123<tt> </tt><a name="(part.__in-trig_num-channels_bus_)"></a>(in-trig num-channels bus)</h4><p>Generate a trigger anytime a bus is set.</p><p>Any time the bus is "touched" ie. has its value set (using "/c_set"
|
||
|
etc.), a single impulse trigger will be generated. Its amplitude
|
||
|
is the value that the bus was set to.</p><p>Run an oscillator with the trigger at bus 10.</p><p>(let* ((t (in-trig 1 10))
|
||
|
(p (env-perc 0.01 1 1 (list -4 -4)))
|
||
|
(e (env-gen kr t t 0 1 do-nothing p))
|
||
|
(f (mul-add (latch t t) 440 880)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) e))))</p><p>Set bus 10.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send fd (c-set1 10 0.5))))</p><h4>2.124<tt> </tt><a name="(part.__replace-out_bufferindex_inputs_)"></a>(replace-out bufferindex inputs)</h4><p>Send signal to a bus, overwrite existing signal.</p><p>(audition
|
||
|
(mrg3 (out 0 (mul (sin-osc ar (mce2 330 331) 0) 0.1))
|
||
|
(replace-out 0 (mul (sin-osc ar (mce2 880 881) 0) 0.1))
|
||
|
(out 0 (mul (sin-osc ar (mce2 120 121) 0) 0.1))))</p><p>Compare to:</p><p>(audition
|
||
|
(mrg3 (out 0 (mul (sin-osc ar (mce2 330 331) 0) 0.1))
|
||
|
(out 0 (mul (sin-osc ar (mce2 880 881) 0) 0.1))
|
||
|
(out 0 (mul (sin-osc ar (mce2 120 121) 0) 0.1))))</p><h4>2.125<tt> </tt><a name="(part.__local-in_num-channels_rate_)"></a>(local-in num-channels rate)</h4><p>Define and read from buses local to a SynthDef</p><p>num-channels - the number of channels of local buses.</p><p>Localin defines buses that are local to the SynthDef. These are
|
||
|
like the global buses, but are more convenient if you want to
|
||
|
implement a self contained effect that uses a feedback processing
|
||
|
loop. There can only be one audio rate and one control rate
|
||
|
Localin per SynthDef. The audio can be written to the bus using
|
||
|
local-out.</p><p>(let* ((a0 (mul (decay (impulse ar 0.3 0) 0.1) (mul (white-noise ar) 0.2)))
|
||
|
(a1 (add (local-in 2 ar) (mce2 a0 0)))
|
||
|
(a2 (delay-n a1 0.2 0.2)))
|
||
|
(audition (mrg2 (local-out (mul (mce-reverse a2) 0.8))
|
||
|
(out 0 a2))))</p><h4>2.126<tt> </tt><a name="(part.__offset-out_bufferindex_inputs_)"></a>(offset-out bufferindex inputs)</h4><p>output signal to a bus, the sample offset within the bus is kept
|
||
|
exactly. This ugen is used where sample accurate output is needed.</p><p>(audition
|
||
|
(mrg2 (offset-out 0 (impulse ar 5 0))
|
||
|
(out 0 (mul (sin-osc ar 60 0) 0.1))))</p><p>(audition
|
||
|
(mrg2 (out 0 (impulse ar 5 0))
|
||
|
(out 0 (mul (sin-osc ar 60 0) 0.1))))</p><h4>2.127<tt> </tt><a name="(part.__in-feedback_num-channels_bus_)"></a>(in-feedback num-channels bus)</h4><p>Read signal from a bus without erasing it, audio rate.</p><p>The output (out) ugens overwrite data on the bus, giving this bus a
|
||
|
new timestamp so that any input (in) ugen can check if the data was
|
||
|
written within the current cycle. The next cycle this data is still
|
||
|
there, but in case of audio one normally doesn’t want an in ugen to
|
||
|
read it again, as it might cause feedback.</p><p>This is the reason why in ar checks the timestamp and ignores
|
||
|
everything that was not written within this cycle. This means that
|
||
|
nodes can only read data from a bus that was written by a
|
||
|
preceeding node when using the in ar ugen which overwrites the old
|
||
|
data. This is good for audio, but for control data it is more
|
||
|
convenient to be able to read a bus from any place in the node
|
||
|
order.</p><p>This is why in kr behaves differently and reads also data with a
|
||
|
timestamp that is one cycle old. Now in some cases we want to be
|
||
|
able to read audio from a bus independant of the current node
|
||
|
order, which is the use of inFeedback. The delay introduced by
|
||
|
this is at a maximum one block size, which equals about 0.0014 sec
|
||
|
at the default block size and sample rate.</p><p>Audio feedback modulation.</p><p>(let ((f (mul-add (in-feedback 1 0) 1300 300)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.4))))</p><p>Evaluate these in either order and hear both tones.</p><p>(let ((b (add num-input-buses num-output-buses)))
|
||
|
(audition (out 0 (in-feedback 1 b))))</p><p>(let ((b (add num-input-buses num-output-buses)))
|
||
|
(audition (mrg2 (out b (mul (sin-osc ar 440 0) 0.1))
|
||
|
(out 0 (mul (sin-osc ar 660 0) 0.1)))))</p><p>Doubters consult this.</p><p>(let ((b (add num-input-buses num-output-buses)))
|
||
|
(audition (out 0 (in 1 ar b))))</p><p>Resonator, see localout for variant.</p><p>(let* ((b (add num-input-buses num-output-buses))
|
||
|
(p (in-feedback 1 b))
|
||
|
(i (impulse ar 1 0))
|
||
|
(d (delay-c (add i (mul p 0.995))
|
||
|
1
|
||
|
(sub (recip 440) (recip control-rate)))))
|
||
|
(audition (mrg2 (offset-out b d) (offset-out 0 p))))</p><p>Compare with oscillator.</p><p>(audition (out 1 (mul (sin-osc ar 440 0) 0.2)))</p><h4>2.128<tt> </tt><a name="(part.__x-out_buffer-index_xfade_inputs_)"></a>(x-out buffer-index xfade inputs)</h4><p>Send signal to a bus, crossfading with existing contents.</p><p>(let ((pair (lambda (a b) (mul (sin-osc ar (mce2 a b) 0) 0.1))))
|
||
|
(audition
|
||
|
(mrg4 (out 0 (pair 220 221))
|
||
|
(x-out 0 (mouse-x kr 0 1 0 0.1) (pair 330 331))
|
||
|
(x-out 0 (mouse-y kr 0 1 0 0.1) (pair 440 441))
|
||
|
(out 0 (pair 120 121)))))</p><h4>2.129<tt> </tt><a name="(part.__out_bufferindex_inputs_)"></a>(out bufferindex inputs)</h4><p>Send signal to an audio or control buss, mix with existing signal.
|
||
|
The user is responsible for making sure that the number of channels
|
||
|
match and that there are no conflicts.</p><p>(audition (out 0 (mul (sin-osc ar (mce2 330 331) 0) 0.1)))</p><h4>2.130<tt> </tt><a name="(part.__mix_.U.Gen_)"></a>(mix UGen)</h4><p>Force multiple channel expansion and sum signals.</p><p>(let ((f (make-mce (list 600.2 622.0 641.3 677.7))))
|
||
|
(audition (out 0 (mul (mix (f-sin-osc ar f 0)) 0.1))))</p><p>Expansion nests.</p><p>(let ((l (f-sin-osc ar (mce2 100 500) 0))
|
||
|
(r (f-sin-osc ar (mce2 5000 501) 0)))
|
||
|
(audition (out 0 (mul 0.05 (mix (mce2 l r))))))</p><h4>2.131<tt> </tt><a name="(part.__mix-fill_n_f____let___n_6_________o__lambda______mul__f-sin-osc_ar__rand_200_700__0__0_1________audition__out_0__mix-fill_n_o____)"></a>(mix-fill n f)
|
||
|
|
||
|
(let ((n 6)
|
||
|
(o (lambda (_) (mul (f-sin-osc ar (rand 200 700) 0) 0.1))))
|
||
|
(audition (out 0 (mix-fill n o))))</h4><h4>2.132<tt> </tt><a name="(part.__latch_in_trig_)"></a>(latch in trig)</h4><p>Sample and hold. Holds input signal value when triggered.</p><p>in - input signal.
|
||
|
trig - trigger. The trigger can be any signal. A trigger happens when the
|
||
|
signal changes from non-positive to positive.</p><p>(audition
|
||
|
(out 0 (mul (blip ar (mul-add (latch (white-noise ar) (impulse ar 9 0))
|
||
|
400 500) 4)
|
||
|
0.2)))</p><p>The above is just meant as example. lf-noise0 is a faster way to
|
||
|
generate random steps :</p><p>(audition
|
||
|
(out 0 (mul (blip ar (mul-add (lf-noise0 kr 9) 400 500) 4) 0.2)))</p><p>http://create.ucsb.edu/pipermail/sc-users/2006-December/029991.html</p><p>(let* ((n0 (mul-add (lf-noise2 kr 8) 200 300))
|
||
|
(n1 (mul-add (lf-noise2 kr 3) 10 20))
|
||
|
(s (blip ar n0 n1))
|
||
|
(x (mouse-x kr 1000 (mul sample-rate 0.1) 1 0.1)))
|
||
|
(audition
|
||
|
(out 0 (latch s (impulse ar x 0)))))</p><h4>2.133<tt> </tt><a name="(part.__decay_in_decay.Time_)"></a>(decay in decayTime)</h4><p>Exponential decay. This is essentially the same as integrator
|
||
|
except that instead of supplying the coefficient directly, it is
|
||
|
caculated from a 60 dB decay time. This is the time required for
|
||
|
the integrator to lose 99.9 % of its value or -60dB. This is useful
|
||
|
for exponential decaying envelopes triggered by impulses.</p><p>Used as an envelope.</p><p>(audition
|
||
|
(out 0 (mul (decay (impulse ar (x-line kr 1 50 20 remove-synth) 0.25) 0.2)
|
||
|
(pink-noise ar))))</p><h4>2.134<tt> </tt><a name="(part.__wrap-index_bufnum_in_)"></a>(wrap-index bufnum in)</h4><p>index into a table with a signal.</p><p>The input signal value is truncated to an integer value and used as
|
||
|
an index into the table. out of range index values are wrapped
|
||
|
cyclically to the valid range.</p><p>bufnum - index of the buffer
|
||
|
in - the input signal.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 0 6 1))
|
||
|
(send fd (b-setn1 0 0 (list 200 300 400 500 600 800)))
|
||
|
(let ((f (wrap-index 0 (mouse-x kr 0 18 0 0.1))))
|
||
|
(play fd (out 0 (mul (sin-osc ar f 0) 0.5))))))</p><h4>2.135<tt> </tt><a name="(part.__mouse-y_rate_minval_maxval_warp_lag_)"></a>(mouse-y rate minval maxval warp lag)</h4><p>Report mouse location on root window of the machine that the
|
||
|
synthesis server is running on. For a linear mapping set warp to
|
||
|
0, for an exponential mapping set warp to 1.</p><p>(audition
|
||
|
(out 0 (mul (sin-osc ar (mouse-x kr 20 2000 0 0.1) 0)
|
||
|
(mouse-y kr 0.01 0.1 0 0.1))))</p><h4>2.136<tt> </tt><a name="(part.__degree-to-key_bufnum_in_octave_)"></a>(degree-to-key bufnum in octave)</h4><p>Convert signal to modal pitch</p><p>The input signal value is truncated to an integer value and used as
|
||
|
an index into an octave repeating table of note values. indices
|
||
|
wrap around the table and shift octaves as they do.</p><p>bufnum - index of the buffer which contains the steps for each
|
||
|
scale degree.</p><p>in - the input signal.</p><p>octave - the number of steps per octave in the scale.</p><p>(let* ((b 0)
|
||
|
(p (list 0 2 3.2 5 7 9 10))
|
||
|
(x (mouse-x kr 0 15 0 0.1))
|
||
|
(k (degree-to-key 0 x 12))
|
||
|
(c (lambda (n r)
|
||
|
(let* ((o (mul (sin-osc ar (midi-cps (add3 r k n)) 0) 0.1))
|
||
|
(t (lf-pulse ar (midi-cps (mce2 48 55)) 0.15 0.5))
|
||
|
(f (midi-cps (mul-add (sin-osc kr 0.1 0) 10 r)))
|
||
|
(d (mul (rlpf t f 0.1) 0.1))
|
||
|
(m (add o d)))
|
||
|
(add (comb-n m 0.31 0.31 2) m)))))
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 0 7 1))
|
||
|
(send fd (b-setn1 0 0 p))
|
||
|
(let ((n (mul (lf-noise1 kr (mce2 3 3.05)) 0.04)))
|
||
|
(play fd (out 0 (mul (add (c n 48) (c n 72)) 0.25)))))))</p><h4>2.137<tt> </tt><a name="(part.__key-state_rate_keynum_minval_maxval_lag_)"></a>(key-state rate keynum minval maxval lag)</h4><p>Report the status of a particular key. A key is either pressed,
|
||
|
or not pressed.</p><p>The keycode 38 is the A key on my keyboard. Under X the xev(1)
|
||
|
command is useful in determining your keyboard layout.</p><p>(audition
|
||
|
(out 0 (mul (sin-osc ar 800 0)
|
||
|
(key-state kr 38 0 0.1 0.5))))</p><h4>2.138<tt> </tt><a name="(part.__mrg2_left_right_)"></a>(mrg2 left right)</h4><p>mrg2 defines a node indicating a multiple root graph.</p><p>(let ((l (out 0 (mul (sin-osc ar 300 0) 0.1)))
|
||
|
(r (out 1 (mul (sin-osc ar 900 0) 0.1))))
|
||
|
(audition
|
||
|
(mrg2 l r)))</p><p>there is a leftmost rule, so that mrg nodes need not
|
||
|
be terminal.</p><p>(let ((l (mul (sin-osc ar 300 0) 0.1))
|
||
|
(r (out 1 (mul (sin-osc ar 900 0) 0.1))))
|
||
|
(audition (out 0 (mrg2 l r))))</p><p>the leftmost node may be an mce node</p><p>(let ((l (mul (sin-osc ar (mce2 300 400) 0) 0.1))
|
||
|
(r (out 1 (mul (sin-osc ar 900 0) 0.1))))
|
||
|
(audition (out 0 (mrg2 l r))))</p><p>the implementation is not thorough</p><p>(let ((l (mul (sin-osc ar (mce2 300 400) 0) 0.1))
|
||
|
(r (out 1 (mul (sin-osc ar 900 0) 0.1))))
|
||
|
(audition (out 0 (add (mrg2 l r)
|
||
|
(mrg2 l r)))))</p><h4>2.139<tt> </tt><a name="(part.__mouse-button_rate_minval_maxval_lag_)"></a>(mouse-button rate minval maxval lag)</h4><p>Report the status of the first pointer button. The button is
|
||
|
either pressed, or not pressed.</p><p>(audition
|
||
|
(out 0 (mul (sin-osc ar 800 0)
|
||
|
(mouse-button kr 0 0.1 0.1))))</p><h4>2.140<tt> </tt><a name="(part.__slew_in_up_dn_)"></a>(slew in up dn)</h4><p>Has the effect of removing transients and higher frequencies.</p><p>(audition
|
||
|
(out 0 (slew (mul (saw ar 800) 0.2) 400 400)))</p><h4>2.141<tt> </tt><a name="(part.__mouse-x_rate_minval_maxval_warp_lag_)"></a>(mouse-x rate minval maxval warp lag)</h4><p>Cursor UGen. Report mouse location on root window of the machine
|
||
|
that the synthesis server is running on. For a linear mapping set
|
||
|
warp to 0, for an exponential mapping set warp to 1.</p><p>(import (rsc3))</p><p>(audition
|
||
|
(out 0 (mul (sin-osc ar (mouse-x kr 40 10000 1 0.1) 0) 0.1)))</p><p>(audition
|
||
|
(out 0 (mce2 (mul (sin-osc ar (mouse-x kr 20 2000 1 0.1) 0)
|
||
|
(mouse-y kr 0.01 0.1 0 0.1))
|
||
|
(mul (sin-osc ar (mouse-y kr 20 2000 1 0.1) 0)
|
||
|
(mouse-x kr 0.01 0.1 0 0.1)))))</p><p>Auto-pilot variant
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar (mouse-x* kr 40 10000 1 0.1) 0) 0.1)))</p><h4>2.142<tt> </tt><a name="(part.__decay2_in_attack.Time_decay.Time_)"></a>(decay2 in attackTime decayTime)</h4><p>Exponential decay. decay has a very sharp attack and can produce
|
||
|
clicks. decay2 rounds off the attack by subtracting one decay from
|
||
|
another.</p><p>(decay2 in a d) is equivalent to (sub (decay in d) (Decay in a)).</p><p>Used as an envelope</p><p>(audition
|
||
|
(out 0 (mul (decay2 (impulse ar (x-line kr 1 50 20 remove-synth) 0.25)
|
||
|
0.01
|
||
|
0.2)
|
||
|
(mul (f-sin-osc ar 600 0) 0.25))))</p><p>Compare the above with decay used as the envelope.</p><p>(audition
|
||
|
(out 0 (mul (decay (impulse ar (x-line kr 1 50 20 remove-synth) 0.25)
|
||
|
0.01)
|
||
|
(mul (f-sin-osc ar 600 0) 0.25))))</p><h4>2.143<tt> </tt><a name="(part.__k2a_in_)"></a>(k2a in)</h4><p>Control rate to audio rate converter.</p><p>To be able to play a control rate UGen into an audio rate UGen,
|
||
|
sometimes the rate must be converted. k2a converts via linear
|
||
|
interpolation.</p><p>in - input signal</p><p>(audition
|
||
|
(out 0 (k2a (mul (white-noise kr) 0.3))))</p><p>(audition
|
||
|
(out 0 (mce2 (k2a (mul (white-noise kr) 0.3))
|
||
|
(mul (white-noise ar) 0.3))))</p><p>(let* ((block-size 64) no ugen for this?
|
||
|
(freq (mul (fdiv (mouse-x kr 0.1 40 1 0.1) block-size) sample-rate)))
|
||
|
(audition
|
||
|
(out 0 (mul (mce2 (k2a (lf-noise0 kr freq))
|
||
|
(lf-noise0 ar freq))
|
||
|
0.3))))</p><h4>2.144<tt> </tt><a name="(part.__mul-add_a_b_c_)"></a>(mul-add a b c)</h4><p>Functionally equivalent to (add (mul a b) c).</p><p>(let ((f (mul-add (lf-saw kr (mce2 10 9) 0) 200 400)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><p>(let ((f (add (mul (lf-saw kr (mce2 10 9) 0) 200) 400)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.145<tt> </tt><a name="(part.__clip2_a_b_)"></a>(clip2 a b)</h4><p>Bilateral clipping. clips a to +/- b</p><p>(audition
|
||
|
(out 0 (clip2 (f-sin-osc ar 400 0) 0.2)))</p><p>(audition
|
||
|
(out 0 (clip2 (f-sin-osc ar 400 0) (line kr 0 1 8 remove-synth))))</p><h4>2.146<tt> </tt><a name="(part.__.Atan2_x_y_)"></a>(Atan2 x y)</h4><p>Returns the arctangent of y/x.</p><p>See also hypot.</p><p>add a pan to the hypot doppler examples by using atan2 to find the
|
||
|
azimuth, or direction angle, of the sound source. Assume speakers
|
||
|
at +/- 45 degrees and clip the direction to between those.</p><p>(let* ((x 10)
|
||
|
(y (mul (lf-saw kr 1/6 0) 100))
|
||
|
(distance (hypot x y))
|
||
|
(amplitude (fdiv 40 (squared distance)))
|
||
|
(sound (rlpf (mul (f-sin-osc ar 200 0) (lf-pulse ar 31.3 0 0.4)) 400 0.3))
|
||
|
(azimuth (atan2 y x))
|
||
|
(loc (clip2 (fdiv azimuth (/ pi 2)) 1)))
|
||
|
(audition
|
||
|
(out 0 (pan2 (delay-l sound 110/344 (fdiv distance 344))
|
||
|
loc
|
||
|
amplitude))))</p><h4>2.147<tt> </tt><a name="(part.__trunc_a_b_)"></a>(trunc a b)</h4><p>Truncate a to a multiple of b.</p><p>(let* ((x (mouse-x kr 60 4000 0 0.1))
|
||
|
(f (trunc x 100)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.148<tt> </tt><a name="(part.__sub_a_b_)"></a>(sub a b)</h4><p>subtraction, written ’-’ in sclang.</p><p>Silence.</p><p>(let ((z (f-sin-osc ar 800 0)))
|
||
|
(audition
|
||
|
(out 0 (sub z z))))</p><h4>2.149<tt> </tt><a name="(part.__round-up_a_b_)"></a>(round-up a b)</h4><p>Rounds a up to the nearest multiple of b.</p><p>(let* ((x (mouse-x kr 60 4000 0 0.1))
|
||
|
(f (round-up x 100)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><p>(let ((n (line kr 24 108 6 remove-synth)))
|
||
|
(audition
|
||
|
(out 0 (mul (saw ar (midi-cps (round-up n 1))) 0.2))))</p><h4>2.150<tt> </tt><a name="(part.__ring4_a_b_)"></a>(ring4 a b)</h4><p>Ring modulation variant. Return the value of ((a*a *b) -
|
||
|
(a*b*b)). This is more efficient than using separate unit
|
||
|
generators for the multiplies.</p><p>See also mul, ring1, ring2, ring3.</p><p>(audition
|
||
|
(out 0 (mul (ring4 (f-sin-osc ar 800 0)
|
||
|
(f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0))
|
||
|
0.125)))</p><p>(let ((a (f-sin-osc ar 800 0))
|
||
|
(b (f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0)))
|
||
|
(audition
|
||
|
(out 0 (mul (sub (mul3 a a b) (mul3 a b b))
|
||
|
0.125))))</p><h4>2.151<tt> </tt><a name="(part.__pow_a_b_)"></a>(pow a b)</h4><p>Exponentiation, written ** in sclang. When the signal is negative
|
||
|
this function extends the usual definition of exponentiation and
|
||
|
returns neg(neg(a) ** b). This allows exponentiation of negative
|
||
|
signal values by noninteger exponents.</p><p>(audition
|
||
|
(out 0 (let ((a (mul (f-sin-osc ar 100 0) 0.1)))
|
||
|
(mce2 a (pow a 10)))))</p><p>http://create.ucsb.edu/pipermail/sc-users/2006-December/029998.html</p><p>(let* ((n0 (mul-add (lf-noise2 kr 8) 200 300))
|
||
|
(n1 (mul-add (lf-noise2 kr 3) 10 20))
|
||
|
(s (blip ar n0 n1))
|
||
|
(x (mouse-x kr 1000 (mul sample-rate 0.5) 1 0.1))
|
||
|
(y (mouse-y kr 1 24 1 0.1))
|
||
|
(d (latch s (impulse ar x 0)))
|
||
|
(b (u:round d (pow 0.5 y))))
|
||
|
(audition
|
||
|
(out 0 (mce2 d b))))</p><h4>2.152<tt> </tt><a name="(part.__ring1_a_b_)"></a>(ring1 a b)</h4><p>Ring modulation plus first source. Return the value of ((a*b) +
|
||
|
a). This is more efficient than using separate unit generators for
|
||
|
the multiply and add.</p><p>See also mul, Ring1, Ring2, Ring3, Ring4.</p><p>(audition
|
||
|
(out 0 (mul (ring1 (f-sin-osc ar 800 0)
|
||
|
(f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0))
|
||
|
0.125)))</p><p>(let ((a (f-sin-osc ar 800 0))
|
||
|
(b (f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0)))
|
||
|
(audition
|
||
|
(out 0 (mul (add (mul a b) a) 0.125))))</p><h4>2.153<tt> </tt><a name="(part.__gt_a_b_)"></a>(gt a b)</h4><p>Greater than, written ’>’ in sclang. Signal is 1.0 if a > b,
|
||
|
otherwise it is 0.0. Similarly LT is <, GE >=, LE <= and EQ ==.
|
||
|
These can be useful for triggering purposes, among other things.</p><p>(let* ((o (sin-osc kr 1 0))
|
||
|
(t (list (gt o 0)
|
||
|
(ge o 0)
|
||
|
(lt o 0)
|
||
|
(le o 0)
|
||
|
(eq o 0)
|
||
|
(mul (lt o 0.001) (gt o -0.001))))
|
||
|
(f (list 220
|
||
|
330
|
||
|
440
|
||
|
550
|
||
|
660
|
||
|
770))
|
||
|
(p (env-perc 0.01 1 1 (list -4 -4)))
|
||
|
(e (env-gen kr (make-mce t) 0.1 0 1 do-nothing p)))
|
||
|
(audition (out 0 (mix (mul (sin-osc ar (make-mce f) 0) e)))))</p><h4>2.154<tt> </tt><a name="(part.__add_a_b_)"></a>(add a b)</h4><p>addition, written ’+’ in sclang.</p><p>(audition
|
||
|
(out 0 (add (mul (f-sin-osc ar 800 0) 0.1)
|
||
|
(mul (pink-noise ar) 0.1))))</p><p>DC offset.</p><p>(audition
|
||
|
(out 0 (add (f-sin-osc ar 440 0) 0.1)))</p><h4>2.155<tt> </tt><a name="(part.__abs-dif_a_b_)"></a>(abs-dif a b)</h4><p>Calculates the value of (abs (- a b). Finding the magnitude of the
|
||
|
difference of two values is a common operation.</p><p>(audition
|
||
|
(out 0 (mul (f-sin-osc ar 440 0)
|
||
|
(abs-dif 0.2 (mul (f-sin-osc ar 2 0) 0.5)))))</p><h4>2.156<tt> </tt><a name="(part.__am-clip_a_b_)"></a>(am-clip a b)</h4><p>Two quadrant multiply, 0 when b <= 0, a*b when b > 0</p><p>(audition
|
||
|
(out 0 (am-clip (white-noise ar)
|
||
|
(mul (f-sin-osc kr 1 0) 0.2))))</p><h4>2.157<tt> </tt><a name="(part.__ge_a_b_)"></a>(ge a b)</h4><p>See gt</p><h4>2.158<tt> </tt><a name="(part.__max_a_b_)"></a>(max a b)</h4><p>Maximum.</p><p>(audition
|
||
|
(out 0 (let ((z (f-sin-osc ar 500 0)))
|
||
|
(u:max z (f-sin-osc ar 0.1 0)))))</p><h4>2.159<tt> </tt><a name="(part.__ring3_a_b_)"></a>(ring3 a b)</h4><p>Ring modulation variant. Return the value of (a * a * b). This is
|
||
|
more efficient than using separate unit generators for the
|
||
|
multiplies.</p><p>See also mul, ring1, ring2, ring4.</p><p>(audition
|
||
|
(out 0 (mul (ring3 (f-sin-osc ar 800 0)
|
||
|
(f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0))
|
||
|
0.125)))</p><p>(let ((a (f-sin-osc ar 800 0))
|
||
|
(b (f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0)))
|
||
|
(audition
|
||
|
(out 0 (mul4 a a b 0.125))))</p><h4>2.160<tt> </tt><a name="(part.__thresh_a_b_)"></a>(thresh a b)</h4><p>Signal thresholding. 0 when a < b, otherwise a.</p><p>(audition
|
||
|
(out 0 (thresh (mul (lf-noise0 ar 50) 0.5) 0.45)))</p><h4>2.161<tt> </tt><a name="(part.__dif-sqr_a_b_)"></a>(dif-sqr a b)</h4><p>Difference of squares. Return the value of (a*a) - (b*b). This is
|
||
|
more efficient than using separate unit generators for each
|
||
|
operation.</p><p>(audition
|
||
|
(out 0 (mul (dif-sqr (f-sin-osc ar 800 0)
|
||
|
(f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0))
|
||
|
0.125)))</p><p>(audition
|
||
|
(out 0 (let ((a (f-sin-osc ar 800 0))
|
||
|
(b (f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0)))
|
||
|
(mul (sub (mul a a) (mul b b)) 0.125))))</p><h4>2.162<tt> </tt><a name="(part.__excess_a_b_)"></a>(excess a b)</h4><p>clipping residual. Returns the difference of the original signal
|
||
|
and its clipped form: (a - clip2(a,b)).</p><p>(audition
|
||
|
(out 0 (excess (f-sin-osc ar 1000 0) (line kr 0 1 8 do-nothing))))</p><p>(audition
|
||
|
(out 0 (let ((a (f-sin-osc ar 1000 0))
|
||
|
(b (line kr 0 1 8 do-nothing)))
|
||
|
(sub a (clip2 a b)))))</p><h4>2.163<tt> </tt><a name="(part.__fold2_a_b_)"></a>(fold2 a b)</h4><p>Bilateral folding. folds a to +/- b.</p><p>(audition
|
||
|
(out 0 (fold2 (f-sin-osc ar 1000 0)
|
||
|
(line kr 0 1 8 do-nothing))))</p><h4>2.164<tt> </tt><a name="(part.__sqr-dif_a_b_)"></a>(sqr-dif a b)</h4><p>Square of the difference. Return the value of (a - b)**2. This is
|
||
|
more efficient than using separate unit generators for each
|
||
|
operation.</p><p>(audition
|
||
|
(out 0 (mul (sqr-dif (f-sin-osc ar 800 0)
|
||
|
(f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0))
|
||
|
0.125)))</p><p>(let ((a (f-sin-osc ar 800 0))
|
||
|
(b (f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0)))
|
||
|
(audition
|
||
|
(out 0 (mul (mul (sub a b) (sub a b))
|
||
|
0.125))))</p><h4>2.165<tt> </tt><a name="(part.__hypot_x_y_)"></a>(hypot x y)</h4><p>Returns the square root of the sum of the squares of a and b. Or
|
||
|
equivalently, the distance from the origin to the point (x, y).</p><p>(audition
|
||
|
(out 0 (mul (sin-osc ar 440 0)
|
||
|
(hypot (mouse-x kr 0 0.1 0 0.1)
|
||
|
(mouse-y kr 0 0.1 0 0.1)))))</p><p>Object travels 200 meters in 6 secs (=120kph) passing 10 meters
|
||
|
from the listener. The speed of sound is 344 meters/sec.</p><p>(let* ((x 10)
|
||
|
(y (mul (lf-saw kr 1/6 0) 100))
|
||
|
(distance (hypot x y))
|
||
|
(velocity (slope distance))
|
||
|
(pitch-ratio (fdiv (sub 344 velocity) 344))
|
||
|
(amplitude (fdiv 10 (squared distance))))
|
||
|
(audition
|
||
|
(out 0 (mul (f-sin-osc ar (mul 1000 pitch-ratio) 0)
|
||
|
amplitude))))</p><p>(let* ((x 10)
|
||
|
(y (mul (lf-saw kr 1/6 0) 100))
|
||
|
(distance (hypot x y))
|
||
|
(amplitude (fdiv 40 (squared distance)))
|
||
|
(sound (rlpf (mul (f-sin-osc ar 200 0) (lf-pulse ar 31.3 0 0.4)) 400 0.3)))
|
||
|
(audition
|
||
|
(out 0 (mul (delay-l sound 110/344 (fdiv distance 344))
|
||
|
amplitude))))</p><h4>2.166<tt> </tt><a name="(part.__sqr-sum_a_b_)"></a>(sqr-sum a b)</h4><p>Square of the difference. Return the value of (a + b)**2. This is
|
||
|
more efficient than using separate unit generators for each
|
||
|
operation.</p><p>(audition
|
||
|
(out 0 (mul (sqr-sum (f-sin-osc ar 800 0)
|
||
|
(f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0))
|
||
|
0.125)))</p><p>(let ((a (f-sin-osc ar 800 0))
|
||
|
(b (f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0)))
|
||
|
(audition
|
||
|
(out 0 (mul (mul (add a b) (add a b))
|
||
|
0.125))))</p><h4>2.167<tt> </tt><a name="(part.__sum-sqr_a_b_)"></a>(sum-sqr a b)</h4><p>Return the value of (a*a) + (b*b). This is more efficient than
|
||
|
using separate unit generators for each operation.</p><p>(audition
|
||
|
(out 0 (mul (sum-sqr (f-sin-osc ar 800 0)
|
||
|
(f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0))
|
||
|
0.125)))</p><p>(let ((a (f-sin-osc ar 800 0))
|
||
|
(b (f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0)))
|
||
|
(audition
|
||
|
(out 0 (mul (add (mul a a) (mul b b)) 0.125))))</p><h4>2.168<tt> </tt><a name="(part.__le_a_b_)"></a>(le a b)</h4><p>See gt</p><h4>2.169<tt> </tt><a name="(part._.See_gt)"></a>See gt</h4><h4>2.170<tt> </tt><a name="(part.__scale-neg_a_b_)"></a>(scale-neg a b)</h4><p>Scale negative part of input wave. a * b when a < 0, otherwise a.</p><p>(audition
|
||
|
(out 0 (scale-neg (f-sin-osc ar 500 0) (line ar 1 -1 4 remove-synth))))</p><h4>2.171<tt> </tt><a name="(part.__ring2_a_b_)"></a>(ring2 a b)</h4><p>Ring modulation plus both sources. Return the value of ((a*b) + a
|
||
|
+ b). This is more efficient than using separate unit generators
|
||
|
for the multiply and add.</p><p>See also mul, Ring1, Ring3, Ring4.</p><p>(audition
|
||
|
(out 0 (mul (ring2 (f-sin-osc ar 800 0)
|
||
|
(f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0))
|
||
|
0.125)))</p><p>(let ((a (f-sin-osc ar 800 0))
|
||
|
(b (f-sin-osc ar (x-line kr 200 500 5 do-nothing) 0)))
|
||
|
(audition
|
||
|
(out 0 (mul (add3 (mul a b) a b) 0.125))))</p><h4>2.172<tt> </tt><a name="(part.__.Mod_a_b_)"></a>(Mod a b)</h4><p>Modulo, written % in sclang. outputs a modulo b.</p><p>(audition
|
||
|
(out 0 (u:mod (f-sin-osc ar 100 4) 1)))</p><h4>2.173<tt> </tt><a name="(part.__fdiv_a_b_)"></a>(fdiv a b)</h4><p>Division, written ’/’ in sclang.</p><p>Division can be tricky with signals because of division by zero.</p><p>(audition
|
||
|
(out 0 (fdiv (mul (pink-noise ar) 0.1)
|
||
|
(mul (f-sin-osc kr 10 0.5) 0.75))))</p><h4>2.174<tt> </tt><a name="(part.__mul_a_b_)"></a>(mul a b)</h4><p>multiplication, written ’*’ in sclang.</p><p>(audition
|
||
|
(out 0 (mul (sin-osc ar 440 0) 0.5)))</p><p>Creates a beating effect (subaudio rate).</p><p>(audition
|
||
|
(out 0 (mul3 (f-sin-osc kr 10 0)
|
||
|
(pink-noise ar)
|
||
|
0.5)))</p><p>Ring modulation.</p><p>(audition
|
||
|
(out 0 (mul3 (sin-osc ar (x-line kr 100 1001 10 do-nothing) 0)
|
||
|
(sync-saw ar 100 200)
|
||
|
0.25)))</p><h4>2.175<tt> </tt><a name="(part.__min_a_b_)"></a>(min a b)</h4><p>Minimum.</p><p>(audition
|
||
|
(out 0 (let ((z (f-sin-osc ar 500 0)))
|
||
|
(u:min z (f-sin-osc ar 0.1 0)))))</p><h4>2.176<tt> </tt><a name="(part.__lt_a_b_)"></a>(lt a b)</h4><p>See gt</p><h4>2.177<tt> </tt><a name="(part.__wrap2_a_b_)"></a>(wrap2 a b)</h4><p>Bilateral wrapping. wraps input wave to +/- b.</p><p>(audition
|
||
|
(out 0 (wrap2 (f-sin-osc ar 1000 0)
|
||
|
(line kr 0 1.01 8 do-nothing))))</p><h4>2.178<tt> </tt><a name="(part.__round_a_b_)"></a>(round a b)</h4><p>Rounds a to the nearest multiple of b.</p><p>(let* ((x (mouse-x kr 60 4000 0 0.1))
|
||
|
(f (u:round x 100)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><p>(let ((n (line kr 24 108 6 remove-synth)))
|
||
|
(audition
|
||
|
(out 0 (mul (saw ar (midi-cps (u:round n 1))) 0.2))))</p><h4>2.179<tt> </tt><a name="(part.__hasher_in_)"></a>(hasher in)</h4><p>Returns a unique output value from zero to one for each input value
|
||
|
according to a hash function. The same input value will always
|
||
|
produce the same output value. The input need not be from zero to
|
||
|
one.</p><p>(audition (out 0 (mul (hasher (line ar 0 1 1 2)) 0.2)))</p><h4>2.180<tt> </tt><a name="(part.__rand-seed_rate_trig_seed_)"></a>(rand-seed rate trig seed)</h4><p>When the trigger signal changes from nonpositive to positve, the
|
||
|
synth’s random generator seed is reset to the given value. All
|
||
|
other synths that use the same random number generator reproduce
|
||
|
the same sequence of numbers again.</p><p>See also: randID.</p><p>Start a noise patch</p><p>(let ((n (add (mul (white-noise ar) (mce2 0.05 0.05)) (dust2 ar (mce2 70 70))))
|
||
|
(f (mul-add (lf-noise1 kr 3) 5500 6000)))
|
||
|
(audition (out 0 (add (resonz (mul n 5) f 0.5) (mul n 0.5)))))</p><p>Reset the seed at a variable rate.</p><p>(audition (mrg2 (rand-seed kr (impulse kr (mouse-x kr 0.1 100 0 0.1) 0) 1956)
|
||
|
0))</p><h4>2.181<tt> </tt><a name="(part.__lfd-noise0_rate_freq_)"></a>(lfd-noise0 rate freq)</h4><p>(lfd-noise1 rate freq)
|
||
|
(lfd-noise3 rate freq)</p><p>lfd-noise0: Dynamic step noise. Like lf-noise0, it generates random
|
||
|
values at a rate given by the freq argument, with two differences:
|
||
|
no time quantization, and fast recovery from low freq values.</p><p>lfd-noise1: Dynamic ramp noise. Like lf-noise1, it generates linearly
|
||
|
interpolated random values at a rate given by the freq argument,
|
||
|
with two differences: no time quantization, and fast recovery from
|
||
|
low freq values.</p><p>lfd-noise3: Dynamic cubic noise. Like Lf-Noise3, it generates
|
||
|
linearly interpolated random values at a rate given by the freq
|
||
|
argument, with two differences: no time quantization, and fast
|
||
|
recovery from low freq values.</p><p>lf-noise0,1,3 quantize to the nearest integer division of the
|
||
|
samplerate, and they poll the freq argument only when scheduled,
|
||
|
and thus seem to hang when freqs get very low).</p><p>If you don’t need very high or very low freqs, or use fixed freqs,
|
||
|
lf-noise0,1,3 is more efficient.</p><p>Try wiggling mouse quicklyLf-Noise frequently seems stuck,
|
||
|
LFDNoise changes smoothly.</p><p>(audition
|
||
|
(out 0 (mul (lf-noise0 ar (mouse-x kr 0.1 1000 1 0.1)) 0.1)))</p><p>(audition
|
||
|
(out 0 (mul (lfd-noise0 ar (mouse-x kr 0.1 1000 1 0.1)) 0.1)))</p><p>silent for 2 secs before going up in freq</p><p>(audition
|
||
|
(out 0 (mul (lf-noise0 ar (x-line kr 0.5 10000 3 remove-synth)) 0.1)))</p><p>(audition
|
||
|
(out 0 (mul (lfd-noise0 ar (x-line kr 0.5 10000 3 remove-synth)) 0.1)))</p><p>lf-noise quantizes time steps at high freqs, lfd-noise does not:</p><p>(audition
|
||
|
(out 0 (mul (lf-noise0 ar (x-line kr 1000 20000 10 remove-synth)) 0.1)))</p><p>(audition
|
||
|
(out 0 (mul (lfd-noise0 ar (x-line kr 1000 20000 10 remove-synth)) 0.1)))</p><h4>2.182<tt> </tt><a name="(part.__lfclip-noise_rate_freq_)"></a>(lfclip-noise rate freq)</h4><p>randomly generates the values -1 or +1 at a rate given by the
|
||
|
nearest integer division of the sample rate by the freq argument.
|
||
|
It is probably pretty hard on your speakers. The freq argument is
|
||
|
the approximate rate at which to generate random values.</p><p>(audition (out 0 (mul (lfclip-noise ar 1000) 0.1)))</p><p>Modulate frequency</p><p>(let ((f (x-line kr 1000 10000 10 remove-synth)))
|
||
|
(audition (out 0 (mul (lfclip-noise ar f) 0.1))))</p><p>Use as frequency control</p><p>(let ((f (mul-add (lfclip-noise kr 4) 200 600)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><h4>2.183<tt> </tt><a name="(part._.See_lf-noise0)"></a>See lf-noise0</h4><h4>2.184<tt> </tt><a name="(part.__clip-noise_rate_)"></a>(clip-noise rate)</h4><p>Generates noise whose values are either -1 or 1. This produces the
|
||
|
maximum energy for the least peak to peak amplitude.</p><p>(audition (out 0 (mul (clip-noise ar) 0.2)))</p><h4>2.185<tt> </tt><a name="(part.__ti-rand_lo_hi_trig_)"></a>(ti-rand lo hi trig)</h4><p>Generates a random integer value in uniform distribution from lo to
|
||
|
hi each time the trig signal changes from nonpositive to positive
|
||
|
values</p><p>(let ((p (ti-rand -1 1 (dust kr 10))))
|
||
|
(audition (out 0 (pan2 (pink-noise ar) p 0.2))))</p><p>(let ((f (mul-add (ti-rand 4 12 (dust kr 10)) 150 (mce2 0 1))))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.186<tt> </tt><a name="(part.__lf-noise0_rate_freq_)"></a>(lf-noise0 rate freq)</h4><p>(lf-noise1 rate freq)
|
||
|
(lf-noise2 rate freq)</p><p>lf-noise0 is step noise. Generates random values at a rate given by
|
||
|
the nearest integer division of the sample rate by the freq
|
||
|
argument.</p><p>lf-noise1 is ramp noise. Generates linearly interpolated random
|
||
|
values at a rate given by the nearest integer division of the
|
||
|
sample rate by the freq argument.</p><p>lf-noise2 is quadratic noise. Generates quadratically interpolated
|
||
|
random values at a rate given by the nearest integer division of
|
||
|
the sample rate by the freq argument.</p><p>(audition (out 0 (mul (lf-noise0 ar 1000) 0.25)))
|
||
|
(audition (out 0 (mul (lf-noise1 ar 1000) 0.25)))
|
||
|
(audition (out 0 (mul (lf-noise2 ar 1000) 0.25)))</p><p>Modulate frequency.</p><p>(audition (out 0 (mul (lf-noise0 ar (x-line kr 1000 10000 10 remove-synth)) 0.25)))
|
||
|
(audition (out 0 (mul (lf-noise1 ar (x-line kr 1000 10000 10 remove-synth)) 0.25)))
|
||
|
(audition (out 0 (mul (lf-noise2 ar (x-line kr 1000 10000 10 remove-synth)) 0.25)))</p><p>Use as frequency control.</p><p>(audition (out 0 (mul (sin-osc ar (mul-add (lf-noise0 kr 4) 400 450) 0) 0.2)))
|
||
|
(audition (out 0 (mul (sin-osc ar (mul-add (lf-noise1 kr 4) 400 450) 0) 0.2)))
|
||
|
(audition (out 0 (mul (sin-osc ar (mul-add (lf-noise2 kr 4) 400 450) 0) 0.2)))</p><h4>2.187<tt> </tt><a name="(part.__pink-noise_rate_)"></a>(pink-noise rate)</h4><p>Generates noise whose spectrum falls off in power by 3 dB per
|
||
|
octave. This gives equal power over the span of each octave. This
|
||
|
version gives 8 octaves of pink noise.</p><p>(audition (out 0 (mul (pink-noise ar) 0.25)))</p><h4>2.188<tt> </tt><a name="(part.__rand_lo_hi_)"></a>(rand lo hi)</h4><p>Generates a single random value in uniform distribution from lo to
|
||
|
hi. It generates this when the SynthDef first starts playing, and
|
||
|
remains fixed for the duration of the synth’s existence.</p><p>(let* ((a (line kr 0.2 0 0.1 2))
|
||
|
(p (rand -1 1))
|
||
|
(s (mul (f-sin-osc ar (rand 200 1200) 0) a)))
|
||
|
(audition (out 0 (pan2 s p 1))))</p><h4>2.189<tt> </tt><a name="(part.__gray-noise_rate_)"></a>(gray-noise rate)</h4><p>Generates noise which results from flipping random bits in a word.
|
||
|
This type of noise has a high RMS level relative to its peak to
|
||
|
peak level. The spectrum is emphasized towards lower frequencies.</p><p>(audition (out 0 (mul (gray-noise ar) 0.1)))</p><h4>2.190<tt> </tt><a name="(part._.See_lfd-noise0)"></a>See lfd-noise0</h4><h4>2.191<tt> </tt><a name="(part.__i-rand_lo_hi_)"></a>(i-rand lo hi)</h4><p>Generates a single random integer value in uniform distribution
|
||
|
from ‘lo’ to ‘hi’.</p><p>(let ((f (i-rand 200 1200))
|
||
|
(a (line kr 0.2 0 0.1 remove-synth)))
|
||
|
(audition (out 0 (mul (f-sin-osc ar f 0) a))))</p><h4>2.192<tt> </tt><a name="(part.__n-rand_lo_hi_n_)"></a>(n-rand lo hi n)</h4><p>Generates a single random float value in a sum of ‘n’ uniform
|
||
|
distributions from ‘lo’ to ‘hi’.</p><p>n = 1 : uniform distribution - same as rand
|
||
|
n = 2 : triangular distribution
|
||
|
n = 3 : smooth hump
|
||
|
as n increases, distribution converges towards gaussian</p><p>(let ((f (mul (n-rand 1200 4000 2) (mce2 2 5)))
|
||
|
(a (line kr 0.2 0 0.01 remove-synth)))
|
||
|
(audition (out 0 (mul (f-sin-osc ar f 0) a))))</p><h4>2.193<tt> </tt><a name="(part.__lfdclip-noise_rate_freq_)"></a>(lfdclip-noise rate freq)</h4><p>Like lfclip-noise, it generates the values -1 or +1 at a rate given
|
||
|
by the freq argument, with two differences: no time quantization,
|
||
|
and fast recovery from low freq values.</p><p>(lfclip-noise, as well as lf-noise0,1,2 quantize to the nearest
|
||
|
integer division of the samplerate, and they poll the freq argument
|
||
|
only when scheduled, and thus seem to hang when freqs get very
|
||
|
low).</p><p>If you don’t need very high or very low freqs, or use fixed freqs,
|
||
|
lfclip-noise is more efficient.</p><p>Try wiggling mouse quicklyLFNoise frequently seems stuck,
|
||
|
LFDNoise changes smoothly.</p><p>(let ((f (mul-add (lfclip-noise ar (mouse-x kr 0.1 1000 1 0.1)) 200 500)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><p>(let ((f (mul-add (lfdclip-noise ar (mouse-x kr 0.1 1000 1 0.1)) 200 500)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><p>LFNoise quantizes time steps at high freqs, LFDNoise does not:</p><p>(let ((f (x-line kr 1000 20000 10 remove-synth)))
|
||
|
(audition (out 0 (mul (lfclip-noise ar f) 0.1))))</p><p>(let ((f (x-line kr 1000 20000 10 remove-synth)))
|
||
|
(audition (out 0 (mul (lfdclip-noise ar f) 0.1))))</p><h4>2.194<tt> </tt><a name="(part.__coin-gate_prob_in_)"></a>(coin-gate prob in)</h4><p>When it receives a trigger, it tosses a coin, and either passes the
|
||
|
trigger or doesn’t.</p><p>(let ((f (t-rand 300 400 (Coingate 0.8 (impulse kr 10 0)))))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><p>(let* ((p 0.2)
|
||
|
(t (mul (impulse ar 20 0) (add (sin-osc kr 0.5 0) 1)))
|
||
|
(t* (t-exp-rand (Mce 1000 1000) 12000 t))
|
||
|
(i (lambda () (Coingate (+ p (rand 0 0.1)) (mul t 0.5))))
|
||
|
(s (lambda () (ringz (i) t* 0.01)))
|
||
|
(ignore (lambda (f) (lambda (_) (f)))))
|
||
|
(audition (out 0 (mix/fill 3 (ignore s)))))</p><h4>2.195<tt> </tt><a name="(part.__t-exp-rand_lo_hi_trig_)"></a>(t-exp-rand lo hi trig)</h4><p>Generates a random float value in exponential distribution from lo
|
||
|
to hi each time the trig signal changes from nonpositive to
|
||
|
positive values lo and hi must both have the same sign and be
|
||
|
non-zero.</p><p>(let* ((t (dust kr 10))
|
||
|
(f (t-exp-rand 300 3000 t)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><h4>2.196<tt> </tt><a name="(part.__t-rand_lo_hi_trig_)"></a>(t-rand lo hi trig)</h4><p>Generates a random float value in uniform distribution from lo each
|
||
|
time the trig signal changes from nonpositive to positive values</p><p>(let* ((t (dust kr (mce2 5 12)))
|
||
|
(f (t-rand (mce2 200 1600) (mce2 500 3000) t)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))</p><h4>2.197<tt> </tt><a name="(part.__white-noise_rate_)"></a>(white-noise rate)</h4><p>Generates noise whose spectrum has equal power at all frequencies.</p><p>(audition (out 0 (mul (white-noise ar) 0.15)))</p><p>Noise generators constructors are unique, to share noise UGens
|
||
|
values must be explictly stored and reused.</p><p>(audition (out 0 (mul (sub (white-noise ar) (white-noise ar)) 0.15)))</p><p>(let ((n (white-noise ar)))
|
||
|
(audition (out 0 (sub n n))))</p><h4>2.198<tt> </tt><a name="(part.__dust2_rate_density_)"></a>(dust2 rate density)</h4><p>Generates random impulses from -1 to +1. The ‘density’ is in
|
||
|
impulses per second.</p><p>(audition (out 0 (mul (dust2 ar 200) 0.5)))</p><p>(let ((r (x-line kr 20000 2 10 remove-synth)))
|
||
|
(audition (out 0 (mul (dust2 ar r) 0.5))))</p><h4>2.199<tt> </tt><a name="(part._.See_lfd-noise0)"></a>See lfd-noise0</h4><h4>2.200<tt> </tt><a name="(part.__rand-id_rate_id_)"></a>(rand-id rate id)</h4><p>Choose which random number generator to use for this synth. All
|
||
|
synths that use the same generator reproduce the same sequence of
|
||
|
numbers when the same seed is set again.</p><p>See also: rand-seed.</p><p>Graphs to generate noise in the context of a given RNG and to reset
|
||
|
a specified RNG.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send-synth
|
||
|
fd "r"
|
||
|
(letc ((bus 0)
|
||
|
(id 1))
|
||
|
(mrg2 (rand-id ir id)
|
||
|
(out bus (add (mul (white-noise ar) 0.05)
|
||
|
(dust2 ar 70))))))
|
||
|
(send-synth
|
||
|
fd "s"
|
||
|
(letc ((seed 1910) (id 1))
|
||
|
(mrg2 (rand-id kr id)
|
||
|
(rand-seed kr
|
||
|
(impulse kr (mul-add (f-sin-osc kr 0.2 0) 10 11) 0)
|
||
|
seed))))))</p><p>Start two noise synths on left and right channel with a different randgen id</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send fd (s-new2 "r" 1001 1 1 "bus" 0 "id" 1))
|
||
|
(send fd (s-new2 "r" 1002 1 1 "bus" 1 "id" 2))))</p><p>Reset the seed of randgen 1</p><p>(with-sc3 (lambda (fd) (send fd (s-new1 "s" 1003 1 1 "id" 1))))</p><p>Change the target RNG with ID 2, ie. effect right channel.</p><p>(with-sc3 (lambda (fd) (send fd (n-set1 1003 "id" 2))))</p><p>free noise nodes.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send fd (n-free1 1001))
|
||
|
(send fd (n-free1 1002))
|
||
|
(send fd (n-free1 1003))))</p><h4>2.201<tt> </tt><a name="(part._.See_lf-noise0)"></a>See lf-noise0</h4><h4>2.202<tt> </tt><a name="(part.__mantissa-mask_in_bits_)"></a>(mantissa-mask in bits)</h4><p>Masks off bits in the mantissa of the floating point sample
|
||
|
value. This introduces a quantization noise, but is less severe
|
||
|
than linearly quantizing the signal.</p><p>in - input signal
|
||
|
bits - the number of mantissa bits to preserve. a number from 0 to 23.</p><p>(let ((s (mul (sin-osc ar (mul-add (sin-osc kr 0.2 0) 400 500) 0) 0.4)))
|
||
|
(audition (out 0 (mantissa-mask s 3))))</p><h4>2.203<tt> </tt><a name="(part.__dust_rate_density_)"></a>(dust rate density)</h4><p>Generates random impulses from 0 to +1 at a rate determined by the
|
||
|
density argument.</p><p>(audition (out 0 (mul (dust ar 200) 0.5)))</p><p>(let ((r (x-line kr 20000 2 10 remove-synth)))
|
||
|
(audition (out 0 (mul (dust ar r) 0.5))))</p><h4>2.204<tt> </tt><a name="(part.__lin-rand_lo_hi_minmax_)"></a>(lin-rand lo hi minmax)</h4><p>Generates a single random float value in linear distribution from
|
||
|
lo to hi, skewed towards lo if minmax < 0, otherwise skewed towards
|
||
|
hi.</p><p>(let ((f (lin-rand 200 10000 (mce2 -1 1)))
|
||
|
(a (line kr 0.4 0 0.01 remove-synth)))
|
||
|
(audition (out 0 (mul (f-sin-osc ar f 0) a))))</p><h4>2.205<tt> </tt><a name="(part.__exp-rand_lo_hi_)"></a>(exp-rand lo hi)</h4><p>Generates a single random float value in an exponential
|
||
|
distributions from ‘lo’ to ‘hi’.</p><p>(let ((f (exp-rand 100 8000))
|
||
|
(a (line kr 0.5 0 0.01 remove-synth)))
|
||
|
(audition (out 0 (mul (f-sin-osc ar f 0) a))))</p><h4>2.206<tt> </tt><a name="(part.__brown-noise_rate_)"></a>(brown-noise rate)</h4><p>Generates noise whose spectrum falls off in power by 6 dB per
|
||
|
octave.</p><p>(audition (out 0 (mul (brown-noise ar) 0.1)))</p><h4>2.207<tt> </tt><a name="(part.__u_log_a_)"></a>(u:log a)</h4><p>Reciprocal.</p><p>(let* ((a (line ar -2 2 2 remove-synth))
|
||
|
(b (u:log a))
|
||
|
(f (mul-add (mce2 a b) 600 900)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.208<tt> </tt><a name="(part.__frac_a_)"></a>(frac a)</h4><p>Fractional part.</p><p>(let* ((a (line ar -2 2 3 remove-synth))
|
||
|
(b (frac a))
|
||
|
(f (mul-add (mce2 a b) 600 900)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.209<tt> </tt><a name="(part.__arc-tan_a_)"></a>(arc-tan a)</h4><p>Arc tan.</p><p>(let* ((a (line kr -1 1 1 remove-synth))
|
||
|
(b (sub (fdiv (arc-tan a) (/ pi 2)) 1))
|
||
|
(f (mul-add b 900 1600)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.210<tt> </tt><a name="(part.__distort_a_)"></a>(distort a)</h4><p>Nonlinear distortion.</p><p>(audition
|
||
|
(out 0 (mul (distort (mul (f-sin-osc ar 500 0.0)
|
||
|
(x-line kr 0.1 10 10 do-nothing)))
|
||
|
0.25)))</p><h4>2.211<tt> </tt><a name="(part.__tan-h_a_)"></a>(tan-h a)</h4><p>Tangent.</p><p>(let* ((a (line kr (- pi) pi 1 remove-synth))
|
||
|
(b (sub (fdiv (tan-h a) (/ pi 2)) 1))
|
||
|
(f (mul-add b 900 1600)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.212<tt> </tt><a name="(part.__u_floor_a_)"></a>(u:floor a)</h4><p>Round signal down.</p><p>(let* ((x (mouse-x kr 65 95 0 0.1))
|
||
|
(f (midi-cps (u:floor x))))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.213<tt> </tt><a name="(part.__cps-oct_a_)"></a>(cps-oct a)</h4><p>Convert cycles per second to decimal octaves.</p><p>(audition
|
||
|
(let ((f (oct-cps (cps-oct (x-line kr 600 900 6 remove-synth)))))
|
||
|
(out 0 (mul (saw ar f) 0.2))))</p><h4>2.214<tt> </tt><a name="(part.__db-amp_a_)"></a>(db-amp a)</h4><p>Convert decibels to linear amplitude.</p><p>(audition
|
||
|
(out 0 (mul (f-sin-osc ar 800 0.0)
|
||
|
(db-amp (line kr -3 -40 10 remove-synth)))))</p><h4>2.215<tt> </tt><a name="(part.__u_sqrt_a_)"></a>(u:sqrt a)</h4><p>Square root. The definition of square root is extended for signals
|
||
|
so that sqrt(a) when a<0 returns -sqrt(-a).</p><p>(let* ((a (line ar -2 2 3 remove-synth))
|
||
|
(b (u:sqrt a))
|
||
|
(f (mul-add (mce2 a b) 600 900)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.216<tt> </tt><a name="(part.__soft-clip_a_)"></a>(soft-clip a)</h4><p>Nonlinear distortion. Distortion with a perfectly linear region
|
||
|
from -0.5 to +0.5.</p><p>(audition
|
||
|
(out 0 (mul (soft-clip (mul (f-sin-osc ar 500 0.0)
|
||
|
(x-line kr 0.1 10 10 do-nothing)))
|
||
|
0.25)))</p><h4>2.217<tt> </tt><a name="(part.__cps-midi_a_)"></a>(cps-midi a)</h4><p>Convert cycles per second to MIDI note.</p><p>(let ((f (line kr 600 900 5 remove-synth)))
|
||
|
(audition
|
||
|
(out 0 (mul (saw ar (midi-cps (cps-midi f))) 0.1))))</p><h4>2.218<tt> </tt><a name="(part.__is-strictly-positive_a_)"></a>(is-strictly-positive a)</h4><p>Predicate to determine if a value is strictly positive.</p><p>(define (is-strictly-positive a)
|
||
|
(gt a 0.0))</p><p>(let* ((a (line ar -1 1 1 remove-synth))
|
||
|
(b (is-strictly-positive a))
|
||
|
(f (mul-add (mce2 a b) 600 900)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.219<tt> </tt><a name="(part.__u_tan_a_)"></a>(u:tan a)</h4><p>Tangent.</p><p>(let* ((a (line kr (- pi) pi 1 remove-synth))
|
||
|
(b (sub (fdiv (u:tan a) (/ pi 2)) 1))
|
||
|
(f (mul-add b 900 1600)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.220<tt> </tt><a name="(part.__cos-h_a_)"></a>(cos-h a)</h4><p>Cosine.</p><p>(let* ((a (line kr (- pi) pi 1 remove-synth))
|
||
|
(b (sub (fdiv (cos-h a) (/ pi 2)) 1))
|
||
|
(f (mul-add b 900 1600)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.221<tt> </tt><a name="(part.__amp-db_a_)"></a>(amp-db a)</h4><p>Convert linear amplitude to decibels.</p><p>(audition
|
||
|
(out 0 (mul (f-sin-osc ar 800 0.0)
|
||
|
(db-amp (amp-db (line kr 0.5 0.0 5 remove-synth))))))</p><p>(let* ((x (mouse-x kr -60 0 0 0.1))
|
||
|
(f (mul-add (db-amp x) 600 900)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.222<tt> </tt><a name="(part.__abs_a_)"></a>(abs a)</h4><p>Absolute value.</p><p>(audition (out 0 (u:abs (mul (sync-saw ar 100 440) 0.1))))</p><h4>2.223<tt> </tt><a name="(part.__log10_a_)"></a>(log10 a)</h4><p>Base ten logarithm.</p><p>(let* ((a (line ar -2 2 3 remove-synth))
|
||
|
(b (log10 a))
|
||
|
(f (mul-add (mce2 a b) 600 900)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.224<tt> </tt><a name="(part.__midi-cps_a_)"></a>(midi-cps a)</h4><p>Convert MIDI note to cycles per second.</p><p>(audition
|
||
|
(out 0 (mul (saw ar (midi-cps (line kr 24 108 10 remove-synth))) 0.2)))</p><h4>2.225<tt> </tt><a name="(part.__is-positive_a_)"></a>(is-positive a)</h4><p>Predicate to determine if a value is positive.</p><p>(define (is-positive a)
|
||
|
(ge a 0.0))</p><p>(let* ((a (line ar -1 1 1 remove-synth))
|
||
|
(b (is-positive a))
|
||
|
(f (mul-add (mce2 a b) 600 900)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.226<tt> </tt><a name="(part.__sign_a_)"></a>(sign a)</h4><p>Sign function. -1 when a < 0, +1 when a > 0, 0 when a is 0</p><p>(let* ((a (line ar -1 1 1 remove-synth))
|
||
|
(b (sign a))
|
||
|
(f (mul-add (mce2 a b) 600 900)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.227<tt> </tt><a name="(part.__neg_a_)"></a>(neg a)</h4><p>Negation.</p><p>(let ((s (sin-osc ar 440 0)))
|
||
|
(audition
|
||
|
(out 0 (mce2 (mul s 0.1)
|
||
|
(add s (neg s))))))</p><h4>2.228<tt> </tt><a name="(part.__log2_a_)"></a>(log2 a)</h4><p>Base two logarithm.</p><p>(let* ((a (line ar -2 2 3 remove-synth))
|
||
|
(b (log2 a))
|
||
|
(f (mul-add (mce2 a b) 600 900)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.229<tt> </tt><a name="(part.__ceil_a_)"></a>(ceil a)</h4><p>Round signal up.</p><p>(let* ((x (mouse-x kr 65 95 0 0.1))
|
||
|
(f (midi-cps (mce2 (u:floor x) (ceil x)))))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.230<tt> </tt><a name="(part.__arc-cos_a_)"></a>(arc-cos a)</h4><p>Arc cosine.</p><p>(let* ((a (line kr -1 1 1 remove-synth))
|
||
|
(b (sub (fdiv (arc-cos a) (/ pi 2)) 1))
|
||
|
(f (mul-add b 900 1600)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.231<tt> </tt><a name="(part.__exp_a_)"></a>(exp a)</h4><p>Exponential.</p><p>(let* ((a (line ar -2 2 3 remove-synth))
|
||
|
(b (u:exp a))
|
||
|
(f (mul-add (mce2 a b) 600 900)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.232<tt> </tt><a name="(part.__squared_a_)"></a>(squared a)</h4><p>Square.</p><p>(let* ((a (line ar -2 2 3 remove-synth))
|
||
|
(b (squared a))
|
||
|
(f (mul-add (mce2 a b) 600 900)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.233<tt> </tt><a name="(part.__arc-sin_a_)"></a>(arc-sin a)</h4><p>Arc sine.</p><p>(let* ((a (line kr -1 1 1 remove-synth))
|
||
|
(b (sub (fdiv (arc-sin a) (/ pi 2)) 1))
|
||
|
(f (mul-add b 900 1600)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.234<tt> </tt><a name="(part.__cubed_a_)"></a>(cubed a)</h4><p>Cube.</p><p>(let* ((a (line ar -2 2 3 remove-synth))
|
||
|
(b (cubed a))
|
||
|
(f (mul-add (mce2 a b) 600 900)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.235<tt> </tt><a name="(part.__is-negative_a_)"></a>(is-negative a)</h4><p>Predicate to determine if a value is negative.</p><p>(define (is-negative a)
|
||
|
(lt a 0.0))</p><p>(let* ((a (line ar -1 1 1 remove-synth))
|
||
|
(b (is-negative a))
|
||
|
(f (mul-add (mce2 a b) 600 900)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.236<tt> </tt><a name="(part.__oct-cps_a_)"></a>(oct-cps a)</h4><p>Convert decimal octaves to cycles per second.</p><p>(audition
|
||
|
(let ((f (oct-cps (line kr 2 9 6 remove-synth))))
|
||
|
(out 0 (mul (saw ar f) 0.2))))</p><p>(audition
|
||
|
(let ((f (oct-cps (u:round (line kr 2 9 6 remove-synth) (/ 1 12)))))
|
||
|
(out 0 (mul (saw ar f) 0.2))))</p><h4>2.237<tt> </tt><a name="(part.__u_sin_a_)"></a>(u:sin a)</h4><p>Sine.</p><p>(let* ((a (line kr (- pi) pi 1 remove-synth))
|
||
|
(b (sub (fdiv (u:sin a) (/ pi 2)) 1))
|
||
|
(f (mul-add b 900 1600)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.238<tt> </tt><a name="(part.__sin-h_a_)"></a>(sin-h a)</h4><p>Sine.</p><p>(let* ((a (line kr (- pi) pi 1 remove-synth))
|
||
|
(b (sub (fdiv (sin-h a) (/ pi 2)) 1))
|
||
|
(f (mul-add b 900 1600)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.239<tt> </tt><a name="(part.__cos_a_)"></a>(cos a)</h4><p>Cosine.</p><p>(let* ((a (line kr (- pi) pi 1 remove-synth))
|
||
|
(b (sub (fdiv (u:cos a) (/ pi 2)) 1))
|
||
|
(f (mul-add b 900 1600)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.240<tt> </tt><a name="(part.__pv-mul_buffer.A_buffer.B_)"></a>(pv-mul bufferA bufferB)</h4><h4>2.241<tt> </tt><a name="(part.__pv-mag-squared_buffer_)"></a>(pv-mag-squared buffer)</h4><h4>2.242<tt> </tt><a name="(part.__pv-min_buffer.A_buffer.B_)"></a>(pv-min bufferA bufferB)</h4><h4>2.243<tt> </tt><a name="(part.__pv-mag-noise_buffer_)"></a>(pv-mag-noise buffer)</h4><p>Magnitudes are multiplied with noise.</p><p>buffer - fft buffer.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))
|
||
|
(async fd (b-alloc-read 12 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let* ((a (play-buf 1 12 (buf-rate-scale kr 12) 0 0 1))
|
||
|
(f (fft* 10 a))
|
||
|
(h (pv-mag-noise f)))
|
||
|
(audition (out 0 (mul (ifft* h) 0.5))))</p><h4>2.244<tt> </tt><a name="(part.__pv-mag-below_buffer_threshold_)"></a>(pv-mag-below buffer threshold)</h4><p>Pass bins below a threshold. Pass only bands where the magnitude
|
||
|
is below ‘threshold’. This value is not normalized and is
|
||
|
therefore dependant on the buffer size.</p><p>See pv-mag-above</p><h4>2.245<tt> </tt><a name="(part.__convolution_in_kernel_framesize_)"></a>(convolution in kernel framesize)</h4><p>Strict convolution of two continuously changing inputs. Also see
|
||
|
[convolution2] for a cheaper CPU cost alternative for the case of a
|
||
|
fixed kernel which can be changed with a trigger message.</p><p>in - processing target
|
||
|
kernel - processing kernel.
|
||
|
framesize - size of fft frame, must be a power of two</p><p>(audition
|
||
|
(let ((input (sound-in (mce2 0 1)))
|
||
|
(kernel (white-noise ar)))
|
||
|
(out 0 (mul (convolution input kernel 2048) 0.1))))</p><p>(let ((a 2048)
|
||
|
(b 0))
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc b a 1))
|
||
|
(send fd (b-set1 b 0 1.0))
|
||
|
(replicate-m 100 (send fd (b-set1 b (random-integer a) (random 0.0 1.0))))
|
||
|
(play fd (out 0 (mul (convolution
|
||
|
(sound-in (mce2 0 1))
|
||
|
(play-buf 1 b (buf-rate-scale kr b) 1 0 1)
|
||
|
(* 2 a))
|
||
|
0.2))))))</p><h4>2.246<tt> </tt><a name="(part.__pv-jensen-andersen_buffer_propsc_prophfe_prophfc_propsf_threshold_waittime_______fft_feature_detector_for_onset_detection_based_on_work_described_in_.Jensen_.K____.Andersen__.T__.H___2003___.Real-time_.Beat_.Estimation_.Using_.Feature_.Extraction__in_.Proceedings_of_the_.Computer_.Music_.Modeling_and_.Retrieval_.Symposium__.Lecture_.Notes_in_.Computer_.Science__springer_.Verlag___.First_order_derivatives_of_the_features_are_taken__.Threshold_may_need_to_be_set_low_to_pick_up_on_changes___buffer____-_fft_buffer_to_read_from__propsc____-_.Proportion_of_spectral_centroid_feature__prophfe___-_.Proportion_of_high_frequency_energy_feature__prophfc___-_.Proportion_of_high_frequency_content_feature__propsf____-_.Proportion_of_spectral_flux_feature__threshold_-_.Threshold_level_for_allowing_a_detection_waittime__-_.If_triggered__minimum_wait_until_a_further_frame_can_____________cause_another_spot__useful_to_stop_multiple_detects_on_____________heavy_signals___.Default_values_in_sclang_are__propsc~3d0_25__prophfe~3d0_25__prophfc~3d0_25__propsf~3d0_25__threshold~3d1_0__waittime~3d0_04________with-sc3___lambda__fd______async_fd__b-alloc_0_2048_1_______let____source__sound-in_0___________detect__pv-jensen-andersen__fft__0_source____________________________________0_25_0_25_0_25_0_25____________________________________mouse-x_kr_0_01_1_0_1_0_1____________________________________0_04_______audition_____out_0__mul__sin-osc_ar__mce2_440_445__0__________________decay__mul_0_1_detect__0_1_____)"></a>(pv-jensen-andersen buffer propsc prophfe prophfc propsf threshold waittime)
|
||
|
|
||
|
#|
|
||
|
|
||
|
fft feature detector for onset detection based on work described in
|
||
|
Jensen,K. & Andersen, T. H. (2003). Real-time Beat Estimation Using
|
||
|
Feature Extraction. in Proceedings of the Computer Music Modeling and
|
||
|
Retrieval Symposium, Lecture Notes in Computer Science. springer
|
||
|
Verlag.
|
||
|
|
||
|
First order derivatives of the features are taken. Threshold may
|
||
|
need to be set low to pick up on changes.
|
||
|
|
||
|
buffer - fft buffer to read from.
|
||
|
propsc - Proportion of spectral centroid feature.
|
||
|
prophfe - Proportion of high frequency energy feature.
|
||
|
prophfc - Proportion of high frequency content feature.
|
||
|
propsf - Proportion of spectral flux feature.
|
||
|
threshold - Threshold level for allowing a detection
|
||
|
waittime - If triggered, minimum wait until a further frame can
|
||
|
cause another spot (useful to stop multiple detects on
|
||
|
heavy signals)
|
||
|
|
||
|
Default values in sclang are: propsc=0.25, prophfe=0.25,
|
||
|
prophfc=0.25, propsf=0.25, threshold=1.0, waittime=0.04.
|
||
|
|
||
|
|#
|
||
|
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 0 2048 1))))
|
||
|
|
||
|
(let* ((source (sound-in 0))
|
||
|
(detect (pv-jensen-andersen (fft* 0 source)
|
||
|
0.25 0.25 0.25 0.25
|
||
|
(mouse-x kr 0.01 1.0 1 0.1)
|
||
|
0.04)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar (mce2 440 445) 0)
|
||
|
(decay (mul 0.1 detect) 0.1)))))</h4><h4>2.247<tt> </tt><a name="(part.__pv-phase-shift270_buffer_)"></a>(pv-phase-shift270 buffer)</h4><p>Swap the real and imaginary components of every bin at ‘buffer’ and
|
||
|
swap the sign of the real components.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))))</p><p>(let ((n (mul (white-noise ar) 0.1)))
|
||
|
(audition (out 0 (ifft* (pv-phase-shift270 (fft* 10 n))))))</p><h4>2.248<tt> </tt><a name="(part.__pv-hainsworth-foote_buffer_proph_propf_threshold_waittime_)"></a>(pv-hainsworth-foote buffer proph propf threshold waittime)</h4><p>fft onset detector based on work described in</p><p>Hainsworth, S. (2003) Techniques for the Automated Analysis of
|
||
|
Musical Audio. PhD, University of Cambridge engineering dept. See
|
||
|
especially p128. The Hainsworth metric is a modification of the
|
||
|
Kullback Liebler distance.</p><p>The onset detector has general ability to spot spectral change, so
|
||
|
may have some ability to track chord changes aside from obvious
|
||
|
transient jolts, but there’s no guarantee it won’t be confused by
|
||
|
frequency modulation artifacts.</p><p>Hainsworth metric on it’s own gives good results but Foote might be
|
||
|
useful in some situations: experimental.</p><p>buffer - fft buffer to read from</p><p>proph - What strength of detection signal from Hainsworth metric to use.</p><p>propf - What strength of detection signal from Foote metric to
|
||
|
use. The Foote metric is normalised to [0.0,1.0]</p><p>threshold - Threshold hold level for allowing a detection</p><p>waittime - If triggered, minimum wait until a further frame can
|
||
|
cause another spot (useful to stop multiple detects on
|
||
|
heavy signals)</p><p>Default values in sclang are: proph=0.0, propf=0.0, threshold=1.0,
|
||
|
waittime=0.04.</p><p>–</p><p>Just Hainsworth metric with low threshold</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 0 2048 1))))</p><p>(let* ((source (sound-in 0))
|
||
|
(detect (pv-hainsworth-foote (fft* 0 source)
|
||
|
1.0
|
||
|
0.0
|
||
|
(mouse-x kr 0.01 1.0 1 0.1)
|
||
|
0.04)))
|
||
|
(audition
|
||
|
(out 0 (mul3 (sin-osc ar (mce2 440 445) 0)
|
||
|
(decay (mul 0.1 detect) 0.1)
|
||
|
0.1))))</p><p>Just Hainsworth metric, spot note transitions.</p><p>(let* ((src (mul (lf-saw ar (mul-add (lf-noise0 kr 1) 90 400) 0) 0.5))
|
||
|
(dtc (pv-hainsworth-foote (fft* 0 src)
|
||
|
1.0
|
||
|
0.0
|
||
|
0.9
|
||
|
0.5))
|
||
|
(cmp (mul (sin-osc ar 440 0)
|
||
|
(decay (mul 0.1 dtc) 0.1))))
|
||
|
(audition
|
||
|
(out 0 (mul (mce2 src cmp) 0.1))))</p><p>Just Foote metric. Foote never triggers with threshold over 1.0,
|
||
|
threshold under mouse control.</p><p>(let* ((src (sound-in 0))
|
||
|
(dtc (pv-hainsworth-foote (fft* 0 src)
|
||
|
0.0
|
||
|
1.0
|
||
|
(mouse-x kr 0.0 1.1 0 0.1)
|
||
|
0.02))
|
||
|
(cmp (mul (sin-osc ar 440 0)
|
||
|
(decay (mul 0.1 dtc) 0.1))))
|
||
|
(audition
|
||
|
(out 0 (mul (mce2 src cmp) 0.1))))</p><h4>2.249<tt> </tt><a name="(part.__pv-phase-shift_buffer_shift_)"></a>(pv-phase-shift buffer shift)</h4><p>add ‘shift’ to the phase component of every bin at ‘buffer’.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))))</p><p>(let ((n (mul (white-noise ar) 0.1))
|
||
|
(x (mouse-x kr 0 1 0 0.1)))
|
||
|
(audition (out 0 (ifft* (pv-phase-shift (fft* 10 n) x)))))</p><h4>2.250<tt> </tt><a name="(part.__pv-copy_buffer.A_buffer.B_)"></a>(pv-copy bufferA bufferB)</h4><p>Copies the spectral frame in bufferA to bufferB at that point in
|
||
|
the chain of PV UGens. This allows for parallel processing of
|
||
|
spectral data without the need for multiple fft UGens, and to copy
|
||
|
out data at that point in the chain for other purposes. bufferA and
|
||
|
bufferB must be the same size.</p><p>bufferA - source buffer.
|
||
|
bufferB - destination buffer.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 0 2048 1))
|
||
|
(async fd (b-alloc 1 2048 1))))</p><p>Proof of concept, silence</p><p>(let* ((in (lfclip-noise ar 100))
|
||
|
(c0 (fft* 0 in))
|
||
|
(c1 (pv-copy c0 1)))
|
||
|
(audition (out 0 (sub (ifft* c0) (ifft* c1)))))</p><h4>2.251<tt> </tt><a name="(part.__pv-brick-wall_buffer_wipe_)"></a>(pv-brick-wall buffer wipe)</h4><p>Clears bins above or below a cutoff point. ‘wipe’ = a unit signal,
|
||
|
from -1 to 0 the UGen acts as a low-pass filter, from 0 to 1 it
|
||
|
acts as a high pass filter.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))))</p><p>(let ((x (mouse-x kr -1 1 0 0.1))
|
||
|
(c (fft* 10 (mul (white-noise ar) 0.2))))
|
||
|
(audition (out 0 (ifft* (pv-brick-wall c x)))))</p><h4>2.252<tt> </tt><a name="(part.__pv-mag-smear_buffer_bins_)"></a>(pv-mag-smear buffer bins)</h4><p>Average a bin’s magnitude with its neighbors.</p><p>buffer - fft buffer.</p><p>bins - number of bins to average on each side of bin.
|
||
|
As this number rises, so will CPU usage.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))
|
||
|
(async fd (b-alloc-read 12 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let* ((dup (lambda (a) (mce2 a a)))
|
||
|
(in (mul (lf-saw ar 500 0) (decay2 (mul (impulse ar 2 0) 0.2) 0.01 2)))
|
||
|
(c0 (fft* 10 in))
|
||
|
(c1 (pv-mag-smear c0 (mouse-x kr 0 100 0 0.1))))
|
||
|
(audition (out 0 (mul 0.5 (dup (ifft* c1))))))</p><p>(let* ((dup (lambda (a) (mce2 a a)))
|
||
|
(s (play-buf 1 12 (buf-rate-scale kr 12) 1 0 1))
|
||
|
(x (mouse-x kr 0 100 0 0.1)))
|
||
|
(audition (out 0 (mul 0.5 (dup (ifft* (pv-mag-smear (fft* 10 s) x)))))))</p><h4>2.253<tt> </tt><a name="(part.__pv-mag-above_buffer_threshold_)"></a>(pv-mag-above buffer threshold)</h4><p>Pass only bands where the magnitude is above ‘threshold’. This
|
||
|
value is not normalized and is therefore dependant on the buffer
|
||
|
size.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))
|
||
|
(async fd (b-alloc 11 2048 1))
|
||
|
(async fd (b-alloc-read 12 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let* ((a (play-buf 1 12 (buf-rate-scale kr 12) 0 0 1))
|
||
|
(x (mouse-x kr 1 100 0 0.1))
|
||
|
(y (mouse-y kr 0 1 0 0.1))
|
||
|
(c1 (fft* 10 a))
|
||
|
(c2 (pv-copy c1 11))
|
||
|
(c3 (pv-mag-below c1 x))
|
||
|
(c4 (pv-mag-above c2 x)))
|
||
|
(audition (out 0 (mul (mce2 (ifft* c3) (ifft* c4)) (mce2 y (sub 1 y))))))</p><p>(let* ((f1 (squared (mul-add (sin-osc kr 0.08 0) 6 6.2)))
|
||
|
(f2 (mul-add (sin-osc kr f1 0) 100 800))
|
||
|
(s (sin-osc ar f2 0))
|
||
|
(x (mouse-x kr 1 1024 0 0.1))
|
||
|
(y (mouse-y kr 0 1 0 0.1))
|
||
|
(c1 (fft* 10 s))
|
||
|
(c2 (pv-copy c1 11))
|
||
|
(c3 (pv-mag-below c1 x))
|
||
|
(c4 (pv-mag-above c2 x)))
|
||
|
(audition (out 0 (mul (mce2 (ifft* c3) (ifft* c4)) (mce2 y (sub 1 y))))))</p><h4>2.254<tt> </tt><a name="(part.__pv-bin-shift_buffer_stretch_shift_)"></a>(pv-bin-shift buffer stretch shift)</h4><p>Shift and scale the positions of the bins. Can be used as a very
|
||
|
crude frequency shifter/scaler. Shifts the leftmost bin at
|
||
|
‘buffer’ by ‘shift’ places, the distance between subsequent bins is
|
||
|
‘stretch’.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))))</p><p>(define snd
|
||
|
(let* ((f1 (squared (mul-add (sin-osc kr 0.08 0) 6 6.2)))
|
||
|
(f2 (sin-osc kr f1 0)))
|
||
|
(sin-osc ar (mul-add f2 100 800) 0)))</p><p>(audition (out 0 snd))</p><p>(audition
|
||
|
(out 0 (mul
|
||
|
(ifft*
|
||
|
(pv-bin-shift
|
||
|
(fft* 10 snd)
|
||
|
(mouse-y kr 1 4 0 0.1)
|
||
|
(mouse-x kr -10 100 0 0.1)))
|
||
|
1/2)))</p><h4>2.255<tt> </tt><a name="(part.__fft_buffer_in_hop_wintype_active_)"></a>(fft buffer in hop wintype active)</h4><p>(fft* b i) => (fft b i 0.5 0 1)</p><p>Fast fourier transform. The fast fourier transform analyzes the
|
||
|
frequency content of a signal. fft uses a local buffer for holding
|
||
|
the buffered audio. The inverse transform, Ifft, reconstructs an
|
||
|
audio signal.</p><p>Note that the UGens the SC3 language provides do not use rate
|
||
|
extensions, since only a single rate is valid for each UGen class.
|
||
|
The fft and PV_ UGens must run at control rate, the ifft UGen at
|
||
|
audio rate.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))))</p><p>(let* ((s (mul (white-noise ar) 0.05))
|
||
|
(c (fft* 10 s)))
|
||
|
(audition (out 0 (ifft* c))))</p><p>(let* ((f1 (Squared (mul-add (sin-osc kr 0.08 0) 6 6.2)))
|
||
|
(f2 (mul-add (sin-osc kr f1 0) 100 800))
|
||
|
(s (sin-osc ar f2 0)))
|
||
|
(audition (out 0 (ifft* (fft* 10 s)))))</p><h4>2.256<tt> </tt><a name="(part.__pv-bin-wipe_buffer.A_buffer.B_wipe_)"></a>(pv-bin-wipe bufferA bufferB wipe)</h4><p>Combine low and high bins from two inputs</p><p>Copies low bins from one input and the high bins of the other.</p><p>bufferA - fft buffer A.
|
||
|
bufferB - fft buffer B.
|
||
|
wipe - can range between -1 and +1.</p><p>if wipe == 0 then the output is the same as inA.
|
||
|
if wipe > 0 then it begins replacing with bins from inB from the bottom up.
|
||
|
if wipe < 0 then it begins replacing with bins from inB from the top down.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))
|
||
|
(async fd (b-alloc 11 2048 1))
|
||
|
(async fd (b-alloc-read 12 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let* ((a (mul (white-noise ar) 0.2))
|
||
|
(b (mul (sin-osc ar 100 0) 0.2))
|
||
|
(f (fft* 10 a))
|
||
|
(g (fft* 11 b))
|
||
|
(h (pv-bin-wipe f g (mouse-x kr -1 1 0 0.1))))
|
||
|
(audition (out 0 (mul (ifft* h) 0.5))))</p><p>(let* ((a (mul (white-noise ar) 0.2))
|
||
|
(b (play-buf 1 12 (buf-rate-scale kr 12) 0 0 1))
|
||
|
(f (fft* 10 a))
|
||
|
(g (fft* 11 b))
|
||
|
(h (pv-bin-wipe f g (mouse-x kr -1 1 0 0.1))))
|
||
|
(audition (out 0 (mul (ifft* h) 0.5))))</p><h4>2.257<tt> </tt><a name="(part.__pv-copy.Phase_buffer.A_buffer.B_)"></a>(pv-copyPhase bufferA bufferB)</h4><p>Combines magnitudes of first input and phases of the second input.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))
|
||
|
(async fd (b-alloc 11 2048 1))
|
||
|
(async fd (b-alloc-read 12 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let* ((a (mul (white-noise ar) 0.2))
|
||
|
(b (mul (sin-osc ar 100 0) 0.2))
|
||
|
(f (fft* 10 a))
|
||
|
(g (fft* 11 b))
|
||
|
(h (pv-copy-phase f g)))
|
||
|
(audition (out 0 (mul (ifft* h) 0.5))))</p><p>(let* ((a (mul (white-noise ar) 0.2))
|
||
|
(b (play-buf 1 12 (buf-rate-scale kr 12) 0 0 1))
|
||
|
(f (fft* 10 a))
|
||
|
(g (fft* 11 b))
|
||
|
(h (pv-copy-phase f g)))
|
||
|
(audition (out 0 (mul (ifft* h) 0.5))))</p><h4>2.258<tt> </tt><a name="(part.__pv-phase-shift90_buffer_)"></a>(pv-phase-shift90 buffer)</h4><p>Swap the real and imaginary components of every bin at ‘buffer’ and
|
||
|
swap the of the imaginary components.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))))</p><p>(let ((n (mul (white-noise ar) 0.1)))
|
||
|
(audition (out 0 (ifft* (pv-phase-shift90 (fft* 10 n))))))</p><h4>2.259<tt> </tt><a name="(part.__convolution2_in_bufnum_trigger_framesize_______.Strict_convolution_with_fixed_kernel_which_can_be_updated_using_a_trigger_signal___in________-_processing_target_bufnum____-_buffer_index_for_the_fixed_kernel__may_be_modulated_in_____________combination_with_the_trigger_trigger___-_update_the_kernel_on_a_change_from__~3d0_to__0_framesize_-_size_of_fft_frame__must_be_a_power_of_two__convolution_____________uses_twice_this_number_internally__maximum_value_you_____________can_give_this_argument_is_2_16~3d65536__.Note_that_it_gets_____________progressively_more_expensive_to_run_for_higher_powers______________512__1024__2048__4096_standard________with-sc3___lambda__fd______for-each______lambda__b_________async_fd__b-alloc_b_2048_1_________list_10_11_12_______for-each______lambda__n_________send_fd__b-set1_10_______400_n__100__1_________enum-from-to_0_2_______for-each______lambda__n_________send_fd__b-set1_11_______20_n__10___random_0_1__________enum-from-to_0_49_______for-each______lambda__n_________send_fd__b-set1_12_______40_n__20__1_________enum-from-to_0_19_______send-synth_____fd__c_______letc___k_0___t_0__________let___i__impulse_ar_1_0_____________out_0__mul__convolution2_i_k_t_2048__0_5__________define_send-to____lambda__m_______with-sc3_______lambda__fd__________send_fd_m________define_async-to____lambda__m_______with-sc3_______lambda__fd__________async_fd_m________send-to__s-new1__c__1001_1_1__k__10_____send-to__n-set1_1001__k__11____send-to__n-set1_1001__t__0____send-to__n-set1_1001__t__1_____send-to__n-set1_1001__k__12____send-to__n-set1_1001__t__0____send-to__n-set1_1001__t__1_____async-to__b-zero_12_____for-each___lambda__n______send-to__b-set1_12_______20__n__10___1______enum-from-to_0_39_____send-to__n-set1_1001__t__0____send-to__n-set1_1001__t__1__)"></a>(convolution2 in bufnum trigger framesize)
|
||
|
|
||
|
#|
|
||
|
|
||
|
Strict convolution with fixed kernel which can be updated using a
|
||
|
trigger signal.
|
||
|
|
||
|
in - processing target
|
||
|
bufnum - buffer index for the fixed kernel, may be modulated in
|
||
|
combination with the trigger
|
||
|
trigger - update the kernel on a change from <=0 to >0
|
||
|
framesize - size of fft frame, must be a power of two. convolution
|
||
|
uses twice this number internally, maximum value you
|
||
|
can give this argument is 2^16=65536. Note that it gets
|
||
|
progressively more expensive to run for higher powers!
|
||
|
512, 1024, 2048, 4096 standard.
|
||
|
|
||
|
|#
|
||
|
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(for-each
|
||
|
(lambda (b)
|
||
|
(async fd (b-alloc b 2048 1)))
|
||
|
(list 10 11 12))
|
||
|
(for-each
|
||
|
(lambda (n)
|
||
|
(send fd (b-set1 10 (+ (* 400 n) 100) 1)))
|
||
|
(enum-from-to 0 2))
|
||
|
(for-each
|
||
|
(lambda (n)
|
||
|
(send fd (b-set1 11 (+ (* 20 n) 10) (random 0 1))))
|
||
|
(enum-from-to 0 49))
|
||
|
(for-each
|
||
|
(lambda (n)
|
||
|
(send fd (b-set1 12 (+ (* 40 n) 20) 1)))
|
||
|
(enum-from-to 0 19))
|
||
|
(send-synth
|
||
|
fd "c"
|
||
|
(letc ((k 0) (t 0))
|
||
|
(let ((i (impulse ar 1 0)))
|
||
|
(out 0 (mul (convolution2 i k t 2048) 0.5)))))))
|
||
|
|
||
|
(define send-to
|
||
|
(lambda (m)
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send fd m)))))
|
||
|
|
||
|
(define async-to
|
||
|
(lambda (m)
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd m)))))
|
||
|
|
||
|
(send-to (s-new1 "c" 1001 1 1 "k" 10))
|
||
|
|
||
|
(send-to (n-set1 1001 "k" 11))
|
||
|
(send-to (n-set1 1001 "t" 0))
|
||
|
(send-to (n-set1 1001 "t" 1))
|
||
|
|
||
|
(send-to (n-set1 1001 "k" 12))
|
||
|
(send-to (n-set1 1001 "t" 0))
|
||
|
(send-to (n-set1 1001 "t" 1))
|
||
|
|
||
|
(async-to (b-zero 12))
|
||
|
|
||
|
(for-each
|
||
|
(lambda (n)
|
||
|
(send-to (b-set1 12 (+ (* 20 n) 10) 1)))
|
||
|
(enum-from-to 0 39))
|
||
|
|
||
|
(send-to (n-set1 1001 "t" 0))
|
||
|
(send-to (n-set1 1001 "t" 1))</h4><p>With soundfile.</p><p>(async-to (b-alloc-read 10 "/home/rohan/audio/metal.wav" 0 0))</p><p>(let ((i (sound-in 0)))
|
||
|
(audition (out 0 (mul (convolution2 i 10 0 512) 0.5))))</p><h4>2.260<tt> </tt><a name="(part.__pv-rect-comb2_buffer.A_buffer.B_num.Teeth_phase_width_)"></a>(pv-rect-comb2 bufferA bufferB numTeeth phase width)</h4><h4>2.261<tt> </tt><a name="(part.__pv-add_buffer.A_buffer.B_)"></a>(pv-add bufferA bufferB)</h4><p>Complex addition: RealA + RealB, ImagA + ImagB</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))
|
||
|
(async fd (b-alloc 11 2048 1))
|
||
|
(async fd (b-alloc-read 12 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let* ((a (play-buf 1 12 (buf-rate-scale kr 12) 0 0 1))
|
||
|
(f (fft* 10 a))
|
||
|
(g (fft* 11 (mul (sin-osc ar 440 0) 0.2)))
|
||
|
(h (pv-add f g)))
|
||
|
(audition (out 0 (mul (ifft* h) 0.5))))</p><p>(audition
|
||
|
(out 0 (mul (add (play-buf 1 12 (buf-rate-scale kr 12) 0 0 1)
|
||
|
(mul (sin-osc ar 440 0) 0.2))
|
||
|
0.5)))</p><h4>2.262<tt> </tt><a name="(part.__pv-rand-comb_buffer_wipe_trig_)"></a>(pv-rand-comb buffer wipe trig)</h4><p>randomly clear bins.</p><p>buffer = fft buffer. wipe = clear bins from input in a random
|
||
|
order (0, 1). trig = select new random ordering.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))))</p><p>(let ((dup (lambda (a) (mce2 a a)))
|
||
|
(n (mul (white-noise ar) 0.5))
|
||
|
(x (mouse-x kr 0.6 0.95 0 0.1))
|
||
|
(t (impulse kr 0.4 0)))
|
||
|
(audition (out 0 (dup (ifft* (pv-rand-comb (fft* 10 n) x t))))))</p><h4>2.263<tt> </tt><a name="(part.__pv-local-max_buffer_threshold_)"></a>(pv-local-max buffer threshold)</h4><p>Pass bins which are a local maximum</p><p>Passes only bins whose magnitude is above a threshold and above
|
||
|
their nearest neighbors.</p><p>buffer - fft buffer.
|
||
|
threshold - magnitude threshold.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))
|
||
|
(async fd (b-alloc-read 12 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let* ((a (play-buf 1 12 (buf-rate-scale kr 12) 0 0 1))
|
||
|
(f (fft* 10 a))
|
||
|
(h (pv-local-max f (mouse-x kr 0 100 0 0.1))))
|
||
|
(audition (out 0 (mul (ifft* h) 0.5))))</p><h4>2.264<tt> </tt><a name="(part.__pv-mag-mul_buffer.A_buffer.B_)"></a>(pv-mag-mul bufferA bufferB)</h4><h4>2.265<tt> </tt><a name="(part.__pv-conformal-map_buffer_real_imag_)"></a>(pv-conformal-map buffer real imag)</h4><p>Applies the conformal mapping z send (z-a)/(1-za*) to the phase
|
||
|
vocoder bins z with a given by the real and imag imputs to the
|
||
|
UGen.</p><p>See http://mathworld.wolfram.com/ConformalMapping.html</p><p>buffer - buffer number of buffer to act on, passed in through a chain
|
||
|
real - real part of a.
|
||
|
imag - imaginary part of a.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 1024 1))
|
||
|
(async fd (b-alloc 0 2048 1))))</p><p>(audition
|
||
|
(out 0 (pan2
|
||
|
(ifft*
|
||
|
(pv-conformal-map
|
||
|
(fft* 10 (mul (sound-in 0) 0.5)) (mouse-x kr -1 1 0 0.1)
|
||
|
(mouse-y kr -1 1 0 0.1)))
|
||
|
0
|
||
|
1)))</p><p>(let* ((signal (lambda (n)
|
||
|
(let* ((o (sin-osc kr (mix-fill n (lambda (_) (rand 0.1 0.5))) 0))
|
||
|
(a (mul (make-mce (list 1 1.1 1.5 1.78 2.45 6.7)) 220))
|
||
|
(f (mul-add o 10 a)))
|
||
|
(mix (mul (lf-saw ar f 0) 0.3)))))
|
||
|
(mapped (lambda (n)
|
||
|
(let* ((c0 (fft* 0 (signal n)))
|
||
|
(x (mouse-x kr 0.01 2.0 1.0 0.1))
|
||
|
(y (mouse-y kr 0.01 10.0 1.0 0.1))
|
||
|
(c1 (pv-conformal-map c0 x y)))
|
||
|
(ifft* c1))))
|
||
|
(s (mapped 3))
|
||
|
(t (mul-add (comb-n s 0.1 0.1 10) 0.5 s)))
|
||
|
(audition (out 0 (pan2 t 0 1))))</p><h4>2.266<tt> </tt><a name="(part.__pv-diffuser_buffer_trig_)"></a>(pv-diffuser buffer trig)</h4><p>adds a different constant random phase shift to each bin.
|
||
|
The trigger will select a new set of random phases.</p><p>buffer - fft buffer.
|
||
|
trig - a trigger selects a new set of random values.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))
|
||
|
(async fd (b-alloc-read 12 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let* ((a (play-buf 1 12 (buf-rate-scale kr 12) 0 0 1))
|
||
|
(f (fft* 10 a))
|
||
|
(h (pv-diffuser f (gt (mouse-x kr 0 1 0 0.1) 0.5))))
|
||
|
(audition (out 0 (mul (ifft* h) 0.5))))</p><h4>2.267<tt> </tt><a name="(part.__pv-max_buffer.A_buffer.B_)"></a>(pv-max bufferA bufferB)</h4><h4>2.268<tt> </tt><a name="(part.__.Ifft_buffer_wintype_)"></a>(Ifft buffer wintype)</h4><p>(ifft* b) => (ifft b 0)</p><p>inverse Fast Fourier Transform. The inverse fast fourier transform
|
||
|
converts from frequency content to a signal.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 0 2048 1))))</p><p>(let* ((s (mul (white-noise ar) 0.05))
|
||
|
(c (fft 0 s 0.5 0 1)))
|
||
|
(audition (out 0 (Ifft c 0))))</p><h4>2.269<tt> </tt><a name="(part.__pv-bin-scramble_buffer_wipe_width_trig_)"></a>(pv-bin-scramble buffer wipe width trig)</h4><p>randomizes the order of the bins. The trigger will select a new
|
||
|
random ordering.</p><p>buffer - fft buffer.
|
||
|
wipe - scrambles more bins as wipe moves from zero to one.
|
||
|
width - a value from zero to one, indicating the maximum randomized
|
||
|
distance of a bin from its original location in the spectrum.
|
||
|
trig - a trigger selects a new random ordering.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))
|
||
|
(async fd (b-alloc-read 12 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let* ((a (play-buf 1 12 (buf-rate-scale kr 12) 1 0 1))
|
||
|
(f (fft* 10 a))
|
||
|
(g (pv-bin-scramble f
|
||
|
(mouse-x kr 0.0 1.0 0 0.1)
|
||
|
(mouse-y kr 0.0 1.0 0 0.1)
|
||
|
(impulse kr 4 0)))
|
||
|
(h (ifft* g)))
|
||
|
(audition (out 0 (mul 0.5 (mce2 h h)))))</p><p>careful - reads adc!
|
||
|
(let* ((a (mul (sound-in (mce2 0 1)) 4.0))
|
||
|
(f (fft* 10 a))
|
||
|
(g (pv-bin-scramble f
|
||
|
(mouse-x kr 0.25 1.0 0 0.1)
|
||
|
(mouse-y kr 0.25 1.0 0 0.1)
|
||
|
(impulse kr (mul-add (lf-noise0 kr 2) 8 10) 0)))
|
||
|
(h (ifft* g)))
|
||
|
(audition (out 0 (pan2 h 0 0.5))))</p><h4>2.270<tt> </tt><a name="(part.__pv-rand-wipe_buffer.A_buffer.B_wipe_trig_)"></a>(pv-rand-wipe bufferA bufferB wipe trig)</h4><p>Cross fades between two sounds by copying bins in a random order.</p><p>bufferA = fft buffer A. bufferB = fft buffer B. wipe = copies
|
||
|
bins from bufferB in a random order (0, 1). trig = select new
|
||
|
random ordering.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))
|
||
|
(async fd (b-alloc 11 2048 1))))</p><p>(define-syntax n-of
|
||
|
(syntax-rules ()
|
||
|
((_ n f) (mix-fill n (lambda (_) f)))))</p><p>(let* ((n 6)
|
||
|
(a (n-of n (mul (lf-saw ar (exp-rand 400.0 1000.0) 0.0) 0.1)))
|
||
|
(b (n-of n (mul (lf-pulse ar (exp-rand 80.0 400.0) 0.0 0.2)
|
||
|
(u:max (mul (sin-osc kr (rand 0.0 8.0) 0.0) 0.2) 0.0))))
|
||
|
(f (fft* 10 a))
|
||
|
(g (fft* 11 b))
|
||
|
(y (mouse-y kr 0 1 0 0.1))
|
||
|
(x (mouse-x kr 0 1 0 0.1))
|
||
|
(h (pv-rand-wipe f g x (gt y 0.5)))
|
||
|
(i (ifft* h)))
|
||
|
(audition (out 0 (mul 0.5 (mce2 i i)))))</p><h4>2.271<tt> </tt><a name="(part.__.Packfft_chain_bufsize_frombin_tobin_zeroothers_magsphases_)"></a>(Packfft chain bufsize frombin tobin zeroothers magsphases)</h4><p>Pack separate demand-rate fft bin streams into an fft chain buffer</p><p>Takes a length-prefixed array of magnitudes and phases, and packs
|
||
|
them into an fft buffer ready for transforming back into
|
||
|
time-domain audio using Ifft.</p><p>Most people won’t need to use this directly - instead, use
|
||
|
pvcollect, pvcalc, or pvcalc2.</p><p>The input data is magsphases, which should be a flat array
|
||
|
containing magnitude and phase of all bins in ascending order.
|
||
|
e.g. [mag0, phase0, mag1, phase1, mag2, phase2, ... magN, phaseN]
|
||
|
This input is typically demand-rate.</p><p>This is technically similar to demand or duty in that it calls
|
||
|
demand-rate UGens further up the graph to process the values,
|
||
|
eventually calling Unpackfft. These two ends of the process must in
|
||
|
most cases see the same chain...! Otherwise behaviour is undefined
|
||
|
and, who knows, possibly unpleasant.</p><p>frombin and tobin allow you to fill the supplied data only into a
|
||
|
subset of the fft bins (i.e. a single delimited frequency band),
|
||
|
set zeroothers to 1 to zero all the magnitudes outside this band
|
||
|
(otherwise they stay intact).</p><p>For usage examples, see Unpackfft, but also pvcollect, pvcalc,
|
||
|
pvcalc2.</p><p>Here’s an unusual example which uses Packfft without using
|
||
|
Unpackfft first - essentially creating our fft data from scratch.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send fd (b-alloc 10 512 1))))</p><p>(let* ((n 100)
|
||
|
(n* (enum-from-to 1 n))
|
||
|
(m1 (map (lambda (_) (range (f-sin-osc kr (exp-rand 0.1 1) 0) 0 1)) n*))
|
||
|
(square (lambda (a) (* a a)))
|
||
|
(m2 (map mul m1 (map square (iota n 1.0 (- (/ 1.0 n))))))
|
||
|
(i (map (lambda (_) (lf-pulse kr (pow 2 (i-rand -3 5)) 0 0.3)) n*))
|
||
|
(m3 (map mul m2 i))
|
||
|
(p (replicate n 0.0))
|
||
|
(c1 (fft* 10 (f-sin-osc ar 440 0)))
|
||
|
(c2 (pack-fft c1 512 0 (- n 1) 1 (packfft-data m3 p)))
|
||
|
(s (ifft* c2)))
|
||
|
(audition (out 0 (mce2 s s))))</p><h4>2.272<tt> </tt><a name="(part.__pvcollect_chain_numframes_func_frombin_tobin_zeroothers_)"></a>(pvcollect chain numframes func frombin tobin zeroothers)</h4><p>Process each bin of an fft chain separately.</p><p>pvcollect applies function func to each bin of an fft chain. func
|
||
|
should be a function that takes magnitude, phase, index as inputs
|
||
|
and returns a resulting [magnitude, phase].</p><p>The "index" is the integer bin number, starting at 0 for DC. You
|
||
|
can optionally ignore the phase and only return a single
|
||
|
(magnitude) value, in which case the phase is assumed to be left
|
||
|
unchanged.</p><p>frombin, tobin, and zeroothers are optional arguments which limit
|
||
|
the processing to a specified integer range of fft bins. If
|
||
|
zeroothers is set to 1 then bins outside of the range being
|
||
|
processed are silenced.</p><p>Note that this procedure can be relatively CPU-heavy, depending on
|
||
|
how you use it.</p><p>(define no-op
|
||
|
(lambda (m p _)
|
||
|
(list m p)))</p><p>(define rand-phase
|
||
|
(lambda (m p _)
|
||
|
(list m (rand 0 3.14))))</p><p>(define noise-phase
|
||
|
(lambda (m p _)
|
||
|
(list m (lin-lin (lf-noise0 kr 3) -1 1 0 3.14))))</p><p>(define combf
|
||
|
(lambda (m p i)
|
||
|
(list (if (= (modulo i 7) 0) m 0) p)))</p><p>(define noise-mag
|
||
|
(lambda (m p _)
|
||
|
(list (mul (gt (lf-noise0 kr 10) 0) m) p)))</p><p>(define spectral-delay
|
||
|
(lambda (m p _)
|
||
|
(let ((v (lin-lin (lf-par kr 0.5 0) -1 1 0.1 1)))
|
||
|
(list (add m (delay-n m 1 v)) p))))</p><p>(define (bpf-sweep nf)
|
||
|
(lambda (m p i)
|
||
|
(let ((e (u:abs (sub i (lin-lin (lf-par kr 0.1 0) -1 1 2 (/ nf 20))))))
|
||
|
(list (mul (lt e 10) m) p))))</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 1024 1))
|
||
|
(async fd (b-alloc-read 11 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let* ((nf 1024)
|
||
|
(i (play-buf 1 11 (buf-rate-scale kr 11) 1 0 1))
|
||
|
(c1 (fft* 10 i))
|
||
|
(c2 (pvcollect c1 nf spectral-delay 0 250 0)))
|
||
|
(audition (out 0 (mul 0.1 (ifft* c2)))))</p><h4>2.273<tt> </tt><a name="(part.__.P.V_.Magclip_buffer_threshold_)"></a>(PV_Magclip buffer threshold)</h4><p>clip bins to a threshold. clips bin magnitudes to a maximum
|
||
|
threshold.</p><p>buffer - fft buffer.
|
||
|
threshold - magnitude threshold.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))
|
||
|
(async fd (b-alloc-read 12 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let* ((a (play-buf 1 12 (buf-rate-scale kr 12) 0 0 1))
|
||
|
(f (fft* 10 a))
|
||
|
(h (pv-mag-clip f (mouse-x kr 0 5 0 0.1))))
|
||
|
(audition (out 0 (mul (ifft* h) 0.5))))</p><h4>2.274<tt> </tt><a name="(part.__.P.V_.Magfreeze_buffer_freeze_)"></a>(PV_Magfreeze buffer freeze)</h4><p>freeze magnitudes. freezes magnitudes at current levels when
|
||
|
freeze > 0.</p><p>buffer - fft buffer.
|
||
|
freeze - if > 0 then magnitudes are frozen at current levels.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))
|
||
|
(async fd (b-alloc-read 12 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(let ((dup (lambda (a) (mce2 a a)))
|
||
|
(s (sin-osc ar (mul-add (lf-noise1 kr 5.2) 250 400) 0))
|
||
|
(f (sin-osc kr 0.2 0)))
|
||
|
(audition (out 0 (dup (mul 0.25 (ifft* (pv-mag-freeze (fft* 10 s) f)))))))</p><p>(let ((dup (lambda (a) (mce2 a a)))
|
||
|
(s (play-buf 1 12 (buf-rate-scale kr 12) 1 0 1))
|
||
|
(f (gt (mouse-y kr 0 1 0 0.1) 0.5)))
|
||
|
(audition (out 0 (dup (mul 0.25 (ifft* (pv-mag-freeze (fft* 10 s) f)))))))</p><h4>2.275<tt> </tt><a name="(part.__pv-rect-comb_buffer_num.Teeth_phase_width____with-sc3___lambda__fd______async_fd__b-alloc_10_2048_1_______let____dup__lambda__a___mce2_a_a____________x__mouse-x_kr_0_0_5_0_0_1___________y__mouse-y_kr_0_0_5_0_0_1___________n__dup__mul__white-noise_ar__0_3____________c__pv-rect-comb__fft__10_n__8_x_y_______audition__out_0__ifft__c_______let____dup__lambda__a___mce2_a_a____________p__mul-add__lf-tri_kr_0_097_0__0_4_0_5___________w__mul-add__lf-tri_kr_0_24_0__-0_5_0_5___________n__dup__mul__white-noise_ar__0_3____________c__pv-rect-comb__fft__10_n__8_p_w_______audition__out_0__ifft__c____)"></a>(pv-rect-comb buffer numTeeth phase width)
|
||
|
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 2048 1))))
|
||
|
|
||
|
(let* ((dup (lambda (a) (mce2 a a)))
|
||
|
(x (mouse-x kr 0 0.5 0 0.1))
|
||
|
(y (mouse-y kr 0 0.5 0 0.1))
|
||
|
(n (dup (mul (white-noise ar) 0.3)))
|
||
|
(c (pv-rect-comb (fft* 10 n) 8 x y)))
|
||
|
(audition (out 0 (ifft* c))))
|
||
|
|
||
|
(let* ((dup (lambda (a) (mce2 a a)))
|
||
|
(p (mul-add (lf-tri kr 0.097 0) 0.4 0.5))
|
||
|
(w (mul-add (lf-tri kr 0.24 0) -0.5 0.5))
|
||
|
(n (dup (mul (white-noise ar) 0.3)))
|
||
|
(c (pv-rect-comb (fft* 10 n) 8 p w)))
|
||
|
(audition (out 0 (ifft* c))))</h4><h4>2.276<tt> </tt><a name="(part.__pv-mag-shift_buffer_stretch_shift_)"></a>(pv-mag-shift buffer stretch shift)</h4><h4>2.277<tt> </tt><a name="(part._.See_allpass-n)"></a>See allpass-n</h4><h4>2.278<tt> </tt><a name="(part._.See_comb-n)"></a>See comb-n</h4><h4>2.279<tt> </tt><a name="(part._.See_.Bufallpass-c)"></a>See Bufallpass-c</h4><h4>2.280<tt> </tt><a name="(part.__free-verb_in_mix_room_damp_)"></a>(free-verb in mix room damp)</h4><p>(free-verb2 in1 in2 mix room damp)</p><p>A simple reverb.</p><p>in, in1, in2 - input signal
|
||
|
mix - dry/wet balance (0,1)
|
||
|
room - room size (0,1)
|
||
|
damp - reverb high frequency damping (0,1)</p><p>(let* ((i (impulse ar 1 0))
|
||
|
(c (lf-cub ar 1200 0))
|
||
|
(s (mul3 (decay i 0.25) c 0.1))
|
||
|
(x (mouse-x kr 0 1 0 0.1))
|
||
|
(y (mouse-y kr 0 1 0 0.1))
|
||
|
(r (free-verb s y x 0.5)))
|
||
|
(audition (out 0 r)))</p><p>(let* ((i (sound-in (mce2 0 1)))
|
||
|
(c (lambda (u n) (mce-channel u n)))
|
||
|
(x (mouse-x kr 0 1 0 0.1))
|
||
|
(y (mouse-y kr 0 1 0 0.1))
|
||
|
(r (free-verb2 (c i 0) (c i 1) y x 0.5)))
|
||
|
(audition (out 0 r)))</p><h4>2.281<tt> </tt><a name="(part._.See_free.Verb)"></a>See freeVerb</h4><h4>2.282<tt> </tt><a name="(part.__play-buf_num.Channels_bufnum_rate_trigger_start.Pos_loop_)"></a>(play-buf numChannels bufnum rate trigger startPos loop)</h4><p>Sample playback oscillator. Plays back a memory resident sample.</p><p>numChannels - number of channels that the buffer will be. This
|
||
|
must be a fixed integer. The architechture of the
|
||
|
SynthDef cannot change after it is compiled.
|
||
|
Warning: if you supply a bufnum of a buffer that has
|
||
|
a different numChannels then you have specified to
|
||
|
the play-buf, it will fail silently.</p><p>bufnum - the index of the buffer to use</p><p>rate - 1.0 is the server’s sample rate, 2.0 is one octave up, 0.5
|
||
|
is one octave down -1.0 is backwards normal rate
|
||
|
etc. interpolation is cubic. Note: If the buffer’s sample
|
||
|
rate is different from the server’s, you will need to
|
||
|
multiply the desired playback rate by (file’s rate /
|
||
|
server’s rate). The UGen buf-rate-scale.kr(bufnum) returns
|
||
|
this factor. See examples below. buf-rate-scale should be used
|
||
|
in virtually every case.</p><p>trigger - a trigger causes a jump to the startPos. A trigger
|
||
|
occurs when a signal changes from <= 0 to > 0.</p><p>startPos - sample frame to start playback.</p><p>loop - 1 means true, 0 means false. This is modulate-able.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc-read 10 "/home/rohan/audio/metal.wav" 0 0))))</p><p>Play once only.</p><p>(audition (out 0 (play-buf 1 10 (buf-rate-scale kr 10) 1 0 0)))</p><p>Play in infinite loop.</p><p>(audition (out 0 (play-buf 1 10 (buf-rate-scale kr 10) 1 0 1)))</p><p>trigger playback at each pulse.</p><p>(audition (out 0 (play-buf 1 10 (buf-rate-scale kr 10) (impulse kr 2 0) 0 0)))</p><p>trigger playback at each pulse (diminishing intervals).</p><p>(let ((t (impulse kr (x-line kr 0.1 100 10 remove-synth) 0)))
|
||
|
(audition (out 0 (play-buf 1 10 (buf-rate-scale kr 10) t 0 0))))</p><p>Loop playback, accelerating pitch.</p><p>(let ((rate (x-line kr 0.1 100 60 remove-synth)))
|
||
|
(audition (out 0 (play-buf 1 10 rate 1 0 1))))</p><p>Sine wave control of playback rate, negative rate plays backwards.</p><p>(let ((r (mul-add (f-sin-osc kr (x-line kr 0.2 8 30 remove-synth) 0) 3 0.6)))
|
||
|
(audition (out 0 (play-buf 1 10 (mul (buf-rate-scale kr 10) r) 1 0 1))))</p><p>Release buffer.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-free 10))))</p><h4>2.283<tt> </tt><a name="(part._.See_buf-delay-c)"></a>See buf-delay-c</h4><h4>2.284<tt> </tt><a name="(part.__delay2_in_)"></a>(delay2 in)</h4><p>Fixed two sample delay.</p><p>(let ((s (impulse ar 1 0)))
|
||
|
(audition
|
||
|
(out 0 (add s (delay2 s)))))</p><h4>2.285<tt> </tt><a name="(part.__comb-n_in_max.Delay.Time_delay.Time_decay.Time_)"></a>(comb-n in maxDelayTime delayTime decayTime)</h4><p>(comb-l in maxDelayTime delayTime decayTime)
|
||
|
(comb-c in maxDelayTime delayTime decayTime)</p><p>Comb delay line. comb-n uses no interpolation, comb-l uses linear
|
||
|
interpolation, comb-c uses all pass interpolation. All times are in
|
||
|
seconds. The decay time is the time for the echoes to decay by 60
|
||
|
decibels. If this time is negative then the feedback coefficient
|
||
|
will be negative, thus emphasizing only odd harmonics at an octave
|
||
|
lower.</p><p>Comb used as a resonator. The resonant fundamental is equal to
|
||
|
reciprocal of the delay time.</p><p>(define src (mul (white-noise ar) 0.01))
|
||
|
(define ctl (x-line kr 0.0001 0.01 20 remove-synth))
|
||
|
(define hear (lambda (u) (audition (out 0 u))))</p><p>(hear (comb-n src 0.01 ctl 0.2))
|
||
|
(hear (comb-l src 0.01 ctl 0.2))
|
||
|
(hear (comb-c src 0.01 ctl 0.2))</p><p>With negative feedback:</p><p>(hear (comb-n src 0.01 ctl -0.2))
|
||
|
(hear (comb-l src 0.01 ctl -0.2))
|
||
|
(hear (comb-c src 0.01 ctl -0.2))</p><p>Used as an echo.</p><p>(hear (comb-n (mul (decay (mul (dust ar 1) 0.5) 0.2) (white-noise ar))
|
||
|
0.2 0.2 3))</p><h4>2.286<tt> </tt><a name="(part._.See_.Bufallpass-c)"></a>See Bufallpass-c</h4><h4>2.287<tt> </tt><a name="(part.__allpass-n_in_max.Delay.Time_delay.Time_decay.Time_)"></a>(allpass-n in maxDelayTime delayTime decayTime)</h4><p>All pass delay line. allpass-n uses no interpolation, allpass-l uses
|
||
|
linear interpolation, allpass-c uses all pass interpolation. All
|
||
|
time values are in seconds. The decay time is the time for the
|
||
|
echoes to decay by 60 decibels. If this time is negative then the
|
||
|
feedback coefficient will be negative, thus emphasizing only odd
|
||
|
harmonics at an octave lower.</p><p>Since the allpass delay has no audible effect as a resonator on
|
||
|
steady state sound ...</p><p>(define z (mul (white-noise ar) 0.1))</p><p>(audition (out 0 (allpass-c z 0.01 (x-line kr 0.0001 0.01 20 do-nothing) 0.2)))</p><p>...these examples add the input to the effected sound so that you
|
||
|
can hear the effect of the phase comb.</p><p>(audition
|
||
|
(out 0 (add z (allpass-n z 0.01 (x-line kr 0.0001 0.01 20 do-nothing) 0.2))))</p><p>(audition
|
||
|
(out 0 (add z (allpass-l z 0.01 (x-line kr 0.0001 0.01 20 do-nothing) 0.2))))</p><p>(audition
|
||
|
(out 0 (add z (allpass-c z 0.01 (x-line kr 0.0001 0.01 20 do-nothing) 0.2))))</p><p>Used as an echo - doesn’t really sound different than Comb, but it
|
||
|
outputs the input signal immediately (inverted) and the echoes are
|
||
|
lower in amplitude.</p><p>(audition
|
||
|
(out 0 (allpass-n (mul (decay (dust ar 1) 0.2) z) 0.2 0.2 3)))</p><h4>2.288<tt> </tt><a name="(part._.See_comb-n)"></a>See comb-n</h4><h4>2.289<tt> </tt><a name="(part.__buf-allpass-c_buf_in_delaytime_decaytime_)"></a>(buf-allpass-c buf in delaytime decaytime)</h4><p>Buffer based all pass delay line with cubic interpolation</p><p>All pass delay line with cubic interpolation which uses a buffer
|
||
|
for its internal memory. See also Bufallpass-n which uses no
|
||
|
interpolation, and Bufallpass-l which uses linear
|
||
|
interpolation. Cubic interpolation is more computationally
|
||
|
expensive than linear, but more accurate.</p><p>See also allpass-c.</p><p>buf - buffer number.</p><p>in - the input signal.</p><p>delaytime - delay time in seconds.</p><p>decaytime - time for the echoes to decay by 60 decibels. If this
|
||
|
time is negative then the feedback coefficient will be
|
||
|
negative, thus emphasizing only odd harmonics at an
|
||
|
octave lower.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 0 44100 1))))</p><p>(let ((x (mul3 (decay (dust ar 1) 0.2) (white-noise ar) 0.5)))
|
||
|
(audition (out 0 (buf-allpass-n 0 x 0.25 6))))</p><h4>2.290<tt> </tt><a name="(part._.See_allpass-n)"></a>See allpass-n</h4><h4>2.291<tt> </tt><a name="(part._.See_buf-delay-c)"></a>See buf-delay-c</h4><h4>2.292<tt> </tt><a name="(part.__buf-delay-c_buf_in_delaytime_)"></a>(buf-delay-c buf in delaytime)</h4><p>Buffer based simple delay line with cubic interpolation.</p><p>Simple delay line with cubic interpolation which uses a buffer for
|
||
|
its internal memory. See also buf-delay-n which uses no
|
||
|
interpolation, and buf-delay-l which uses linear interpolation. Cubic
|
||
|
interpolation is more computationally expensive than linear, but
|
||
|
more accurate.</p><p>See also delay-c.</p><p>buf - buffer number.
|
||
|
in - the input signal.
|
||
|
delaytime - delay time in seconds.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 0 44100 1))))</p><p>(let ((z (mul3 (decay (dust ar 1) 0.5) 0.3 (white-noise ar))))
|
||
|
(audition (out 0 (add (buf-delay-c 0 z 0.2) z))))</p><h4>2.293<tt> </tt><a name="(part.__pluck_in_tr_maxdelaytime_delaytime_decaytime_coef_)"></a>(pluck in tr maxdelaytime delaytime decaytime coef)</h4><p>Karplus-Strong synthesis.</p><p>in - an excitation signal</p><p>tr - upon a negative to positive transition, the excitation signal
|
||
|
will be fed into the delay line</p><p>maxdelaytime - the max delay time in seconds (initializes the
|
||
|
internal delay buffer).</p><p>delaytime - delay time in seconds.</p><p>decaytime - time for the echoes to decay by 60 decibels. Negative
|
||
|
times emphasize odd partials.</p><p>coef - the coef of the internal one-pole filter. Values should be
|
||
|
between -1 and +1 (larger values will be unstable... so be
|
||
|
careful!).</p><p>Excitation signal is white-noise, triggered twice a second with
|
||
|
varying one-pole coef.</p><p>(let ((n (mul (white-noise ar) 0.1))
|
||
|
(t (impulse kr 2 0))
|
||
|
(x (mouse-x kr -0.999 0.999 0 0.1))
|
||
|
(dl (/ 1 440)))
|
||
|
(audition (out 0 (pluck n t dl dl 10 x))))</p><p>(let* ((n 25)
|
||
|
(gen (lambda (n f) (mce-fill n (lambda (_) (f)))))
|
||
|
(f (gen n (lambda () (rand 0.05 0.2))))
|
||
|
(p (gen n (lambda () (rand 0 1))))
|
||
|
(x (mouse-x kr 60 1000 1 0.1))
|
||
|
(o (lin-lin (sin-osc kr f p) -1 1 x 3000))
|
||
|
(w (clone n (mul (white-noise ar) 0.1)))
|
||
|
(i (impulse kr (gen n (lambda () (rand 10 12))) 0))
|
||
|
(ks (pluck w i 0.01 (fdiv 1 o) 2 (rand 0.01 0.2)))
|
||
|
(l (gen n (lambda () (rand -1 1)))))
|
||
|
(audition (out 0 (leak-dc (mix (pan2 ks l 1)) 0.995))))</p><h4>2.294<tt> </tt><a name="(part.__pitch-shift_in_win.Size_pch.Ratio_pch.Dispersion_time.Dispersion_)"></a>(pitch-shift in winSize pchRatio pchDispersion timeDispersion)</h4><p>A simple time domain pitch shifter.</p><p>(audition
|
||
|
(out 0 (pitch-shift (sin-osc ar 440 0)
|
||
|
0.2
|
||
|
(mouse-x kr 0.5 2 0 0.1)
|
||
|
(mouse-y kr 0 0.1 0 0.1)
|
||
|
0)))</p><h4>2.295<tt> </tt><a name="(part._.See_buf-comb-c)"></a>See buf-comb-c</h4><h4>2.296<tt> </tt><a name="(part.__buf-comb-c_buf_in_delaytime_decaytime_)"></a>(buf-comb-c buf in delaytime decaytime)</h4><p>Buffer based comb delay line with cubic interpolation</p><p>All pass delay line with cubic interpolation which uses a buffer
|
||
|
for its internal memory. See also buf-comb-n which uses no
|
||
|
interpolation, and buf-comb-l which uses linear interpolation. Cubic
|
||
|
interpolation is more computationally expensive than linear, but
|
||
|
more accurate. See also comb-c.</p><p>buf - buffer number.</p><p>in - the input signal.</p><p>delaytime - delay time in seconds.</p><p>decaytime - time for the echoes to decay by 60 decibels. If this
|
||
|
time is negative then the feedback coefficient will be
|
||
|
negative, thus emphasizing only odd harmonics at an
|
||
|
octave lower.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 0 44100 1))))</p><p>(let ((x (mul3 (decay (dust ar 1) 0.2) (white-noise ar) 0.5)))
|
||
|
(audition (out 0 (buf-comb-n 0 x 0.25 6))))</p><h4>2.297<tt> </tt><a name="(part.__buf-rd_num.Channels_rate_bufnum_phase_loop_interpolation_)"></a>(buf-rd numChannels rate bufnum phase loop interpolation)</h4><p>Plays the content of a buffer.</p><p>The number of channels must be a fixed integer. The architechture
|
||
|
of the SynthDef cannot change after it is compiled. NOTE: if you
|
||
|
supply a bufnum of a buffer that has a different numChannels then
|
||
|
you have specified to the buf-rd, it will fail silently.</p><p>The interpolation type is an integer: 1 no interpolation, 2 linear
|
||
|
interpolation, 4 cubic interpolation.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc-read 0 "/home/rohan/audio/metal.wav" 0 0))))</p><p>(audition (out 0 (buf-rd 1 ar 0 (mul (sin-osc ar 0.1 0) (buf-frames ir 0)) 0 2)))</p><p>(let ((phase (mul (lf-noise1 ar (mouse-x kr (mce2 5 10) 100 0 0.1))
|
||
|
(buf-frames ir 0))))
|
||
|
(audition (out 0 (buf-rd-l 1 ar 0 phase 0))))</p><p>(let ((phase (add (lf-tri ar 0.1 0)
|
||
|
(mul (lf-tri ar 0.23 0) (buf-frames ir 0)))))
|
||
|
(audition (out 0 (buf-rd-l 1 ar 0 phase 0))))</p><p>Use a phasor index into the file</p><p>(let ((phase (phasor ar
|
||
|
0
|
||
|
(mul (mouse-x kr 0.5 2 0 0.1)
|
||
|
(buf-rate-scale kr 0))
|
||
|
0
|
||
|
(buf-frames kr 0)
|
||
|
0)))
|
||
|
(audition (out 0 (buf-rd 1 ar 0 phase 1 (mouse-y kr 0 5 0 0.1)))))</p><h4>2.298<tt> </tt><a name="(part.__delay1_in_)"></a>(delay1 in)</h4><p>Fixed Single sample delay.</p><p>(let ((s (impulse ar 1 0)))
|
||
|
(audition
|
||
|
(out 0 (add s (delay1 s)))))</p><h4>2.299<tt> </tt><a name="(part.__record-buf_bufnum_offset_reclevel_prelevel_run_loop_trigger_inputs_)"></a>(record-buf bufnum offset reclevel prelevel run loop trigger inputs)</h4><p>Records input into a Buffer.</p><p>If recLevel is 1.0 and preLevel is 0.0 then the new input
|
||
|
overwrites the old data. If they are both 1.0 then the new data is
|
||
|
added to the existing data. (Any other settings are also valid.)</p><p>bufnum - the index of the buffer to use
|
||
|
offset - an offset into the buffer in samples, default 0
|
||
|
recLevel - value to multiply by input before mixing with
|
||
|
existing data. Default is 1.0.
|
||
|
preLevel - value to multiply to existing data in buffer before
|
||
|
mixing with input. Default is 0.0.
|
||
|
run - If zero, then recording stops, otherwise recording
|
||
|
proceeds. Default is 1.
|
||
|
loop - If zero then don’t loop, otherwise do. This is
|
||
|
modulate-able. Default is 1.
|
||
|
trigger - a trigger causes a jump to the start of the Buffer.
|
||
|
A trigger occurs when a signal changes from <=0 to >0.
|
||
|
inputArray - an Array of input channels</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send-synth
|
||
|
fd
|
||
|
"recorder"
|
||
|
(letc ((in 0)
|
||
|
(bufnum 0)
|
||
|
(offset 1)
|
||
|
(recLevel 1)
|
||
|
(preLevel 0)
|
||
|
(run 1)
|
||
|
(loop 1)
|
||
|
(trigger 1))
|
||
|
(let ((i (in 2 ar in)))
|
||
|
(out 0 (record-buf bufnum offset recLevel preLevel run loop trigger i)))))
|
||
|
(let ((b 10)
|
||
|
(y 1001)
|
||
|
(z 1002))
|
||
|
(async fd (/b_alloc b 44100 2))
|
||
|
(send fd (/s_new "recorder" y add-to-tail 1 "bufnum" b "in" 8))
|
||
|
(send fd (/n_trace y))
|
||
|
(send-synth
|
||
|
fd
|
||
|
"player"
|
||
|
(letc ((bufnum 0)
|
||
|
(rate 1)
|
||
|
(trigger 1)
|
||
|
(startPos 0)
|
||
|
(loop 1)
|
||
|
(gain 1))
|
||
|
(out 0 (mul (play-buf 2 bufnum rate trigger startPos loop) gain))))
|
||
|
(send fd (/s_new "player" z add-to-tail 1 "bufnum" b)))))</p><p>(define do-send
|
||
|
(lambda (m)
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send fd m)))))</p><p>(do-send (/n_set 1001 "run" 1))</p><p>(do-send (/n_set 1002 "loop" 1))
|
||
|
(do-send (/n_set 1002 "gain" 2))
|
||
|
(do-send (/n_set 1002 "trigger" 1))</p><p>(do-send (/n_free 1001))
|
||
|
(do-send (/n_free 1002))</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (/b_free 10))))</p><h4>2.300<tt> </tt><a name="(part._.See_delay-n)"></a>See delay-n</h4><h4>2.301<tt> </tt><a name="(part._.See_buf-comb-c)"></a>See buf-comb-c</h4><h4>2.302<tt> </tt><a name="(part._.See_delay-n)"></a>See delay-n</h4><h4>2.303<tt> </tt><a name="(part.__delay-n_in_max.Delay.Time_delay.Time_)"></a>(delay-n in maxDelayTime delayTime)</h4><p>(delay-l in maxDelayTime delayTime)
|
||
|
(delay-c in maxDelayTime delayTime)</p><p>Simple delay line. There are three forms, delay-n uses no
|
||
|
interpolation, delay-l uses linear interpolation, delay-c uses cubic
|
||
|
interpolation. The maximum delay length is set at initialization
|
||
|
time and cannot be extended.</p><p>dust randomly triggers decay to create an exponential decay
|
||
|
envelope for the white-noise input source.</p><p>(let ((z (mul (decay (dust ar 1) 0.3)
|
||
|
(white-noise ar))))
|
||
|
(audition
|
||
|
(out 0 (add (delay-n z 0.2 0.2) z))))</p><h4>2.304<tt> </tt><a name="(part.__ball_in_g_damp_friction_)"></a>(ball in g damp friction)</h4><p>Physical model of bouncing object.</p><p>Models the path of a bouncing object that is reflected by a
|
||
|
vibrating surface.</p><p>in - modulated surface level
|
||
|
g - gravity
|
||
|
damp - damping on impact
|
||
|
friction - proximity from which on attraction to surface starts</p><h4>2.305<tt> </tt><a name="(part.__dswitch1_index_array_)"></a>(dswitch1 index array)</h4><p>demand rate generator for switching between inputs</p><p>index - which of the inputs to return
|
||
|
array - array of values or other ugens</p><p>(let* ((x (mouse-x kr 0 4 0 0.1))
|
||
|
(y (mouse-y kr 1 15 0 0.1))
|
||
|
(a (dswitch1 x (make-mce (list 1 3 y 2 (dwhite 2 0 3)))))
|
||
|
(t (impulse kr 3 0))
|
||
|
(f (mul-add (demand t 0 a) 30 340)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.306<tt> </tt><a name="(part.__t-duty_rate_duration_reset_done.Action_level_gap_)"></a>(t-duty rate duration reset doneAction level gap)</h4><p>demand results as trigger from demand rate ugens.</p><p>A value is demanded each ugen in the list and output as a trigger
|
||
|
according to a stream of duration values. The unit generators in
|
||
|
the list should be ’demand’ rate. When there is a trigger at the
|
||
|
reset input, the demand rate ugens in the list and the duration are
|
||
|
reset. The reset input may also be a demand ugen, providing a
|
||
|
stream of reset times.</p><p>NOTE: sclang reorders the inputs to be ’duration reset level
|
||
|
doneAction’, rsc does not.</p><p>duration - time values. Can be a demand ugen or any signal.
|
||
|
The next trigger value is acquired after the
|
||
|
duration provided by the last time value.</p><p>reset - trigger or reset time values. Resets the list of ugens
|
||
|
and the duration ugen when triggered. The reset input
|
||
|
may also be a demand ugen, providing a stream of reset
|
||
|
times.</p><p>doneAction - a doneAction that is evaluated when the duration
|
||
|
stream ends.</p><p>level - demand ugen providing the output values.</p><p>Play a little rhythm</p><p>(let ((s (dseq dinf (make-mce (list 0.1 0.2 0.4 0.3)))))
|
||
|
(audition (out 0 (t-duty ar s 0 0 1 0))))</p><p>Amplitude changes</p><p>(let ((t (t-duty ar
|
||
|
(dseq dinf (make-mce (list 0.1 0.2 0.4 0.3)))
|
||
|
0
|
||
|
0
|
||
|
(dseq dinf (make-mce (list 0.1 0.4 0.01 0.5 1.0)))
|
||
|
0)))
|
||
|
(audition (out 0 (ringz t 1000 0.1))))</p><p>(let ((t (t-duty ar
|
||
|
(mouse-x kr 0.001 2 1 0.1)
|
||
|
0
|
||
|
0
|
||
|
(dseq dinf (make-mce (list 0.1 0.4 0.01 0.5 1.0)))
|
||
|
0)))
|
||
|
(audition (out 0 (ringz t 1000 0.1))))</p><h4>2.307<tt> </tt><a name="(part._.See_dwhite)"></a>See dwhite</h4><h4>2.308<tt> </tt><a name="(part.__dwhite__length_lo_hi_)"></a>(dwhite length lo hi)</h4><p>(diwhite length lo hi)</p><p>demand rate white noise random generators.</p><p>length number of values to create
|
||
|
lo minimum value
|
||
|
hi maximum value</p><p>dwhite returns numbers in the continuous range between lo and hi,
|
||
|
diwhite returns integer values. The arguments can be a number or
|
||
|
any other ugen</p><p>(let* ((a (dwhite dinf 0 15))
|
||
|
(t (impulse kr (mouse-x kr 1 40 1 0.1) 0))
|
||
|
(f (mul-add (demand t 0 a) 30 340)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><p>(let* ((a (diwhite dinf 0 15))
|
||
|
(t (impulse kr (mouse-x kr 1 40 1 0.1) 0))
|
||
|
(f (mul-add (demand t 0 a) 30 340)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.309<tt> </tt><a name="(part.__dbufrd_bufnum_phase_loop_)"></a>(dbufrd bufnum phase loop)</h4><p>Buffer demand ugen.</p><p>bufnum - buffer number to read from
|
||
|
phase - index into the buffer (demand ugen or any other ugen)
|
||
|
loop - loop when phase exceeds number of frames in buffer</p><p>Example</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 10 24 1))
|
||
|
(send fd (b-setn1 10 0 (replicate-m 24 (exp-random 200 500))))))</p><p>(let* ((q (dseq 3 (make-mce (list 0 3 5 0 3 7 0 5 9))))
|
||
|
(p (dseq dinf (mce2 q (dbrown 5 0 23 1))))
|
||
|
(t (dust kr 10)))
|
||
|
(audition (out 0 (mul (sin-osc ar (demand t 0 (dbufrd 10 p 1)) 0) 0.1))))</p><p>Buffer as a time pattern.</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-alloc 11 24 1))
|
||
|
(send fd (b-setn1 11 0 (replicate-m 24 (choose (list 1 0.5 0.25)))))))</p><p>(let* ((p (dseq dinf (mce2 (dseq 3 (make-mce (list 0 3 5 0 3 7 0 5 9)))
|
||
|
(dbrown 5 0 23 1))))
|
||
|
(d (mul (dbufrd 11 (dseries dinf 0 1) 1) 0.5))
|
||
|
(l (dbufrd 10 p 1)))
|
||
|
(audition (out 0 (mul (sin-osc ar (duty kr d 0 do-nothing l) 0) 0.1))))</p><p>free buffers</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (b-free 10))
|
||
|
(async fd (b-free 11))))</p><h4>2.310<tt> </tt><a name="(part.__demand-env-gen_rate_levels_times_shapes_curves_gate_reset)"></a>(demand-env-gen rate levels times shapes curves gate reset</h4><p>levelScale levelOffset timeScale doneAction)</p><p>levels - a demand ugen or any other ugen</p><p>times - a demand ugen or any other ugen if one of these ends,
|
||
|
the doneAction is evaluated</p><p>shapes - a demand ugen or any other ugen, the number given is
|
||
|
the shape number according to Env</p><p>curves - a demand ugen or any other ugen, if shape is 5, this
|
||
|
is the curve factor some curves/shapes don’t work if
|
||
|
the duration is too short. have to see how to improve
|
||
|
this. also some depend on the levels obviously, like
|
||
|
exponential cannot cross zero.</p><p>gate - if gate is x >= 1, the ugen runs, if gate is 0 > x > 1,
|
||
|
the ugen is released at the next level (doneAction), if
|
||
|
gate is x < 0, the ugen is sampled end held</p><p>reset - if reset crosses from nonpositive to positive, the ugen
|
||
|
is reset at the next level, if it is > 1, it is reset
|
||
|
immediately.</p><p>Frequency envelope with random times.</p><p>(let* ((l (dseq dinf (make-mce (list 204 400 201 502 300 200))))
|
||
|
(t (drand dinf (make-mce (list 1.01 0.2 0.1 2.0))))
|
||
|
(y (mouse-y kr 0.01 3 1 0.1))
|
||
|
(f (demand-env-gen ar l (mul t y) 7 0 1 1 1 0 1 do-nothing)))
|
||
|
(audition (out 0 (mul (sin-osc ar (mul f (mce2 1 1.01)) 0) 0.1))))</p><p>Frequency modulation</p><p>(let* ((x (mouse-x kr -0.01 -4 0 0.1))
|
||
|
(y (mouse-y kr 1 3000 1 0.1))
|
||
|
(l (lambda () (dseq dinf (clone 32 (exp-rand 200 1000)))))
|
||
|
(t (mul sample-dur y))
|
||
|
(f (demand-env-gen ar (mce2 (l) (l)) t 5 x 1 1 1 0 1 do-nothing)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><p>gate. Mouse x on right side of screen toggles gate.</p><p>(let* ((x (mouse-x kr 0 1 0 0.1))
|
||
|
(l (u:round (dwhite dinf 300 1000) 100))
|
||
|
(f (demand-env-gen kr l 0.1 5 0.3 (gt x 0.5) 1 1 0 1 do-nothing)))
|
||
|
(audition (out 0 (mul (sin-osc ar (mul f (mce2 1 1.21)) 0) 0.1))))</p><h4>2.311<tt> </tt><a name="(part.__demand_trig_reset_ugens_)"></a>(demand trig reset ugens)</h4><p>demand results from demand rate ugens.</p><p>When there is a trigger at the trig input, a value is demanded from
|
||
|
each ugen in the list and output. The unit generators in the list
|
||
|
should be ’demand’ rate.</p><p>When there is a trigger at the reset input, the demand rate ugens
|
||
|
in the list are reset.</p><p>trig - trigger. trigger can be any signal. A trigger happens when
|
||
|
the signal changes from non-positive to positive.</p><p>reset - trigger. Resets the list of ugens when triggered.</p><p>(define (mirror1 l)
|
||
|
(append l (cdr (reverse (cdr l)))))</p><p>(let* ((t (impulse kr 24 0))
|
||
|
(s (drand dinf (mce2 (dseq 1 (make-mce (mirror1 (enum-from-to 1 5))))
|
||
|
(drand 8 (make-mce (enum-from-to 4 11))))))
|
||
|
(f (demand t 0 (mul s 100)))
|
||
|
(x (mouse-x kr -1 1 0 0.1))
|
||
|
(o (sin-osc ar (mce2 f (add f 0.7)) 0)))
|
||
|
(audition (out 0 (mul (scale-neg (cubed (cubed o)) x) 0.1))))</p><p>(let* ((t (impulse kr 10 0))
|
||
|
(r (dust kr 1))
|
||
|
(s (dgeom dinf (midi-cps 72) (midi-ratio 1)))
|
||
|
(f (demand t r s))
|
||
|
(o (sin-osc ar (mce2 f (add f 0.7)) 0)))
|
||
|
(audition (out 0 (mul (u:max (cubed o) 0) 0.1))))</p><p>(let* ((t (impulse kr 10 0))
|
||
|
(s (midi-cps (diwhite dinf 60 72)))
|
||
|
(f (demand t 0 s))
|
||
|
(o (sin-osc ar (mce2 f (add f 0.7)) 0)))
|
||
|
(audition (out 0 (mul (cubed (cubed o)) 0.1))))</p><h4>2.312<tt> </tt><a name="(part.__duty_rate_duration_reset_done.Action_level_)"></a>(duty rate duration reset doneAction level)</h4><p>demand results from demand rate ugens</p><p>A value is demanded from each ugen in the list and output according
|
||
|
to a stream of duration values. The unit generators in the list
|
||
|
should be ’demand’ rate. When there is a trigger at the reset
|
||
|
input, the demand rate ugens in the list and the duration are
|
||
|
reset. The reset input may also be a demand ugen, providing a
|
||
|
stream of reset times.</p><p>duration: time values. Can be a demand ugen or any signal. The
|
||
|
next value is acquired after the duration provided by the last time
|
||
|
value.</p><p>reset: trigger or reset time values. Resets the list of ugens and
|
||
|
the duration ugen when triggered. The reset input may also be a
|
||
|
demand ugen, providing a stream of reset times.</p><p>doneAction: a doneAction that is evaluated when the duration stream
|
||
|
ends.</p><p>level: demand ugen providing the output values.</p><p>(let* ((f (duty kr
|
||
|
(drand dinf (mce3 0.01 0.2 0.4))
|
||
|
0
|
||
|
2
|
||
|
(dseq dinf (make-mce (list 204 400 201 502 300 200)))))
|
||
|
(o (sin-osc ar (mul f (mce2 1 1.01)) 0)))
|
||
|
(audition (out 0 (mul o 0.1))))</p><p>(let* ((f (duty kr
|
||
|
(mouse-x kr 0.001 2 1 0.1)
|
||
|
0
|
||
|
2
|
||
|
(dseq dinf (make-mce (list 204 400 201 502 300 200)))))
|
||
|
(o (sin-osc ar (mul f (mce2 1 1.0)) 0)))
|
||
|
(audition (out 0 (mul o 0.1))))</p><h4>2.313<tt> </tt><a name="(part.__dser_length_array_)"></a>(dser length array)</h4><p>demand rate sequence generator.</p><p>array - array of values or other ugens
|
||
|
length - number of values to return</p><p>(let* ((a (dser dinf (make-mce (list 1 3 2 7 8))))
|
||
|
(x (mouse-x kr 1 40 1 0.1))
|
||
|
(t (impulse kr x 0))
|
||
|
(f (mul-add (demand t 0 a) 30 340)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.314<tt> </tt><a name="(part.__dgeom_length_start_grow_)"></a>(dgeom length start grow)</h4><p>demand rate geometric series ugen.</p><p>start - start value
|
||
|
grow - value by which to grow ( x = x[-1] * grow )
|
||
|
length - number of values to create</p><p>The arguments can be a number or any other ugen</p><p>(let* ((a (dgeom 15 1 1.2))
|
||
|
(t (impulse kr (mouse-x kr 1 40 1 0.1) 0))
|
||
|
(f (mul-add (demand t 0 a) 30 340)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><p>demand rate UGens are not shared...</p><p>(let* ((a (dgeom 15 1 1.2))
|
||
|
(t (impulse ar (mouse-x kr 1 40 1 0.1) 0))
|
||
|
(f0 (mul-add (demand (delay1 t) 0 a) 30 340))
|
||
|
(f1 (mul-add (demand t 0 a) 30 340)))
|
||
|
(audition (out 0 (mul (sin-osc ar (mce2 f0 f1) 0) 0.1))))</p><p>(let* ((a0 (dgeom 15 1 1.2))
|
||
|
(a1 (dgeom 15 1 1.2))
|
||
|
(t (impulse ar (mouse-x kr 1 40 1 0.1) 0))
|
||
|
(f0 (mul-add (demand (delay1 t) 0 a0) 30 340))
|
||
|
(f1 (mul-add (demand t 0 a1) 30 340)))
|
||
|
(audition (out 0 (mul (sin-osc ar (mce2 f0 f1) 0) 0.1))))</p><h4>2.315<tt> </tt><a name="(part.__drand__length_array_)"></a>(drand length array)</h4><p>(dxrand length array)</p><p>demand rate random sequence generators.</p><p>length - number of values to return
|
||
|
array - array of values or other ugens</p><p>dxrand never plays the same value twice, whereas drand chooses any
|
||
|
value in the list.</p><p>(let ((f (lambda (u)
|
||
|
(let* ((a (u dinf (make-mce (list 1 3 2 7 8))))
|
||
|
(t (impulse kr (mouse-x kr 1 400 1 0.1) 0))
|
||
|
(f (mul-add (demand t 0 a) 30 340)))
|
||
|
(mul (sin-osc ar f 0) 0.1)))))
|
||
|
(audition (out 0 (mce2 (f drand)
|
||
|
(f dxrand)))))</p><h4>2.316<tt> </tt><a name="(part._.See_drand)"></a>See drand</h4><h4>2.317<tt> </tt><a name="(part.__dseries_length_start_step_)"></a>(dseries length start step)</h4><p>demand rate arithmetic series ugen.</p><p>length - number of values to create
|
||
|
start - start value
|
||
|
step - step value</p><p>The arguments can be a number or any other ugen</p><p>(let* ((a (dseries 15 0 1))
|
||
|
(t (impulse kr (mouse-x kr 1 40 1 0.1) 0))
|
||
|
(f (mul-add (demand t 0 a) 30 340)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.318<tt> </tt><a name="(part.__dswitch_index_array_)"></a>(dswitch index array)</h4><p>demand rate generator for switching between inputs</p><p>index - which of the inputs to return
|
||
|
array - array of values or other ugens</p><p>In difference to dswitch1, dswitch embeds all items
|
||
|
of an input demand ugen first before looking up the
|
||
|
next index.</p><p>(let* ((a0 (dwhite 2 3 4))
|
||
|
(a1 (dwhite 2 0 1))
|
||
|
(a2 (dseq 2 (make-mce (list 1 1 1 0))))
|
||
|
(i (dseq 2 (make-mce (list 0 1 2 1 0))))
|
||
|
(d (dswitch i (make-mce (list a0 a1 a2))))
|
||
|
(t (impulse kr 4 0))
|
||
|
(f (mul-add (demand t 0 d) 300 400))
|
||
|
(o (mul (sin-osc ar f 0) 0.1)))
|
||
|
(audition (out 0 o)))</p><p>compare with dswitch1</p><p>(let* ((a0 (dwhite 2 3 4))
|
||
|
(a1 (dwhite 2 0 1))
|
||
|
(a2 (dseq 2 (make-mce (list 1 1 1 0))))
|
||
|
(i (dseq 2 (make-mce (list 0 1 2 1 0))))
|
||
|
(d (dswitch1 i (make-mce (list a0 a1 a2))))
|
||
|
(t (impulse kr 4 0))
|
||
|
(f (mul-add (demand t 0 d) 300 400))
|
||
|
(o (mul (sin-osc ar f 0) 0.1)))
|
||
|
(audition (out 0 o)))</p><h4>2.319<tt> </tt><a name="(part._.See_dbrown)"></a>See dbrown</h4><h4>2.320<tt> </tt><a name="(part.__dbrown__length_lo_hi_step_)"></a>(dbrown length lo hi step)</h4><p>(dibrown length lo hi step)</p><p>demand rate brownian movement generators.</p><p>lo - minimum value
|
||
|
hi - maximum value
|
||
|
step - maximum step for each new value
|
||
|
length - number of values to create</p><p>dbrown returns numbers in the continuous range between lo and hi,
|
||
|
dibrown returns integer values. The arguments can be a number or
|
||
|
any other ugen.</p><p>(let ((f (lambda (u)
|
||
|
(let* ((a (u dinf 0 15 1))
|
||
|
(t (impulse kr (mouse-x kr 1 40 1 0.1) 0))
|
||
|
(f (mul-add (demand t 0 a) 30 340)))
|
||
|
(mul (sin-osc ar f 0) 0.1)))))
|
||
|
(audition (out 0 (mce2 (f dbrown) (f dibrown)))))</p><h4>2.321<tt> </tt><a name="(part.__dseq_length_array_)"></a>(dseq length array)</h4><p>demand rate sequence generator.</p><p>array - array of values or other ugens
|
||
|
length - number of repeats</p><p>(let* ((a (dseq 3 (make-mce (list 1 3 2 7 8))))
|
||
|
(t (impulse kr (mouse-x kr 1 40 1 0.1) 0))
|
||
|
(f (mul-add (demand t 0 a) 30 340)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><p>(let* ((a (dseq dinf (make-mce (replicate-m 32 (random 0 10)))))
|
||
|
(t (impulse ar (mouse-x kr 1 10000 1 0.1) 0))
|
||
|
(f (mul-add (demand t 0 a) 30 340)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.322<tt> </tt><a name="(part._.See_latoocarfian-c_)"></a>See latoocarfian-c.</h4><h4>2.323<tt> </tt><a name="(part.__fb-sine-c_rate_freq_im_fb_a_c_xi_yi_)"></a>(fb-sine-c rate freq im fb a c xi yi)</h4><p>Feedback sine with chaotic phase indexing.</p><p>freq - iteration frequency in Hz - 22050
|
||
|
im - index multiplier amount - 1
|
||
|
fb - feedback amount - 0.1
|
||
|
a - phase multiplier amount - 1.1
|
||
|
c - phase increment amount - 0.5
|
||
|
xi - initial value of x - 0.1
|
||
|
yi - initial value of y - 0.1</p><p>A cubic-interpolating sound generator based on the difference
|
||
|
equations:</p><p>xn+1 = sin(im*yn + fb*xn)
|
||
|
yn+1 = (ayn + c) % 2pi</p><p>This uses a linear congruential function to drive the phase
|
||
|
indexing of a sine wave. For im = 1, fb = 0, and a = 1 a normal
|
||
|
sinewave results.</p><p>sclang default values</p><p>(audition
|
||
|
(out 0 (mul (fb-sine-c ar (fdiv sample-rate 4) 1 0.1 1.1 0.5 0.1 0.1)
|
||
|
0.2)))</p><p>increase feedback</p><p>(let ((fb (line kr 0.01 4 10 do-nothing)))
|
||
|
(audition
|
||
|
(out 0 (mul (fb-sine-c ar sample-rate 1 fb 1.1 0.5 0.1 0.1) 0.2))))</p><p>increase phase multiplier</p><p>(let ((a (line kr 1 2 10 do-nothing)))
|
||
|
(audition
|
||
|
(out 0 (mul (fb-sine-c ar sample-rate 1 0 a 0.5 0.1 0.1) 0.2))))</p><p>randomly modulate parameters</p><p>(let* ((x (mouse-x kr 1 12 0 0.1))
|
||
|
(f (lambda (m a) (mul-add (lf-noise2 kr x) m a))))
|
||
|
(audition
|
||
|
(out 0 (mul (fb-sine-c ar
|
||
|
(f 1e4 1e4)
|
||
|
(f 32 33)
|
||
|
(f 0.5 0)
|
||
|
(f 0.05 1.05)
|
||
|
(f 0.3 0.3)
|
||
|
0.1
|
||
|
0.1)
|
||
|
0.2))))</p><h4>2.324<tt> </tt><a name="(part._.See_fb-sine-c)"></a>See fb-sine-c</h4><h4>2.325<tt> </tt><a name="(part.__quad-n_rate_freq_a_b_c_xi_)"></a>(quad-n rate freq a b c xi)</h4><p>(quad-l rate freq a b c xi)
|
||
|
(quad-c rate freq a b c xi)</p><p>freq - iteration frequency in Hertz
|
||
|
a, b, c - equation variables
|
||
|
xi - initial value of x</p><p>General quadratic map chaotic generator. Non-, linear- and cubic-
|
||
|
interpolating sound generators based on the difference equation:
|
||
|
xn+1 = axn2 + bxn + c</p><p>(define quad_ quad-c)</p><p>(audition
|
||
|
(out 0 (mul (quad_ ar 4000 1 -1 -0.75 0) 0.2)))</p><p>(let ((r (mouse-x kr 3.5441 4 0 0.1)))
|
||
|
(audition
|
||
|
(out 0 (mul (quad_ ar 4000.0 (neg r) r 0 0.1) 0.4))))</p><p>(let ((r (mouse-x kr 3.5441 4 0 0.1)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar (mul-add (quad_ ar 4 (neg r) r 0 0.1) 800 900) 0)
|
||
|
0.4))))</p><h4>2.326<tt> </tt><a name="(part.__lorenz-l_rate_freq_s_r_b_h_xi_yi_zi_)"></a>(lorenz-l rate freq s r b h xi yi zi)</h4><p>freq - iteration frequency in Hertz
|
||
|
s, r, b - equation variables
|
||
|
h - integration time step
|
||
|
xi - initial value of x
|
||
|
yi - initial value of y
|
||
|
zi - initial value of z</p><p>Lorenz chaotic generator. A strange attractor discovered by Edward
|
||
|
N. Lorenz while studying mathematical models of the atmosphere.
|
||
|
The system is composed of three ordinary differential equations:</p><p>x’ = s(y - x)
|
||
|
y’ = x(r - z) - y
|
||
|
z’ = xy - bz</p><p>The time step amount h determines the rate at which the ODE is
|
||
|
evaluated. Higher values will increase the rate, but cause more
|
||
|
instability. A safe choice is the default amount of 0.05.</p><p>vary frequency</p><p>(audition
|
||
|
(out 0 (mul (lorenz-l ar (mouse-x kr 20 sample-rate 0 0.1)
|
||
|
10 28 2.667 0.05 0.1 0 0)
|
||
|
0.3)))</p><p>randomly modulate params</p><p>(audition
|
||
|
(out 0 (mul (lorenz-l ar sample-rate
|
||
|
(mul-add (lf-noise0 kr 1) 2 10)
|
||
|
(mul-add (lf-noise0 kr 1) 20 38)
|
||
|
(mul-add (lf-noise0 kr 1) 1.5 2)
|
||
|
0.05
|
||
|
0.1 0.0 0.0)
|
||
|
0.2)))</p><p>as a frequency control</p><p>(audition
|
||
|
(out 0 (mul
|
||
|
(sin-osc ar (mul-add
|
||
|
(lag
|
||
|
(lorenz-l ar
|
||
|
(mouse-x kr 1 200 0 0.1)
|
||
|
10
|
||
|
28
|
||
|
2.667
|
||
|
0.05
|
||
|
0.1
|
||
|
0
|
||
|
0)
|
||
|
0.003)
|
||
|
800 900)
|
||
|
0)
|
||
|
0.4)))</p><h4>2.327<tt> </tt><a name="(part._.See_standard-l_)"></a>See standard-l.</h4><h4>2.328<tt> </tt><a name="(part._.See_quad-n)"></a>See quad-n</h4><h4>2.329<tt> </tt><a name="(part._.See_cusp-n)"></a>See cusp-n</h4><h4>2.330<tt> </tt><a name="(part._.See_latoocarfian-c_)"></a>See latoocarfian-c.</h4><h4>2.331<tt> </tt><a name="(part.__logistic_rate_chaos.Param_freq_)"></a>(logistic rate chaosParam freq)</h4><p>UNDOCUMENTED.</p><p>Implements the equation: y1 = param * y1 * (1.0 - y1)</p><p>(audition
|
||
|
(out 0 (mul (logistic ar 2.9 1000) 0.2)))</p><h4>2.332<tt> </tt><a name="(part._.See_fb-sine-c)"></a>See fb-sine-c</h4><h4>2.333<tt> </tt><a name="(part.__latoocarfian-c_rate_freq_a_b_c_d_xi_yi_)"></a>(latoocarfian-c rate freq a b c d xi yi)</h4><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym">latoocarfian-l</span><span class="hspace"> </span><span class="RktSym">rate</span><span class="hspace"> </span><span class="RktSym">freq</span><span class="hspace"> </span><span class="RktSym">a</span><span class="hspace"> </span><span class="RktSym">b</span><span class="hspace"> </span><span class="RktSym">c</span><span class="hspace"> </span><span class="RktSym">d</span><span class="hspace"> </span><span class="RktSym">xi</span><span class="hspace"> </span><span class="RktSym">yi</span><span class="RktPn">)</span></p></blockquote><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym">latoocarfian-n</span><span class="hspace"> </span><span class="RktSym">rate</span><span class="hspace"> </span><span class="RktSym">freq</span><span class="hspace"> </span><span class="RktSym">a</span><span class="hspace"> </span><span class="RktSym">b</span><span class="hspace"> </span><span class="RktSym">c</span><span class="hspace"> </span><span class="RktSym">d</span><span class="hspace"> </span><span class="RktSym">xi</span><span class="hspace"> </span><span class="RktSym">yi</span><span class="RktPn">)</span></p></blockquote><p>This is a function given in Clifford Pickover’s book Chaos in
|
||
|
Wonderland, pg 26. The function has four parameters a, b, c, and
|
||
|
d. The function is:</p><p><div class="SIntrapara">xnew = sin
|
||
|
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym">y</span><span class="hspace"> </span><span class="RktSym"><span class="badlink"><span class="RktValLink">*</span></span></span><span class="hspace"> </span><span class="RktSym">b</span><span class="RktPn">)</span></p></blockquote></div></p><h4>2.334<tt> </tt><a name="(part.__rossler_rate_chaos.Param_dt_)"></a>(rossler rate chaosParam dt)</h4><p>The Rossler attractor is a well known chaotic function. The
|
||
|
chaosParam can be varied from 1.0 to 25.0 with a dt of 0.04. Valid
|
||
|
ranges for chaosParam vary depending on dt.</p><p>(audition
|
||
|
(out 0 (mul (rossler ar 4 0.08) 0.1)))</p><h4>2.335<tt> </tt><a name="(part.__standard-l_rate_freq_k_xi_yi_)"></a>(standard-l rate freq k xi yi)</h4><p>(standard-n rate freq k xi yi)</p><p>Standard map chaotic generator.</p><p>freq - iteration frequency in Hertz
|
||
|
k - perturbation amount
|
||
|
xi - initial value of x
|
||
|
yi - initial value of y</p><p>A linear-interpolating sound generator based on the difference
|
||
|
equations:</p><p>xn+1 = (xn + yn+1) % 2pi
|
||
|
yn+1 = (yn + ksin(xn)) % 2pi</p><p>The standard map is an area preserving map of a cylinder discovered by
|
||
|
the plasma physicist Boris Chirikov.</p><p>Vary frequency</p><p>(audition
|
||
|
(out 0 (mul (standard-l ar (mouse-x kr 20 sample-rate 0 0.1) 1 0.5 0) 0.3)))</p><p>Mouse-controlled parameter.</p><p>(let ((f (fdiv sample-rate 2))
|
||
|
(x (mouse-x kr 0.9 4 0 0.1)))
|
||
|
(audition
|
||
|
(out 0 (mul (standard-l ar f x 0.5 0) 0.3))))</p><p>As a frequency control</p><p>(let* ((x (mouse-x kr 0.9 4 0 0.1))
|
||
|
(f (mul-add (standard-l ar 40 x 0.5 0) 800 900)))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar f 0) 0.4))))</p><h4>2.336<tt> </tt><a name="(part._.See_quad-n)"></a>See quad-n</h4><h4>2.337<tt> </tt><a name="(part.__cusp-n_rate_freq_a_b_xi_)"></a>(cusp-n rate freq a b xi)</h4><p>(cusp-l rate freq a b xi)</p><p>freq - iteration frequency in Hertz
|
||
|
a, b - equation variables
|
||
|
xi - initial value of x</p><p>Cusp map chaotic generator. Non- and linear- interpolating sound
|
||
|
generator based on the difference equation:</p><p>xn+1 = a - b*sqrt(|xn|)</p><p>(define cusp_ cusp-l)</p><p>vary frequency</p><p>(let ((x (mouse-x kr 20 sample-rate 0 0.1)))
|
||
|
(audition (out 0 (mul (cusp_ ar x 1.0 1.99 0) 0.3))))</p><p>mouse-controlled params</p><p>(let ((x (mouse-x kr 0.9 1.1 1 0.1))
|
||
|
(y (mouse-y kr 1.8 2 1 0.1)))
|
||
|
(audition (out 0 (mul (cusp_ ar (fdiv sample-rate 4) x y 0) 0.3))))</p><p>as a frequency control</p><p>(let* ((x (mouse-x kr 0.9 1.1 1 0.1))
|
||
|
(y (mouse-y kr 1.8 2 1 0.1))
|
||
|
(f (mul-add (cusp_ ar 40 x y 0) 800 900)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0.0) 0.4))))</p><h4>2.338<tt> </tt><a name="(part.__lin-cong-c_rate_freq_a_c_m_xi_)"></a>(lin-cong-c rate freq a c m xi)</h4><p>(lin-cong-l rate freq a c m xi)
|
||
|
(lin-cong-n rate freq a c m xi)</p><p>linear congruential chaotic generator.</p><p>freq - iteration frequency in Hertz
|
||
|
a - multiplier amount
|
||
|
c - increment amount
|
||
|
m - modulus amount
|
||
|
xi - initial value of x</p><p>A cubic-interpolating sound generator based on the difference
|
||
|
equation:</p><p>xn+1 = (axn + c) % m</p><p>The output signal is automatically scaled to a range of [-1, 1].</p><p>Default initial parameters.</p><p>(audition
|
||
|
(out 0 (let ((x (mouse-x kr 20 sample-rate 0 0.1)))
|
||
|
(mul (lin-cong-c ar x 1.1 0.13 1 0) 0.2))))</p><p>randomly modulate parameters.</p><p>(audition
|
||
|
(out 0 (mul (lin-cong-c ar
|
||
|
(mul-add (lf-noise2 kr 1.0) 1e4 1e4)
|
||
|
(mul-add (lf-noise2 kr 0.1) 0.5 1.4)
|
||
|
(mul-add (lf-noise2 kr 0.1) 0.1 0.1)
|
||
|
(lf-noise2 kr 0.1)
|
||
|
0)
|
||
|
0.2)))</p><p>As frequency control...</p><p>(audition
|
||
|
(out 0 (mul (sin-osc ar (mul-add (lin-cong-c ar
|
||
|
40
|
||
|
(mul-add (lf-noise2 kr 0.1) 0.1 1.0)
|
||
|
(mul-add (lf-noise2 kr 0.1) 0.1 0.1)
|
||
|
(lf-noise2 kr 0.1)
|
||
|
0)
|
||
|
500 600) 0)
|
||
|
0.4)))</p><h4>2.339<tt> </tt><a name="(part.__crackle_rate_chaos.Param_)"></a>(crackle rate chaosParam)</h4><p>A noise generator based on a chaotic function. The parameter of
|
||
|
the chaotic function has useful values from just below 1.0 to just
|
||
|
above 2.0. Towards 2.0 the sound crackles.</p><p>The equation implemented is: y0 = fabs(y1 * param - y2 - 0.05f)</p><p>(audition (out 0 (mul (crackle ar 1.95) 0.5)))</p><p>Modulate chaos parameter</p><p>(let ((p (line kr 1.0 2.0 3 remove-synth)))
|
||
|
(audition (out 0 (mul (crackle ar p) 0.5))))</p><h4>2.340<tt> </tt><a name="(part.__henon-n_rate_freq_a_b_x0_x1_)"></a>(henon-n rate freq a b x0 x1)</h4><p>(henon-l rate freq a b x0 x1)
|
||
|
(henon-c rate freq a b x0 x1)</p><p>Henon map chaotic generator.</p><p>freq - iteration frequency in Hertz – 22050
|
||
|
a, b - equation variables – 1.4, 0.3
|
||
|
x0, x1 - initial and second values of x – 0, 0</p><p>A non-interpolating sound generator based on the difference
|
||
|
equation:</p><p>xn + 2 = 1 - axn + 12 + bxn</p><p>This equation was discovered by French astronomer Michel Henon
|
||
|
while studying the orbits of stars in globular clusters.</p><p>With default initial parameters.</p><p>(audition
|
||
|
(out 0 (mul (henon-n ar (mouse-x kr 20 sample-rate 0 0.1) 1.4 0.3 0 0)
|
||
|
0.1)))</p><p>With mouse-control of parameters.</p><p>(audition
|
||
|
(out 0 (mul (henon-n ar
|
||
|
(fdiv sample-rate 4)
|
||
|
(mouse-x kr 1 1.4 0 0.1)
|
||
|
(mouse-y kr 0 0.3 0 0.1)
|
||
|
0
|
||
|
0)
|
||
|
0.1)))</p><p>With randomly modulate parameters.</p><p>(audition
|
||
|
(out 0 (mul (henon-n ar
|
||
|
(fdiv sample-rate 8)
|
||
|
(mul-add (lf-noise2 kr 1) 0.20 1.20)
|
||
|
(mul-add (lf-noise2 kr 1) 0.15 0.15)
|
||
|
0
|
||
|
0)
|
||
|
0.1)))</p><p>As a frequency control.</p><p>(let ((x (mouse-x kr 1 1.4 0 0.1))
|
||
|
(y (mouse-y kr 0 0.3 0 0.1))
|
||
|
(f 40))
|
||
|
(audition
|
||
|
(out 0 (mul (sin-osc ar (mul-add (henon-n ar f x y 0 0) 800 900) 0)
|
||
|
0.4))))</p><h4>2.341<tt> </tt><a name="(part._.See_henon-n)"></a>See henon-n</h4><h4>2.342<tt> </tt><a name="(part._.See_lin-cong-c_)"></a>See lin-cong-c.</h4><h4>2.343<tt> </tt><a name="(part._.See_.Gbman.L_)"></a>See GbmanL.</h4><h4>2.344<tt> </tt><a name="(part._.See_.Gbman.L_)"></a>See GbmanL.</h4><h4>2.345<tt> </tt><a name="(part._.See_henon-n)"></a>See henon-n</h4><h4>2.346<tt> </tt><a name="(part._.See_lin-cong-c_)"></a>See lin-cong-c.</h4><h4>2.347<tt> </tt><a name="(part.__gbman-c_rate_freq_xi_yi_)"></a>(gbman-c rate freq xi yi)</h4><p>(gbman-l rate freq xi yi)
|
||
|
(gbman-n rate freq xi yi)</p><p>Gingerbreadman map chaotic generator. Cubic, linear and
|
||
|
non-interpolating variants.</p><p>freq - iteration frequency in Hertz
|
||
|
xi - initial value of x
|
||
|
yi - initial value of y</p><p>A linear-interpolating sound generator based on the difference
|
||
|
equations:</p><p>xn+1 = 1 - yn + |xn|
|
||
|
yn+1 = xn</p><p>The behavior of the system is dependent only on its initial conditions
|
||
|
qand cannot be changed once it’s started.</p><p>Reference: Devaney, R. L. "The Gingerbreadman." Algorithm 3, 15-16,
|
||
|
Jan. 1992.</p><p>sclang default initial parameters.</p><p>(audition
|
||
|
(out 0 (mul (gbman-l ar (mouse-x kr 20 sample-rate 0 0.1) 1.2 2.1) 0.1)))</p><p>Different initial parameters.</p><p>(audition
|
||
|
(out 0 (mul (gbman-l ar (mouse-x kr 20 sample-rate 0 0.1) -0.7 -2.7) 0.1)))</p><p>Wait for it...</p><p>(audition
|
||
|
(out 0 (mul (gbman-l ar (mouse-x kr 20 sample-rate 0 0.1) 1.2 2.0002) 0.1)))</p><p>As a frequency control</p><p>(audition
|
||
|
(out 0 (mul (sin-osc ar (mul-add (gbman-l ar 40 1.2 2.1) 400 500) 0) 0.4)))</p><h4>2.348<tt> </tt><a name="(part.__lin-pan2_in_pos_level_)"></a>(lin-pan2 in pos level)</h4><p>Two channel linear pan. See pan2.</p><p>(audition (out 0 (lin-pan2 (pink-noise ar) (f-sin-osc kr 2 0) 0.1)))</p><p>(audition (out 0 (lin-pan2 (f-sin-osc ar 800 0.1) (f-sin-osc kr 3 0) 0.1)))</p><h4>2.349<tt> </tt><a name="(part.__rotate2_x_y_pos_)"></a>(rotate2 x y pos)</h4><p>Rotate a sound field. rotate2 can be used for rotating an
|
||
|
ambisonic B-format sound field around an axis. rotate2 does an
|
||
|
equal power rotation so it also works well on stereo sounds. It
|
||
|
takes two audio inputs (x, y) and an angle control (pos). It
|
||
|
outputs two channels (x, y).</p><p>It computes:</p><p>xout = cos(angle) * xin + sin(angle) * yin
|
||
|
yout = cos(angle) * yin - sin(angle) * xin</p><p>where angle = pos * pi, so that -1 becomes -pi and +1 becomes +pi.
|
||
|
This allows you to use an lf-saw to do continuous rotation around a
|
||
|
circle.</p><p>The control pos is the angle to rotate around the circle from -1
|
||
|
to +1. -1 is 180 degrees, -0.5 is left, 0 is forward, +0.5 is
|
||
|
right, +1 is behind.</p><p>(let* ((p (mul (white-noise ar) 0.05))
|
||
|
(q (mul (mix (lf-saw ar (make-mce (list 200 200.37 201)) 0)) 0.03))
|
||
|
(encoded (add (pan-b2 p -0.5 1) (pan-b2 q -0.5 1)))
|
||
|
(rotated (rotate2 (mce-channel encoded 1)
|
||
|
(mce-channel encoded 2)
|
||
|
(mouse-x kr -1 1 0 0.1)))
|
||
|
(decoded (decode-b2 4
|
||
|
(mce-channel encoded 0)
|
||
|
(mce-channel rotated 0)
|
||
|
(mce-channel rotated 1)
|
||
|
0.5)))
|
||
|
(audition (out 0 decoded)))</p><p>Rotation of stereo sound, via LFO.</p><p>(let ((x (mul (pink-noise ar) 0.4))
|
||
|
(y (mul (lf-tri ar 800 0) (mul (lf-pulse kr 3 0 0.3) 0.2))))
|
||
|
(audition (out 0 (rotate2 x y (lf-saw kr 0.1 0)))))</p><p>Rotation of stereo sound, via mouse.</p><p>(let ((x (mix-fill 4 (lambda (_) (mul (lf-saw ar (rand 198 202) 0) 0.1))))
|
||
|
(y (mul (sin-osc ar 900 0) (mul (lf-pulse kr 3 0 0.3) 0.2))))
|
||
|
(audition (out 0 (rotate2 x y (mouse-x kr 0 2 0 0.1)))))</p><h4>2.350<tt> </tt><a name="(part.__decode-b2_num.Channels_w_x_y_orientation_)"></a>(decode-b2 numChannels w x y orientation)</h4><p>2D Ambisonic B-format decoder.</p><p>Decode a two dimensional ambisonic B-format signal to a set of
|
||
|
speakers in a regular polygon. The outputs will be in clockwise
|
||
|
order. The position of the first speaker is either center or left
|
||
|
of center.</p><p>The number of output speakers is typically 4 to 8.</p><p>The parameters w, x and y are the B-format signals.</p><p>The parameter orientation should be zero if the front is a vertex
|
||
|
of the polygon. The first speaker will be directly in
|
||
|
front. Should be 0.5 if the front bisects a side of the
|
||
|
polygon. Then the first speaker will be the one left of
|
||
|
center. Default is 0.5.</p><p>(let* ((p (pink-noise ar))
|
||
|
(encoded (pan-b2 p (mouse-x kr -1 1 0 0.1) 0.1))
|
||
|
(decoded (decode-b2 4
|
||
|
(mce-channel encoded 0)
|
||
|
(mce-channel encoded 1)
|
||
|
(mce-channel encoded 2)
|
||
|
0)))
|
||
|
(audition (out 0 decoded)))</p><h4>2.351<tt> </tt><a name="(part.__pan2_in_pos_level_)"></a>(pan2 in pos level)</h4><p>Two channel equal power panner. The pan position is bipolar, -1 is
|
||
|
left, +1 is right. The level is a control rate input.</p><p>(let ((p (f-sin-osc kr 2 0)))
|
||
|
(audition (out 0 (pan2 (pink-noise ar) p 0.3))))</p><p>(let ((x (mouse-x kr -1 1 0 0.1))
|
||
|
(y (mouse-y kr 0 1 0 0.1)))
|
||
|
(audition (out 0 (pan2 (pink-noise ar) x y))))</p><h4>2.352<tt> </tt><a name="(part.__pan-b2_in_azimuth_gain_)"></a>(pan-b2 in azimuth gain)</h4><p>2D Ambisonic B-format panner. Encode a mono signal to two
|
||
|
dimensional ambisonic B-format. The azimuth parameter is the
|
||
|
position around the circle from -1 to +1. -1 is behind, -0.5 is
|
||
|
left, 0 is forward, +0.5 is right, +1 is behind.</p><p>(let* ((p (pink-noise ar))
|
||
|
(encoded (pan-b2 p (mouse-x kr -1 1 0 0.1) 0.1))
|
||
|
(decoded (decode-b2 4
|
||
|
(mce-channel encoded 0)
|
||
|
(mce-channel encoded 1)
|
||
|
(mce-channel encoded 2)
|
||
|
0.5)))
|
||
|
(audition (out 0 decoded)))</p><h4>2.353<tt> </tt><a name="(part.__detect-silence_in_amp_time_done.Action_)"></a>(detect-silence in amp time doneAction)</h4><p>If the signal at ‘in’ falls below ‘amp’ for ‘time’ seconds then
|
||
|
‘doneAction’ is raised.</p><p>(let ((s (mul (sin-osc ar 440 0) (mouse-y kr 0 0.4 0 0.1))))
|
||
|
(audition (mrg2 (detect-silence s 0.1 0.2 remove-synth)
|
||
|
(out 0 s))))</p><p>(with-sc3 display-server-status)</p><h4>2.354<tt> </tt><a name="(part.__line_rate_start_end_dur_done.Action_)"></a>(line rate start end dur doneAction)</h4><p>Generates a line from the start value to the end value.</p><p>start - starting value
|
||
|
end - ending value
|
||
|
dur - duration in seconds</p><p>Note: The SC3 UGen reorders the mul and add inputs to precede the
|
||
|
doneAction input.</p><p>(let ((f (line kr 200 17000 5 remove-synth)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.355<tt> </tt><a name="(part.__free_trig_node.I.D_)"></a>(free trig nodeID)</h4><p>When triggered frees a node.</p><p>trig - when triggered, frees node
|
||
|
nodeID - node to be freed</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send-synth fd "a" (out 0 (mul (sin-osc ar 800 0) 0.1)))
|
||
|
(send-synth fd "b" (mrg2 (out 1 (mul (pink-noise ar) 0.1))
|
||
|
(free (dust ar 6) 1001)))
|
||
|
(send fd (s-new0 "a" 1001 0 0))
|
||
|
(send fd (s-new0 "b" -1 0 0))))</p><p>(with-sc3 reset)</p><h4>2.356<tt> </tt><a name="(part.__pause-self-when-done_src_)"></a>(pause-self-when-done src)</h4><p>pause the synth when the ’done’ flag of the unit at ‘src’ is set.</p><p>(let* ((x (mouse-x kr -1 1 0 0.1))
|
||
|
(e (linen x 1 0.1 1 pause-synth)))
|
||
|
(audition (out 0 (mul (sin-osc ar 440 0) e))))</p><p>(let* ((x (mouse-x kr -1 1 0 0.1))
|
||
|
(e (linen x 2 0.1 2 do-nothing)))
|
||
|
(audition (mrg2 (pause-self-when-done e)
|
||
|
(out 0 (mul (sin-osc ar 440 0) e)))))</p><h4>2.357<tt> </tt><a name="(part.__pause-self_src_)"></a>(pause-self src)</h4><p>pause enclosing synth when input signal crosses from non-positive
|
||
|
to positive. If the synth is restarted and the gate reset the
|
||
|
synthesis *not* paused a second time.</p><p>(audition
|
||
|
(mrg2 (pause-self (mouse-x kr -1 1 0 0.1))
|
||
|
(out 0 (mul (sin-osc ar 440 0) 0.1))))</p><h4>2.358<tt> </tt><a name="(part.__env-gen_rate_gate_level.Scale_level.Bias_time.Scale_done.Action_envelope_)"></a>(env-gen rate gate levelScale levelBias timeScale doneAction envelope)</h4><p>A segment based envelope generator. Note that the SC3 language
|
||
|
reorders the inputs to this UGen so that the envelope is the first
|
||
|
argument.</p><p>There are utilities for contructing the envelope argument.</p><p>The arguments for levelScale, levelBias, and timeScale are polled
|
||
|
when the env-gen is triggered and remain constant for the duration
|
||
|
of the envelope.</p><p>envelope - an breakpoint set</p><p>gate - this triggers the envelope and holds it open while > 0. If
|
||
|
the Env is fixed-length (e.g. Env.linen, Env.perc), the gate
|
||
|
argument is used as a simple trigger. If it is an sustaining
|
||
|
envelope (e.g. Env.adsr, Env.asr), the envelope is held open
|
||
|
until the gate becomes 0, at which point is released.</p><p>levelScale - scales the levels of the breakpoints.</p><p>levelBias - offsets the levels of the breakpoints.</p><p>timeScale - scales the durations of the segments.</p><p>doneAction - an integer representing an action to be executed when
|
||
|
the env is finished playing. This can be used to free
|
||
|
the enclosing synth, etc.</p><p>(import (rhs) (rsc3))</p><p>Percussive envelope
|
||
|
(let* ((d (env-perc 0.01 1 1 (list -4 -4)))
|
||
|
(e (env-gen kr 1 0.1 0 1 remove-synth d)))
|
||
|
(audition (out 0 (mul e (sin-osc ar 440 0)))))</p><p>The break-point assistant makes a static envelope from a
|
||
|
co-ordinate list. There is a duration and amplitude scalar.
|
||
|
(let* ((d (env-coord (list (cons 0 0)
|
||
|
(cons 0.75 1)
|
||
|
(cons 1 0))
|
||
|
1 1 (replicate 3 "linear")))
|
||
|
(e (env-gen kr 1 0.1 0 1 remove-synth d)))
|
||
|
(audition (out 0 (mul e (sin-osc ar 440 0)))))</p><p>Trapezoidal
|
||
|
(let* ((d (env-trapezoid 0 0.25 2 0.1))
|
||
|
(e (env-gen kr 1 0.1 0 1 remove-synth d)))
|
||
|
(audition (out 0 (mul e (sin-osc ar 440 0)))))</p><p>0.0 3 -1 -1 0.1 0.5 1.0 0.0 0.1 0.0 1.0 0.0 0.0 1.5 1.0 0.0
|
||
|
(env-trapezoid 0 0.25 2 0.1)</p><h4>2.359<tt> </tt><a name="(part.__free-self-when-done_src_)"></a>(free-self-when-done src)</h4><p>free the synth when the ’done’ flag of the unit at ‘src’ is set.</p><p>(let* ((x (mouse-x kr -1 1 0 0.1))
|
||
|
(e (linen x 1 0.1 1 remove-synth)))
|
||
|
(audition (out 0 (mul (sin-osc ar 440 0) e))))</p><p>(let* ((x (mouse-x kr -1 1 0 0.1))
|
||
|
(e (linen x 2 0.1 2 do-nothing)))
|
||
|
(audition (mrg2 (free-self-when-done e)
|
||
|
(out 0 (mul (sin-osc ar 440 0) e)))))</p><h4>2.360<tt> </tt><a name="(part.__pause_gate_node.I.D_)"></a>(pause gate nodeID)</h4><p>When triggered pauses a node.</p><p>gate - when gate is 0, node is paused, when 1 it runs
|
||
|
nodeID - node to be paused</p><p>(with-sc3
|
||
|
(lambda (fd)
|
||
|
(send-synth fd "a" (out 0 (mul (sin-osc ar 800 0) 0.1)))
|
||
|
(send-synth fd "b" (letc ((g 1))
|
||
|
(Mrg (out 1 (mul (pink-noise ar) 0.05))
|
||
|
(pause g 1001))))
|
||
|
(send fd (/s_new "a" 1001 0 0))
|
||
|
(send fd (/s_new "b" 1002 0 0))
|
||
|
(sleep 1)
|
||
|
(send fd (/n_set 1002 "g" 0))
|
||
|
(sleep 1)
|
||
|
(send fd (/n_set 1002 "g" 1))
|
||
|
(sleep 1)
|
||
|
(reset fd)))</p><h4>2.361<tt> </tt><a name="(part.__x-line_rate_start_end_dur_done.Action_)"></a>(x-line rate start end dur doneAction)</h4><p>Exponential line generator. Generates an exponential curve from
|
||
|
the start value to the end value. Both the start and end values
|
||
|
must be non-zero and have the same sign.</p><p>start - starting value
|
||
|
end - ending value
|
||
|
dur - duration in seconds
|
||
|
doneAction - a doneAction to be evaluated when the x-line is
|
||
|
completed. See env-gen for details.</p><p>(let ((f (x-line kr 200 17000 10 remove-synth)))
|
||
|
(audition (out 0 (mul (sin-osc ar f 0) 0.1))))</p><h4>2.362<tt> </tt><a name="(part.__done_src_)"></a>(done src)</h4><p>outputs a unit signal if the ’done’ flag of the unit at ‘src’ is
|
||
|
set, else output zero.</p><p>(let* ((x (mouse-x kr -1 1 0 0.1))
|
||
|
(e (linen x 0.1 0.1 0.5 do-nothing))
|
||
|
(l (mul (sin-osc ar 880 0) 0.1))
|
||
|
(r (sin-osc ar 440 0)))
|
||
|
(audition (out 0 (mce2 (mul (done e) l)
|
||
|
(mul e r)))))</p><h4>2.363<tt> </tt><a name="(part.__linen_gate_attack.Time_sus.Level_release.Time_done.Action_)"></a>(linen gate attackTime susLevel releaseTime doneAction)</h4><p>A linear envelope generator. The done flag is set when the
|
||
|
envelope reaches zero.</p><p>Note that the sustain level input is consulted only at the instant
|
||
|
when the gate is opened.</p><p>(let ((e (linen (impulse kr 2 0) 0.01 0.1 0.4 do-nothing)))
|
||
|
(audition (out 0 (mul (sin-osc ar 440 0) e))))</p><p>(let* ((y (mouse-y kr 0.1 0.5 0 0.1))
|
||
|
(x (mouse-x kr -1 1 0 0.1))
|
||
|
(e (linen x 1 y 1.0 do-nothing))
|
||
|
(o (sin-osc ar 440 0)))
|
||
|
(audition (out 0 (mul o e))))</p><p>Open gate for a random interval.</p><p>(let* ((r (rand 0.05 0.4))
|
||
|
(u (letc ((gate 0))
|
||
|
(let ((e (linen gate 0.1 0.2 0.1 do-nothing)))
|
||
|
(out 0 (mul (sin-osc ar 440 0) e)))))
|
||
|
(g (encode-graphdef (synthdef "linen" u))))
|
||
|
(with-sc3
|
||
|
(lambda (fd)
|
||
|
(async fd (d-recv g))
|
||
|
(send fd (s-new0 "linen" 1001 1 1))
|
||
|
(send fd (bundle (utc) (n-set1 1001 "gate" 1)))
|
||
|
(send fd (bundle (+ (utc) r)
|
||
|
(n-set1 1001 "gate" 0)))
|
||
|
(sleep (* r 4))
|
||
|
(send fd (n-free1 1001)))))</p><h4>2.364<tt> </tt><a name="(part.__free-self_src_)"></a>(free-self src)</h4><p>free enclosing synth when the input signal ‘src’ crosses from
|
||
|
non-positive to positive.</p><p>(audition
|
||
|
(mrg2 (free-self (mouse-x kr -1 1 0 0.1))
|
||
|
(out 0 (mul (sin-osc ar 440 0) 0.1))))</p><div class="navsetbottom"><span class="navleft"><div class="nosearchform"></div> <span class="tocsettoggle"> <a href="javascript:void(0);" title="show/hide table of contents" onclick="TocsetToggle();">contents</a></span></span><span class="navright"> <a href="rsc3__server_commands.html" title="backward to "1 rsc3: server commands"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "rsc3: racket/scheme/supercollider"" data-pltdoc="x">up</a> <a href="rsc3__tutorials.html" title="forward to "3 rsc3: tutorials"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|