75 lines
No EOL
5 KiB
HTML
75 lines
No EOL
5 KiB
HTML
<!doctype html><html lang='en'><head><title>ModDif | 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 = 'ModDif';
|
|
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'>ModDif:</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> <a href='#*ir'>ir</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></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> > <a href='./../Browse.html#UGens>Maths'>Maths</a></span>
|
|
</div><h1>ModDif<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'>Minimum difference of two values in modulo arithmetics</div>
|
|
</div>
|
|
<div class='subheader'>
|
|
<div id='filename'>Source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Audio/Trig.sc' title='/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Audio/Trig.sc'>Trig.sc</a></div><div id='related'>See also: <a href="./../Classes/Clip.html">Clip</a>, <a href="./../Classes/Wrap.html">Wrap</a></div>
|
|
</div>
|
|
<h2><a class='anchor' name='description'>Description</a></h2>
|
|
|
|
<p>Returns the minimum difference of two values in modulo arithmetics. On a circle, there are two distances between two points. This UGen returns the smaller value of the two.<pre class='code prettyprint lang-sc'>{ var a = Line.ar(0, 4, 0.01), d = ModDif.ar(a); [a, d] }.plot;
|
|
{ var a = Line.ar(0, 4, 0.01); ModDif.ar(a, 0, (1..4)) }.plot;
|
|
{ var a = Line.ar(0, 4, 0.01); ModDif.ar(a, (0, 0.25 .. 1), 1) }.plot;</pre>
|
|
<h2><a class='anchor' name='classmethods'>Class Methods</a></h2>
|
|
<h3 class='method-code'><span class='method-prefix'>ModDif.</span><a class='method-name' name='*ar' href='./../Overviews/Methods.html#ar'>ar</a>(<span class='argstr'>x: 0</span>, <span class='argstr'>y: 0</span>, <span class='argstr'>mod: 1</span>)</h3>
|
|
<h3 class='method-code'><span class='method-prefix'>ModDif.</span><a class='method-name' name='*kr' href='./../Overviews/Methods.html#kr'>kr</a>(<span class='argstr'>x: 0</span>, <span class='argstr'>y: 0</span>, <span class='argstr'>mod: 1</span>)</h3>
|
|
<h3 class='method-code'><span class='method-prefix'>ModDif.</span><a class='method-name' name='*ir' href='./../Overviews/Methods.html#ir'>ir</a>(<span class='argstr'>x: 0</span>, <span class='argstr'>y: 0</span>, <span class='argstr'>mod: 1</span>)</h3>
|
|
<div class='method'>
|
|
<p><h4>Arguments:</h4>
|
|
<table class='arguments'>
|
|
<tr><td class='argumentname'>x<td class='argumentdesc'>
|
|
<p>First input value<tr><td class='argumentname'>y<td class='argumentdesc'>
|
|
<p>Second input value<tr><td class='argumentname'>mod<td class='argumentdesc'>
|
|
<p>Modulo (maximum value, double of the maximal difference).<pre class='code prettyprint lang-sc'>// different moduli
|
|
(
|
|
{
|
|
var sig = LFSaw.ar(10);
|
|
var dist = ModDif.kr(sig, 0, (0..8) * MouseX.kr(0, 1/5));
|
|
Splay.ar(SinOsc.ar(dist * 4000 + 400)) * 0.1
|
|
}.play;
|
|
)
|
|
|
|
// wrapping amplitude crossfade
|
|
(
|
|
{
|
|
var numChan = 12;
|
|
var x = SinOsc.ar({ rrand(300.0, 800.0) } ! numChan);
|
|
var dist = ModDif.kr(MouseX.kr(0, numChan * 2), (0..numChan-1), numChan);
|
|
x = x * max(0, 1 - dist);
|
|
Splay.ar(x) * 0.1
|
|
}.play;
|
|
)</pre>
|
|
</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><div class='doclink'>helpfile source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/ModDif.schelp'>/Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/ModDif.schelp</a><br>link::Classes/ModDif::<br></div></div></body></html> |