130 lines
No EOL
5.8 KiB
HTML
130 lines
No EOL
5.8 KiB
HTML
<html><head><title>WaveTerrain</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 (extension)</div>
|
|
<div id='categories'><a href='./../Browse.html#UGens>Buffer'>UGens>Buffer</a></div>
|
|
<h1>WaveTerrain</h1>
|
|
<div id='summary'>wave terrain synthesis</div>
|
|
</div>
|
|
<div class='subheader'>
|
|
<div id='filename'>Source: <a href='file:///Users/zzk/Library/Application Support/SuperCollider/Extensions/SLUGens/classes/SLUGens.sc'>/Users/zzk/Library/Application Support/SuperCollider/Extensions/SLUGens/classes/SLUGens.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/VMScan2D.html">VMScan2D</a></div>
|
|
</div>
|
|
<div id='toc'>
|
|
<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> </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>
|
|
<p>//SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, <a href="http://composerprogrammer.com/index.html">http://composerprogrammer.com/index.html</a><a class='anchor' name='kw_SLUGens'> </a><h2><a class='anchor' name='description'>Description</a></h2>
|
|
|
|
<p>Specify a surface z(x,y) via a buffer and scan it from the x and y inputs. <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'>bufnum: 0</span>, <span class='argstr'>x</span>, <span class='argstr'>y</span>, <span class='argstr'>xsize: 100</span>, <span class='argstr'>ysize: 100</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'>bufnum<td class='argumentdesc'>
|
|
<p>Your surface is a two dimensional array, but specified via a one dimensional buffer. The convention is exhibited below; note that you have to pass in the surface dimensions as well. <tr><td class='argumentname'>x<td class='argumentdesc'><tr><td class='argumentname'>y<td class='argumentdesc'>
|
|
<p>audio rate scanning instructions. Both values must be in the range 0.0 to 1.0, or they are wrapped into this range. </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>
|
|
<pre class='code prettyprint lang-sc'>//create buffer. I want the equation z = 2*(((x/100)**2) + ((abs(sin(10*y))/50)**(1/3)))-1
|
|
//over a 100 by 50 area
|
|
|
|
//2d to 1d conversion follows index= y*rowlength+ x
|
|
(
|
|
var width= 100; //= num cols
|
|
var height=50; //=num rows, though indexing bottom to top; i.e., standard Cartesian co-ordinates
|
|
|
|
a=Array.fill(width*height,{arg i;
|
|
var xnow, ynow, x, y;
|
|
|
|
xnow= i%width;
|
|
ynow= (i-xnow).div(width);
|
|
|
|
x=xnow/width;
|
|
y=ynow/height;
|
|
|
|
2*(((x)**2) + ((abs(sin(10*y)))**(1/3)))-1
|
|
|
|
});
|
|
|
|
|
|
b=Buffer.sendCollection(s, a, 1);
|
|
)
|
|
|
|
|
|
//test scanning; you can't move fast enough... scan controls should also be audio rate!
|
|
{WaveTerrain.ar(b.bufnum,MouseX.kr(0.0,1.0), MouseY.kr(0.0,1.0),100,50)}.play
|
|
|
|
|
|
//LFNoise adds some drift to explore the landscape more
|
|
{WaveTerrain.ar(b.bufnum,SinOsc.ar(MouseX.kr(1,200,'exponential')).abs + LFNoise2.ar(2),SinOsc.ar(MouseY.kr(1,300,'exponential'),pi*0.5).abs,100,50)}.play
|
|
|
|
|
|
|
|
|
|
|
|
//change surface equation
|
|
(
|
|
var width= 100; //= num cols
|
|
var height=50; //=num rows, though indexing bottom to top; i.e., standard Cartesian co-ordinates
|
|
|
|
a=Array.fill(width*height,{arg i;
|
|
var xnow, ynow, x, y;
|
|
|
|
xnow= i%width;
|
|
ynow= (i-xnow).div(width);
|
|
|
|
x=xnow/width;
|
|
y=ynow/height;
|
|
|
|
(((cos(5*x+1.7))**3) - ((abs(sin(23*y)))**(1/3)))
|
|
|
|
});
|
|
|
|
b.sendCollection(a);
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
//change surface equation
|
|
(
|
|
var width= 100; //= num cols
|
|
var height=50; //=num rows, though indexing bottom to top; i.e., standard Cartesian co-ordinates
|
|
|
|
a=Array.fill(width*height,{arg i;
|
|
var xnow, ynow, x, y;
|
|
|
|
xnow= i%width;
|
|
ynow= (i-xnow).div(width);
|
|
|
|
x=xnow/width;
|
|
y=ynow/height;
|
|
|
|
(((1.3*(cos(rrand(1,2)*x+1.7))**2) - ((abs(sin(rrand(1.2,4.9)*y)))**(1/2)))).max(-1.0).min(1.0)
|
|
|
|
});
|
|
|
|
b.sendCollection(a);
|
|
)</pre>
|
|
|
|
<p><div class='doclink'>helpfile source: <a href='file:///Users/zzk/Library/Application Support/SuperCollider/Extensions/SLUGens/HelpSource/Classes/WaveTerrain.schelp'>/Users/zzk/Library/Application Support/SuperCollider/Extensions/SLUGens/HelpSource/Classes/WaveTerrain.schelp</a><br>link::Classes/WaveTerrain::<br>sc version: 3.8.0</div></div></body></html> |