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

114 lines
7.8 KiB
HTML
Raw Normal View History

2022-08-24 13:53:18 +00:00
<!doctype html><html lang='en'><head><title>DynKlank | SuperCollider 3.9.3 Help</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>
var helpRoot = './..';
var scdoc_title = 'DynKlank';
var scdoc_sc_version = '3.9.3';
</script>
<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>
</head>
<body onload='fixTOC();prettyPrint()'>
<div id='toc'>
<div id='toctitle'>DynKlank:</div>
<span class='toc_search'>Filter: <input id='toc_search'></span><ul class='toc'><li class='toc1'><a href='#description'>Description</a></li>
<ul class='toc'></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><div class='contents'>
<div id='menubar'></div>
<div class='header'>
<div id='label'>
<span id='folder'>Classes</span>
| <span id='categories'><a href='./../Browse.html#UGens'>UGens</a>&#8201;&gt;&#8201;<a href='./../Browse.html#UGens>Generators'>Generators</a>&#8201;&gt;&#8201;<a href='./../Browse.html#UGens>Generators>Deterministic'>Deterministic</a> | <a href='./../Browse.html#UGens'>UGens</a>&#8201;&gt;&#8201;<a href='./../Browse.html#UGens>Filters'>Filters</a>&#8201;&gt;&#8201;<a href='./../Browse.html#UGens>Filters>Linear'>Linear</a></span>
</div><h1>DynKlank<span id='superclasses'> : <a href="../Classes/UGen.html">UGen</a> : <a href="../Classes/AbstractFunction.html">AbstractFunction</a> : <a href="../Classes/Object.html">Object</a></span>
</h1>
<div id='summary'>Bank of resonators.</div>
</div>
<div class='subheader'>
<div id='filename'>Source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Audio/FSinOsc.sc' title='/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Audio/FSinOsc.sc'>FSinOsc.sc</a></div><div id='related'>See also: <a href="./../Classes/Klang.html">Klang</a>, <a href="./../Classes/Klank.html">Klank</a></div>
</div>
<h2><a class='anchor' name='description'>Description</a></h2>
<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>Unlike <a href="./../Classes/Klank.html">Klank</a>, all parameters in DynKlank can be changed in real-time after it has been started.<div class='note'><span class='notelabel'>NOTE:</span> The amplitude of the resulting signal depends on the server's sample rate. See <a href="./../Classes/Ringz.html#Interaction%20with%20sample%20rate">Ringz: Interaction with sample rate</a> for details.</div><h2><a class='anchor' name='classmethods'>Class Methods</a></h2>
<h3 class='method-code'><span class='method-prefix'>DynKlank.</span><a class='method-name' name='*ar' href='./../Overviews/Methods.html#ar'>ar</a>(<span class='argstr'>specificationsArrayRef</span>, <span class='argstr'>input</span>, <span class='argstr'>freqscale: 1</span>, <span class='argstr'>freqoffset: 0</span>, <span class='argstr'>decayscale: 1</span>)</h3>
<h3 class='method-code'><span class='method-prefix'>DynKlank.</span><a class='method-name' name='*kr' href='./../Overviews/Methods.html#kr'>kr</a>(<span class='argstr'>specificationsArrayRef</span>, <span class='argstr'>input</span>, <span class='argstr'>freqscale: 1</span>, <span class='argstr'>freqoffset: 0</span>, <span class='argstr'>decayscale: 1</span>)</h3>
<div class='method'>
<p><h4>Arguments:</h4>
<table class='arguments'>
<tr><td class='argumentname'>specificationsArrayRef<td class='argumentdesc'>
<p>A Ref to an Array of three Arrays: <code class='code prettyprint lang-sc'>[frequencies, amplitudes, ringtimes]</code><dl>
<dt>frequencies:<dd>An Array of filter frequencies.<dt>amplitudes:<dd>An Array of filter amplitudes, or nil. If nil, then amplitudes default to 1.0.<dt>ring times:<dd>An Array of 60 dB decay times for the filters.</dl>
<p>All subarrays, if not nil, should have the same length.<tr><td class='argumentname'>input<td class='argumentdesc'>
<p>The excitation input to the resonant filter bank.<tr><td class='argumentname'>freqscale<td class='argumentdesc'>
<p>A scale factor multiplied by all frequencies at initialization time.<tr><td class='argumentname'>freqoffset<td class='argumentdesc'>
<p>An offset added to all frequencies at initialization time.<tr><td class='argumentname'>decayscale<td class='argumentdesc'>
<p>A scale factor multiplied by all ring times at initialization time.</table></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>
<p>Four resonators each at maximum amplitude of 1.0 and ring times of 1 second, different exciters and no scaling:<div class='note'><span class='notelabel'>NOTE:</span> Watch the ` before the opening bracket of the parameter array! Also see <a href="./../Guides/Multichannel-Expansion.html">Multichannel Expansion</a></div>
<p><pre class='code prettyprint lang-sc'>{ DynKlank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;
{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;
{ DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;
{ DynKlank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007, 0.007])) }.play;</pre>
<p>Changing parameters in realtime:<pre class='code prettyprint lang-sc'>(
// change freqs and ringtimes with mouse
{ var freqs, ringtimes;
freqs = [800, 1071, 1153, 1723] * MouseX.kr(0.5, 2, 1);
ringtimes = [1, 1, 1, 1] * MouseY.kr(0.1, 10, 1);
DynKlank.ar(`[freqs, nil, ringtimes ], Impulse.ar(2, 0, 0.1))
}.play;
)
(
// set them from outside later:
SynthDef('help-dynKlank', { |out|
var freqs, ringtimes, signal;
freqs = Control.names([\freqs]).kr([800, 1071, 1153, 1723]);
ringtimes = Control.names([\ringtimes]).kr([1, 1, 1, 1]);
signal = DynKlank.ar(`[freqs, nil, ringtimes ], Impulse.ar(2, 0, 0.1));
Out.ar(out, signal);
}).add;
)
a = Synth('help-dynKlank');
a.setn(\freqs, Array.rand(4, 500, 2000));
a.setn(\ringtimes, Array.rand(4, 0.2, 4) );
a.setn(\ringtimes, Array.rand(4, 0.02, 0.4) );
// create multichannel controls directly with literal arrays:
(
SynthDef('help-dynKlank', { |out,
freqs (#[100, 200, 300, 400]),
amps (#[1, 0.3, 0.2, 0.05]),
rings (#[1, 1, 1, 2])|
Out.ar(out, DynKlank.ar(`[freqs, amps, rings], WhiteNoise.ar * 0.001))
}).add
)
a = Synth('help-dynKlank');
a.setn(\freqs, Array.rand(4, 500, 2000));
a.setn(\amps, Array.exprand(4, 0.01, 1));
{ Out.kr(102, MouseX.kr(1, 2) * Array.rand(4, 500, 2000)) }.play;
a.mapn(\freqs, 102, 4);</pre>
<div class='doclink'>helpfile source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/DynKlank.schelp'>/Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/DynKlank.schelp</a><br>link::Classes/DynKlank::<br></div></div></body></html>