<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>RingBuffer (Posts about _sound_synthesis:sampling-practical)</title><link>http://ringbuffer.org/</link><description></description><atom:link href="http://ringbuffer.org/categories/cat__sound_synthesissampling-practical.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><lastBuildDate>Tue, 25 Feb 2025 02:08:07 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>SuperCollider Granular Example</title><link>http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/</link><dc:creator>Henrik von Coler</dc:creator><description>&lt;p&gt;The &lt;code class="docutils literal"&gt;TGrains&lt;/code&gt; UGen is an easy to use granular synth. It uses a Hanning window
for each grain and offers control over position, pitch and length of the grains.
The help files offer multiple examples for using this unit generator.
The following example uses a simple pulse train for triggering grains.&lt;/p&gt;
&lt;hr class="docutils"&gt;
&lt;section id="reading-channels"&gt;
&lt;h2&gt;Reading Channels&lt;/h2&gt;
&lt;p&gt;A single channel is loaded to a buffer from a sample for this granular example.
The duration in seconds can be queried from the buffer object, once loaded.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code supercollider"&gt;&lt;a id="rest_code_4ffa64ff3d954a949b41e188c6631301-1" name="rest_code_4ffa64ff3d954a949b41e188c6631301-1" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_4ffa64ff3d954a949b41e188c6631301-1"&gt;&lt;/a&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;buffer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;readChannel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"/some/wavefile.wav"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;channels&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_4ffa64ff3d954a949b41e188c6631301-2" name="rest_code_4ffa64ff3d954a949b41e188c6631301-2" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_4ffa64ff3d954a949b41e188c6631301-2"&gt;&lt;/a&gt;
&lt;a id="rest_code_4ffa64ff3d954a949b41e188c6631301-3" name="rest_code_4ffa64ff3d954a949b41e188c6631301-3" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_4ffa64ff3d954a949b41e188c6631301-3"&gt;&lt;/a&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;hr class="docutils"&gt;
&lt;section id="the-granular-node"&gt;
&lt;h2&gt;The Granular Node&lt;/h2&gt;
&lt;p&gt;The granular node uses an &lt;code class="docutils literal"&gt;Impulse&lt;/code&gt; UGen to create a trigger signal for the &lt;code class="docutils literal"&gt;TGrains&lt;/code&gt; UGen.
This node has several arguments to control the granular process:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;The &lt;strong&gt;density&lt;/strong&gt; defines how often a grain is triggered per second.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Every grain can be &lt;strong&gt;pitch&lt;/strong&gt; shifted by a value (1 = default rate).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The grain &lt;strong&gt;duration&lt;/strong&gt; is specified in seconds.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The grain &lt;strong&gt;center&lt;/strong&gt; is defined in seconds.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A &lt;em&gt;gain&lt;/em&gt; parameter can be used for amplification.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;buffer&lt;/em&gt; specifies the index of the buffer to be used.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Once the node has been created with a &lt;code class="docutils literal"&gt;nil&lt;/code&gt; buffer, the buffer index of the
previously loaded sample can be passed. Depending on the nature of the sample,
this can already result in something audible:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code supercollider"&gt;&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-1" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-1" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-1"&gt;&lt;/a&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;grains&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-2" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-2" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-2"&gt;&lt;/a&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-3" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-3" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-3"&gt;&lt;/a&gt;    &lt;span class="o"&gt;|&lt;/span&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-4" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-4" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-4"&gt;&lt;/a&gt;    &lt;span class="nx"&gt;density&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-5" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-5" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-5"&gt;&lt;/a&gt;    &lt;span class="nx"&gt;pitch&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-6" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-6" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-6"&gt;&lt;/a&gt;    &lt;span class="nx"&gt;dur&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-7" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-7" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-7"&gt;&lt;/a&gt;    &lt;span class="nx"&gt;center&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-8" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-8" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-8"&gt;&lt;/a&gt;    &lt;span class="nx"&gt;gain&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-9" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-9" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-9"&gt;&lt;/a&gt;    &lt;span class="nx"&gt;buffer&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-10" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-10" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-10"&gt;&lt;/a&gt;    &lt;span class="o"&gt;|&lt;/span&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-11" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-11" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-11"&gt;&lt;/a&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-12" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-12" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-12"&gt;&lt;/a&gt;    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;trigger&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Impulse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;kr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;density&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-13" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-13" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-13"&gt;&lt;/a&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-14" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-14" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-14"&gt;&lt;/a&gt;    &lt;span class="nx"&gt;Out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   &lt;span class="nx"&gt;gain&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;TGrains&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;trigger&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;buffer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;pitch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;center&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;dur&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-15" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-15" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-15"&gt;&lt;/a&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-16" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-16" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-16"&gt;&lt;/a&gt;&lt;span class="p"&gt;}.&lt;/span&gt;&lt;span class="nx"&gt;play&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-17" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-17" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-17"&gt;&lt;/a&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-18" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-18" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-18"&gt;&lt;/a&gt;
&lt;a id="rest_code_7662f7cc0c71416a8d7ef580436148c9-19" name="rest_code_7662f7cc0c71416a8d7ef580436148c9-19" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_7662f7cc0c71416a8d7ef580436148c9-19"&gt;&lt;/a&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;grains&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;\buffer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bufnum&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;hr class="docutils"&gt;
&lt;section id="manual-parameter-setting"&gt;
&lt;h2&gt;Manual Parameter Setting&lt;/h2&gt;
&lt;p&gt;As with any node, the arguments of the granular process can be set, manually.
Since the center is specified in seconds, the buffer duration is useful at this point.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code supercollider"&gt;&lt;a id="rest_code_fa4435213f36414c866f5413496bcd41-1" name="rest_code_fa4435213f36414c866f5413496bcd41-1" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_fa4435213f36414c866f5413496bcd41-1"&gt;&lt;/a&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;grains&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;\center&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_fa4435213f36414c866f5413496bcd41-2" name="rest_code_fa4435213f36414c866f5413496bcd41-2" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_fa4435213f36414c866f5413496bcd41-2"&gt;&lt;/a&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;grains&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;\density&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_fa4435213f36414c866f5413496bcd41-3" name="rest_code_fa4435213f36414c866f5413496bcd41-3" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_fa4435213f36414c866f5413496bcd41-3"&gt;&lt;/a&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;grains&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;\dur&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_fa4435213f36414c866f5413496bcd41-4" name="rest_code_fa4435213f36414c866f5413496bcd41-4" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/#rest_code_fa4435213f36414c866f5413496bcd41-4"&gt;&lt;/a&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;grains&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;\pitch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;hr class="docutils"&gt;
&lt;section id="exercise"&gt;
&lt;h2&gt;Exercise&lt;/h2&gt;
&lt;aside class="admonition admonition-exercise-i"&gt;
&lt;p class="admonition-title"&gt;Exercise I&lt;/p&gt;
&lt;p&gt;Use the mouse with buses for a fluid control of granular parameters.&lt;/p&gt;
&lt;/aside&gt;
&lt;aside class="admonition admonition-exercise-ii"&gt;
&lt;p class="admonition-title"&gt;Exercise II&lt;/p&gt;
&lt;p&gt;Use envelopes for an automatic control of the granular parameters.&lt;/p&gt;
&lt;/aside&gt;
&lt;/section&gt;</description><guid>http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/supercollider-granular-example/</guid><pubDate>Sun, 02 May 2021 10:40:00 GMT</pubDate></item><item><title>Playing Samples in SuperCollider</title><link>http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/</link><dc:creator>Henrik von Coler</dc:creator><description>&lt;p&gt;The &lt;code class="docutils literal"&gt;Buffer&lt;/code&gt; class manages samples in SuperCollider.
There are many ways to use samples, based on these buffers.
The following example loads a WAV file (find it in the download)
and creates a looping node. When running, the playback speed can be changed:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code supercollider"&gt;&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-1" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-1" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-1"&gt;&lt;/a&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;boot&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-2" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-2" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-2"&gt;&lt;/a&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-3" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-3" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-3"&gt;&lt;/a&gt;&lt;span class="c1"&gt;// get and enter the absolute path to a sample&lt;/span&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-4" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-4" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-4"&gt;&lt;/a&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;sample_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"/some/directory/sala_formanten.wav"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-5" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-5" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-5"&gt;&lt;/a&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-6" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-6" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-6"&gt;&lt;/a&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;buffer&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;sample_path&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-7" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-7" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-7"&gt;&lt;/a&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-8" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-8" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-8"&gt;&lt;/a&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-9" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-9" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-9"&gt;&lt;/a&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;sampler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-10" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-10" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-10"&gt;&lt;/a&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-11" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-11" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-11"&gt;&lt;/a&gt;      &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nx"&gt;rate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-12" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-12" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-12"&gt;&lt;/a&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-13" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-13" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-13"&gt;&lt;/a&gt;      &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;LoopBuf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bufnum&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;BufRateScale&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;kr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bufnum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;rate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;numFrames&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-14" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-14" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-14"&gt;&lt;/a&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-15" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-15" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-15"&gt;&lt;/a&gt;      &lt;span class="nx"&gt;Out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;out&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-16" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-16" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-16"&gt;&lt;/a&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-17" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-17" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-17"&gt;&lt;/a&gt;&lt;span class="p"&gt;}.&lt;/span&gt;&lt;span class="nx"&gt;play&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-18" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-18" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-18"&gt;&lt;/a&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-19" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-19" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-19"&gt;&lt;/a&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-20" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-20" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-20"&gt;&lt;/a&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-21" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-21" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-21"&gt;&lt;/a&gt;&lt;span class="c1"&gt;// set the play rate manually&lt;/span&gt;
&lt;a id="rest_code_5f68cdad20fc443091a67ab7f3eba842-22" name="rest_code_5f68cdad20fc443091a67ab7f3eba842-22" href="http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/#rest_code_5f68cdad20fc443091a67ab7f3eba842-22"&gt;&lt;/a&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="nx"&gt;sampler&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;\rate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;hr class="docutils"&gt;
&lt;section id="exercise"&gt;
&lt;h2&gt;Exercise&lt;/h2&gt;
&lt;aside class="admonition admonition-exercise"&gt;
&lt;p class="admonition-title"&gt;Exercise&lt;/p&gt;
&lt;p&gt;Combine the sample looper example with the control bus and mouse input example to create a synth for &lt;em&gt;scratching&lt;/em&gt; sound files.&lt;/p&gt;
&lt;/aside&gt;
&lt;/section&gt;</description><guid>http://ringbuffer.org/sound_synthesis_introduction/Processed_Recording/playing-samples-in-supercollider/</guid><pubDate>Sun, 02 May 2021 10:40:00 GMT</pubDate></item></channel></rss>