p0 = output start time (seconds) p1 = input start time (seconds) p2 = output duration (seconds) p3 = input duration (seconds, not input end time) p4 = maintain input duration, regardless of transposition (1: yes, 0: no) p5 = transposition (oct.pc) p6 = number of voices (minimum of 1) p7 = minimum grain amplitude (relative multiplier of p13) p8 = maximum grain amplitude (relative multiplier of p13) p9 = minimum grain wait (seconds) p10 = maximum grain wait (seconds) p11 = seed (0-1) p12 = input channel p13 = overall amplitude (relative multiplier of input sound) p14 = grain envelope table (pfield-handle) p7 (min amp), p8 (max amp), p9 (min wait), p10 (max wait) and p13 (amp mult) can receive dynamic updates from a table or real-time control source. p14 (grain envelope) should be a reference to a pfield table-handle. Author: John Gibson, 9/20/98, RT'd 6/24/99; rev for v4, 7/24/04 based on Paul Lansky's CMIX chor instrument and Doug Scott's TRANS code
p14 ("GRAINENV") is a pfield-handle reference to a table with the envelope to be applied for each grain. NOTE: You will probably need to set the reset control-rate value (see the reset scorefile command) fairly high for small grains.
Output can be either mono or stereo. If it's stereo, the program randomly
distributes the voices across the stereo field.
Sample Scores
very basic:
rtsetparams(44100, 2) load("JCHOR") rtinput("mysound.aif") inchan = 0 inskip = 0.20 outdur = 10 indur = 0.60 maintain_dur = 1 transposition = 0.07 nvoices = 50 minamp = 0.01 maxamp = 1.0 minwait = 0.00 maxwait = 0.30 seed = 0.9371 amp = 0.5 env = maketable("line", 1000, 0,0, 1,1, outdur-1,1, outdur,0) grainenv = maketable("window", 1000, "hanning") JCHOR(0, inskip, outdur, indur, maintain_dur, transposition, nvoices, minamp, maxamp, minwait, maxwait, seed, inchan, amp * env, grainenv)
rtsetparams(44100, 2) load("JCHOR") rtinput("mysound.wav") inchan = 0 outdur = 16 inskip = 0.01 indur = 0.20 maintain_dur = 1 transposition = 0.02 nvoices = 60 minamp = 0.1 maxamp = 1.0 minwait = 0.00 maxwait = 0.60 seed = 0.9371 amp = 6.0 env = maketable("line", 1000, 0,0, 1,1, outdur-3,1, outdur,0) grainenv = maketable("window", 1000, "hanning") reset(2000) outskip = 0 JCHOR(outskip, inskip, outdur, indur, maintain_dur, transposition, nvoices, minamp, maxamp, minwait, maxwait, seed, inchan, amp * env, grainenv) outskip = 2 outdur -= outskip amp = 0.6 indur = 0.90 transposition = -0.10 maxamp = 0.5 maxwait = 1.0 seed = 0.2353 JCHOR(outskip, inskip, outdur, indur, maintain_dur, transposition, nvoices, minamp, maxamp, minwait, maxwait, seed, inchan, amp * env, grainenv)