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

112 lines
No EOL
7.2 KiB
HTML

<!doctype html><html lang='en'><head><title>Warp1 | SuperCollider 3.10.2 Help</title>
<link rel='stylesheet' href='./../scdoc.css' type='text/css' />
<link rel='stylesheet' href='./../codemirror.css' type='text/css' />
<link rel='stylesheet' href='./../editor.css' type='text/css' />
<link rel='stylesheet' href='./../frontend.css' type='text/css' />
<link rel='stylesheet' href='./../custom.css' type='text/css' />
<meta name='viewport' content='width=device-width, initial-scale=1'>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<script src='./../lib/jquery.min.js'></script>
<script src='./../lib/codemirror-5.39.2.min.js' type='text/javascript'></script>
<script src='./../lib/codemirror-addon-simple-5.39.2.min.js' type='text/javascript'></script>
<script>
var helpRoot = './..';
var scdoc_title = 'Warp1';
var scdoc_sc_version = '3.10.2';
</script>
<script src='./../scdoc.js' type='text/javascript'></script>
<script src='./../docmap.js' type='text/javascript'></script>
<script src='qrc:///qtwebchannel/qwebchannel.js' type='text/javascript'></script>
</head>
<body onload='fixTOC()'>
<div id='toc'>
<div id='toctitle'>Warp1:</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> </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 id='menubar'></div>
<div class='contents'>
<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>Buffer'>Buffer</a> | <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>Granular'>Granular</a></span>
</div><h1>Warp1<span id='superclasses'> : <a href="../Classes/MultiOutUGen.html">MultiOutUGen</a> : <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'>Warp a buffer with a time pointer</div>
</div>
<div class='subheader'>
<div id='filename'>Source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Audio/GrainUGens.sc' title='/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Audio/GrainUGens.sc'>GrainUGens.sc</a></div></div>
<h2><a class='anchor' name='description'>Description</a></h2>
<p>Inspired by Chad Kirby's SuperCollider2 Warp1 class, which was inspired by Richard Karpen's sndwarp for CSound. A granular time stretcher and pitchshifter.<h2><a class='anchor' name='classmethods'>Class Methods</a></h2>
<h3 class='method-code'><span class='method-prefix'>Warp1.</span><a class='method-name' name='*ar' href='./../Overviews/Methods.html#ar'>ar</a>(<span class='argstr'>numChannels: 1</span>, <span class='argstr'>bufnum: 0</span>, <span class='argstr'>pointer: 0</span>, <span class='argstr'>freqScale: 1</span>, <span class='argstr'>windowSize: 0.2</span>, <span class='argstr'>envbufnum: -1</span>, <span class='argstr'>overlaps: 8</span>, <span class='argstr'>windowRandRatio: 0.0</span>, <span class='argstr'>interp: 1</span>, <span class='argstr'>mul: 1</span>, <span class='argstr'>add: 0</span>)</h3>
<div class='method'><h4>Arguments:</h4>
<table class='arguments'>
<tr><td class='argumentname'>numChannels<td class='argumentdesc'>
<p>the number of channels in the soundfile used in bufnum.<tr><td class='argumentname'>bufnum<td class='argumentdesc'>
<p>the buffer number of a mono soundfile.<tr><td class='argumentname'>pointer<td class='argumentdesc'>
<p>the position in the buffer. The value should be between 0 and 1, with 0 being the beginning of the buffer, and 1 the end.<tr><td class='argumentname'>freqScale<td class='argumentdesc'>
<p>the amount of frequency shift. 1.0 is normal, 0.5 is one octave down, 2.0 is one octave up. Negative values play the soundfile backwards.<tr><td class='argumentname'>windowSize<td class='argumentdesc'>
<p>the size of each grain window.<tr><td class='argumentname'>envbufnum<td class='argumentdesc'>
<p>the buffer number containing a signal to use for the grain envelope. -1 uses a built-in Hanning envelope.<tr><td class='argumentname'>overlaps<td class='argumentdesc'>
<p>the number of overlapping windows.<tr><td class='argumentname'>windowRandRatio<td class='argumentdesc'>
<p>the amount of randomness to the windowing function. Must be between 0 (no randomness) to 1.0 (probably too random actually)<tr><td class='argumentname'>interp<td class='argumentdesc'>
<p>the interpolation method used for pitchshifting grains. 1 = no interpolation. 2 = linear. 4 = cubic interpolation (more computationally intensive).<tr><td class='argumentname'>mul<td class='argumentdesc'><tr><td class='argumentname'>add<td class='argumentdesc'></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>
<textarea class='editor'>s.boot;
(
b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01-44_1.aiff");
x = { |envbuf = -1|
var pointer, pitch;
// pointer - move from beginning to end of soundfile over 15 seconds
pointer = LFSaw.ar(1/15).range(0, 1);
// control pitch with MouseX
pitch = MouseX.kr(0.5, 2);
Warp1.ar(
numChannels:1,
bufnum:b,
pointer:pointer,
freqScale:pitch,
windowSize:0.1,
envbufnum:envbuf,
overlaps:8,
windowRandRatio:0.1,
interp:2
)
}.play
)
(
// a custom envelope - not a very good one, but you can hear the difference
// between this and the default
var winenv = Env([0, 1, 0], [0.5, 0.5], [8, -8]);
z = Buffer.sendCollection(s, winenv.discretize, 1);
x.set(\envbuf, z);
)
// the default is -1
x.set(\envbuf, -1);
// relase and end
x.relase; z.free;</textarea>
<textarea class='editor'>(
b.free;
b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01-44_1.aiff");
{
var pointer = Phasor.ar(0, SampleDur.ir / BufDur.ir(b) * XLine.kr(1, 0.25, 20));
var sound = Warp1.ar(1, b, pointer, 1, 0.3, -1, 16, Line.kr(0, 1, 40), 4);
Pan2.ar(sound, pointer * 2 - 1, 0.25)
}.play
)
b.free;</textarea>
<div class='doclink'>helpfile source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/Warp1.schelp'>/Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/Warp1.schelp</a><br>link::Classes/Warp1::<br></div></div><script src='./../editor.js' type='text/javascript'></script>
</body></html>