rsc3/doc-schelp/Help-3.12.2/Classes/Gendy1.html

227 lines
12 KiB
HTML
Raw Normal View History

2022-08-24 13:53:18 +00:00
<html><head><title>Gendy1</title>
<link rel='stylesheet' href='./../scdoc.css' type='text/css' />
<link rel='stylesheet' href='./../frontend.css' type='text/css' />
<link rel='stylesheet' href='./../custom.css' type='text/css' />
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<script src='./../scdoc.js' type='text/javascript'></script>
<script src='./../docmap.js' type='text/javascript'></script>
<script src='./../prettify.js' type='text/javascript'></script>
<script src='./../lang-sc.js' type='text/javascript'></script>
<script type='text/javascript'>var helpRoot='./..';</script>
</head>
<ul id='menubar'></ul>
<body onload='fixTOC();prettyPrint()'>
<div class='contents'>
<div class='header'>
<div id='label'>SuperCollider CLASSES</div>
<div id='categories'><a href='./../Browse.html#UGens>Generators>Stochastic'>UGens>Generators>Stochastic</a></div>
<h1>Gendy1</h1>
<div id='summary'>Dynamic stochastic synthesis generator.</div>
</div>
<div class='subheader'>
<div id='filename'>Source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Audio/Gendyn.sc'>/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Audio/Gendyn.sc</a></div><div id='superclasses'>Inherits from: <a href="../Classes/UGen.html">UGen</a> : <a href="../Classes/AbstractFunction.html">AbstractFunction</a> : <a href="../Classes/Object.html">Object</a></div>
<div id='related'>See also: <a href="./../Classes/Gendy2.html">Gendy2</a>, <a href="./../Classes/Gendy3.html">Gendy3</a></div>
</div>
<div id='toc'>
<ul class='toc'><li class='toc1'><a href='#description'>Description</a></li>
<ul class='toc'><li class='toc2'><a href='#Technical%20notes'>Technical notes</a></li>
<ul class='toc'></ul></ul><li class='toc1'><a href='#classmethods'>Class methods</a></li>
<ul class='toc'><li class='toc3'><a href='#*ar'>ar</a> <a href='#*kr'>kr</a> </li>
<li class='toc2'><a href='#Inherited%20class%20methods'>Inherited class methods</a></li>
</ul><li class='toc1'><a href='#instancemethods'>Instance methods</a></li>
<ul class='toc'><li class='toc2'><a href='#Inherited%20instance%20methods'>Inherited instance methods</a></li>
</ul><li class='toc1'><a href='#examples'>Examples</a></li>
<ul class='toc'></ul></ul></div><h2><a class='anchor' name='description'>Description</a></h2>
<p>An implementation of the dynamic stochastic synthesis generator conceived by Iannis Xenakis and described in <em>Formalized Music (1992, Stuyvesant, NY: Pendragon Press) chapter 9 (pp 246-254) and chapters 13 and 14 (pp 289-322)</em>.
<p>The BASIC program in the book was written by Marie-Helene Serra so I think it helpful to credit her too.
<p>The program code has been adapted to avoid infinities in the probability distribution functions.
<p>The distributions are hard-coded in C but there is an option to have new amplitude or time breakpoints sampled from a continuous controller input.<h3><a class='anchor' name='Technical%20notes'>Technical notes</a></h3>
<p>X's plan as described in chapter 13 allows the 12 segments in the period to be successively modified with each new period. Yet the period is allowed to vary as the sum of the segment durations, as figure 1 demonstrates. We can setup some memory of n (conventionally 12) points, or even simply vary successively a single point's ordinate and duration. There are thus various schemes available to us. In one, fix period T and only move the (ti, Ei) within the period. In another, have a memory of 12 segments but allow continuous modification of the inter point intervals and the amplitudes. In yet another, just have one point and random walk its amplitude and duration based on the probability distribution. In this implementation I allow the user to initialise a certain number of memory points which is up to them. To restrict the period to be unchanging, you must set rate variation to zero (dscale=0).
<p>SuperCollider implementation by Nick Collins.<h2><a class='anchor' name='classmethods'>Class Methods</a></h2>
<h3 class='cmethodname'><span class='methprefix'>*</span><a name='*ar' href='./../Overviews/Methods.html#ar'>ar</a> (<span class='argstr'>ampdist: 1</span>, <span class='argstr'>durdist: 1</span>, <span class='argstr'>adparam: 1</span>, <span class='argstr'>ddparam: 1</span>, <span class='argstr'>minfreq: 440</span>, <span class='argstr'>maxfreq: 660</span>, <span class='argstr'>ampscale: 0.5</span>, <span class='argstr'>durscale: 0.5</span>, <span class='argstr'>initCPs: 12</span>, <span class='argstr'>knum</span>, <span class='argstr'>mul: 1</span>, <span class='argstr'>add: 0</span>)</h3>
<h3 class='cmethodname'><span class='methprefix'>*</span><a name='*kr' href='./../Overviews/Methods.html#kr'>kr</a> (<span class='argstr'>ampdist: 1</span>, <span class='argstr'>durdist: 1</span>, <span class='argstr'>adparam: 1</span>, <span class='argstr'>ddparam: 1</span>, <span class='argstr'>minfreq: 20</span>, <span class='argstr'>maxfreq: 1000</span>, <span class='argstr'>ampscale: 0.5</span>, <span class='argstr'>durscale: 0.5</span>, <span class='argstr'>initCPs: 12</span>, <span class='argstr'>knum</span>, <span class='argstr'>mul: 1</span>, <span class='argstr'>add: 0</span>)</h3>
<div class='method'>
<p><h4>Arguments:</h4>
<table class='arguments'>
<tr><td class='argumentname'>ampdist<td class='argumentdesc'>
<p>Choice of probability distribution for the next perturbation of the amplitude of a control point.
<p>The distributions are (adapted from the GENDYN program in Formalized Music):<table>
<tr><td>0:<td>LINEAR.<tr><td>1:<td>CAUCHY.<tr><td>2:<td>LOGIST.<tr><td>3:<td>HYPERBCOS.<tr><td>4:<td>ARCSINE.<tr><td>5:<td>EXPON.<tr><td>6:<td>SINUS.</table>
<p>Where the sinus (Xenakis' name) is in this implementation taken as sampling from a third party oscillator. See example below.<tr><td class='argumentname'>durdist<td class='argumentdesc'>
<p>Choice of distribution for the perturbation of the current inter control point duration.<tr><td class='argumentname'>adparam<td class='argumentdesc'>
<p>A parameter for the shape of the amplitude probability distribution, requires values in the range 0.0001 to 1 (there are safety checks in the code so don't worry too much if you want to modulate!).<tr><td class='argumentname'>ddparam<td class='argumentdesc'>
<p>A parameter for the shape of the duration probability distribution, requires values in the range 0.0001 to 1.<tr><td class='argumentname'>minfreq<td class='argumentdesc'>
<p>Minimum allowed frequency of oscillation for the Gendy1 oscillator, so gives the largest period the duration is allowed to take on.<tr><td class='argumentname'>maxfreq<td class='argumentdesc'>
<p>Maximum allowed frequency of oscillation for the Gendy1 oscillator, so gives the smallest period the duration is allowed to take on.<tr><td class='argumentname'>ampscale<td class='argumentdesc'>
<p>Normally 0.0 to 1.0, multiplier for the distribution's delta value for amplitude. An ampscale of 1.0 allows the full range of -1 to 1 for a change of amplitude.<tr><td class='argumentname'>durscale<td class='argumentdesc'>
<p>Normally 0.0 to 1.0, multiplier for the distribution's delta value for duration. An ampscale of 1.0 allows the full range of -1 to 1 for a change of duration.<tr><td class='argumentname'>initCPs<td class='argumentdesc'>
<p>Initialise the number of control points in the memory. Xenakis specifies 12. There would be this number of control points per cycle of the oscillator, though the oscillator's period will constantly change due to the duration distribution.<tr><td class='argumentname'>knum<td class='argumentdesc'>
<p>Current number of utilised control points, allows modulation.<tr><td class='argumentname'>mul<td class='argumentdesc'><tr><td class='argumentname'>add<td class='argumentdesc'></table><h4>Discussion:</h4>
<p>All parameters can be modulated at control rate except for <code class='code prettyprint lang-sc'>initCPs</code> which is used only at initialisation.</div><h3><a class='anchor' name='Inherited%20class%20methods'>Inherited class methods</a></h3>
<div id='inheritedclassmets'></div><h2><a class='anchor' name='instancemethods'>Instance Methods</a></h2>
<h3><a class='anchor' name='Inherited%20instance%20methods'>Inherited instance methods</a></h3>
<div id='inheritedinstmets'></div><h2><a class='anchor' name='examples'>Examples</a></h2>
<div class='warning'><span class='warninglabel'>WARNING:</span> if you have lots of CPs and you have fast frequencies, the CPU cost goes up a lot because a new CP move happens every sample!</div><pre class='code prettyprint lang-sc'>//defaults
{Pan2.ar(Gendy1.ar)}.play
//wandering bass/ powerline
{Pan2.ar(Gendy1.ar(1,1,1.0,1.0,30,100,0.3,0.05,5))}.play
//play me
{Pan2.ar(RLPF.ar(Gendy1.ar(2,3,minfreq:20,maxfreq:MouseX.kr(100,1000),durscale:0.0,initCPs:40),500,0.3,0.2),0.0)}.play
//scream! - careful with your ears for this one!
(
{
var mx, my;
mx= MouseX.kr(220,440);
my= MouseY.kr(0.0,1.0);
Pan2.ar(Gendy1.ar(2,3,1,1,minfreq:mx, maxfreq:8*mx, ampscale:my, durscale:my, initCPs:7, mul:0.3), 0.0)
}.play
)
//1 CP = random noise effect
{Pan2.ar(Gendy1.ar(initCPs:1))}.play
//2 CPs = suudenly an oscillator (though a fast modulating one here)
{Pan2.ar(Gendy1.ar(initCPs:2))}.play
//used as an LFO
(
{
Pan2.ar(
SinOsc.ar(
Gendy1.kr(2, 4,
SinOsc.kr(0.1,0,0.49,0.51),
SinOsc.kr(0.13,0,0.49,0.51),
3.4, 3.5,
SinOsc.kr(0.17,0,0.49,0.51),
SinOsc.kr(0.19,0,0.49,0.51),
10,10,50, 350),
0, 0.3),
0.0)
}.play
)
//wasp
{Pan2.ar(Gendy1.ar(0, 0, SinOsc.kr(0.1, 0, 0.1, 0.9),1.0, 50,1000, 1,0.005, 12, 12, 0.2), 0.0)}.play
//modulate distributions
//change of pitch as distributions change the duration structure and spectrum
{Pan2.ar(Gendy1.ar(MouseX.kr(0,7),MouseY.kr(0,7),mul:0.2), 0.0)}.play
//modulate num of CPs
{Pan2.ar(Gendy1.ar(knum:MouseX.kr(1,13),mul:0.2), 0.0)}.play
(//Gendy into Gendy...with cartoon side effects
{Pan2.ar(Gendy1.ar(
maxfreq:Gendy1.kr(5,4,0.3, 0.7, 0.1, MouseY.kr(0.1,10), 1.0, 1.0, 5,5, 500, 600),
knum:MouseX.kr(1,13),mul:0.2), 0.0)
}.play
)
//use SINUS to track any oscillator and take CP positions from it, use adparam and ddparam as the inputs to sample
{Pan2.ar(Gendy1.ar(6,6,LFPulse.kr(100, 0, 0.4, 1.0), SinOsc.kr(30, 0, 0.5),mul:0.2), 0.0)}.play
//try out near the corners especially
(
{Pan2.ar(Gendy1.ar(6,6,LFPulse.kr(MouseX.kr(0,200), 0, 0.4, 1.0),
SinOsc.kr(MouseY.kr(0,200), 0, 0.5),mul:0.2), 0.0)}.play
)
//texture
(
{
Mix.fill(10,{
var freq;
freq= rrand(130,160.3);
Pan2.ar(SinOsc.ar(Gendy1.ar(6.rand,6.rand,SinOsc.kr(0.1,0,0.49,0.51),
SinOsc.kr(0.13,0,0.49,0.51),freq ,freq, SinOsc.kr(0.17,0,0.49,0.51),
SinOsc.kr(0.19,0,0.49,0.51), 12, 12, 200, 400), 0, 0.1), 1.0.rand2)
});
}.play
)
//wahhhhhhhh- try durscale 10.0 and 0.0 too
(
{Pan2.ar(
CombN.ar(
Resonz.ar(
Gendy1.ar(2,3,minfreq:1, maxfreq:MouseX.kr(10,700), durscale:0.1, initCPs:10),
MouseY.kr(50,1000), 0.1)
,0.1,0.1,5, 0.6
)
, 0.0)}.play
)
//overkill
(
{
var n;
n=10;
Mix.fill(n,{
var freq, numcps;
freq= rrand(130,160.3);
numcps= rrand(2,20);
Pan2.ar(Gendy1.ar(6.rand,6.rand,1.0.rand,1.0.rand,freq ,freq, 1.0.rand, 1.0.rand, numcps,
SinOsc.kr(exprand(0.02,0.2), 0, numcps/2, numcps/2), 0.5/(n.sqrt)), 1.0.rand2)
});
}.play
)
//another traffic moment
(
{
var n;
n=10;
Resonz.ar(
Mix.fill(n,{
var freq, numcps;
freq= rrand(50,560.3);
numcps= rrand(2,20);
Pan2.ar(Gendy1.ar(6.rand,6.rand,1.0.rand,1.0.rand,freq ,freq, 1.0.rand, 1.0.rand, numcps,
SinOsc.kr(exprand(0.02,0.2), 0, numcps/2, numcps/2), 0.5/(n.sqrt)), 1.0.rand2)
})
,MouseX.kr(100,2000), MouseY.kr(0.01,1.0))
;
}.play
)
(
{
var n;
n=15;
Out.ar(0,
Resonz.ar(
Mix.fill(n,{
var freq, numcps;
freq= rrand(330,460.3);
numcps= rrand(2,20);
Pan2.ar(Gendy1.ar(6.rand,6.rand,1.0.rand,1.0.rand,freq,MouseX.kr(freq,2*freq), 1.0.rand, 1.0.rand, numcps,
SinOsc.kr(exprand(0.02,0.2), 0, numcps/2, numcps/2), 0.5/(n.sqrt)), 1.0.rand2)
})
,MouseX.kr(100,2000), MouseY.kr(0.01,1.0))
)
}.play;
)</pre>
<div class='doclink'>helpfile source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/Gendy1.schelp'>/Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/Gendy1.schelp</a><br>link::Classes/Gendy1::<br>sc version: 3.8.0</div></div></body></html>