<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://cycling74.com/wiki/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://cycling74.com/wiki/index.php?title=MSP_Basics_Tutorial_3:_Wavetable_Oscillator&amp;feed=atom&amp;action=history</id>
		<title>MSP Basics Tutorial 3: Wavetable Oscillator - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://cycling74.com/wiki/index.php?title=MSP_Basics_Tutorial_3:_Wavetable_Oscillator&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://cycling74.com/wiki/index.php?title=MSP_Basics_Tutorial_3:_Wavetable_Oscillator&amp;action=history"/>
		<updated>2013-05-20T14:31:31Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.1</generator>

	<entry>
		<id>http://cycling74.com/wiki/index.php?title=MSP_Basics_Tutorial_3:_Wavetable_Oscillator&amp;diff=819&amp;oldid=prev</id>
		<title>Gtaylor@rtqe.net at 15:27, 28 June 2012</title>
		<link rel="alternate" type="text/html" href="http://cycling74.com/wiki/index.php?title=MSP_Basics_Tutorial_3:_Wavetable_Oscillator&amp;diff=819&amp;oldid=prev"/>
				<updated>2012-06-28T15:27:01Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 15:27, 28 June 2012&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;chapter name=&amp;quot;MSP Basics Tutorial 3: Wavetable Oscillator&amp;quot;&amp;gt; &lt;/del&gt;Click here to open the tutorial patch: [[03mWavetableOscillator.maxpat]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Click here to open the tutorial patch: [[&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Media:&lt;/ins&gt;03mWavetableOscillator.maxpat]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;===Introduction===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;===Introduction===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Gtaylor@rtqe.net</name></author>	</entry>

	<entry>
		<id>http://cycling74.com/wiki/index.php?title=MSP_Basics_Tutorial_3:_Wavetable_Oscillator&amp;diff=765&amp;oldid=prev</id>
		<title>Admin at 21:07, 25 June 2012</title>
		<link rel="alternate" type="text/html" href="http://cycling74.com/wiki/index.php?title=MSP_Basics_Tutorial_3:_Wavetable_Oscillator&amp;diff=765&amp;oldid=prev"/>
				<updated>2012-06-25T21:07:00Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;http://cycling74.com/wiki/index.php?title=MSP_Basics_Tutorial_3:_Wavetable_Oscillator&amp;amp;diff=765&amp;amp;oldid=711&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://cycling74.com/wiki/index.php?title=MSP_Basics_Tutorial_3:_Wavetable_Oscillator&amp;diff=711&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;Click here to open the tutorial patch: 03mWavetableOscillator.maxpat  ===Introduction===  In this tutorial patch, we'll look at how to use a wavetable other than a sine wa...&quot;</title>
		<link rel="alternate" type="text/html" href="http://cycling74.com/wiki/index.php?title=MSP_Basics_Tutorial_3:_Wavetable_Oscillator&amp;diff=711&amp;oldid=prev"/>
				<updated>2012-06-22T21:01:11Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;Click here to open the tutorial patch: &lt;a href=&quot;/wiki/index.php?title=03mWavetableOscillator.maxpat&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;03mWavetableOscillator.maxpat (page does not exist)&quot;&gt;03mWavetableOscillator.maxpat&lt;/a&gt;  ===Introduction===  In this tutorial patch, we&amp;#039;ll look at how to use a wavetable other than a sine wa...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Click here to open the tutorial patch: [[03mWavetableOscillator.maxpat]]&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
In this tutorial patch, we'll look at how to use a wavetable other than a sine&lt;br /&gt;
wave to generate sound using the {{maxword|name=cycle~}} object. Along the way, we'll&lt;br /&gt;
look at how to generate more complex curves using the {{maxword|name=line~}} object, and&lt;br /&gt;
get a peek at how MSP stores audio data in computer memory using&lt;br /&gt;
the {{maxword|name=buffer~}} object.&lt;br /&gt;
&lt;br /&gt;
===A stored sound: buffer~===&lt;br /&gt;
&lt;br /&gt;
In the previous examples, the {{maxword|name=cycle~}} object was used to read repeatedly&lt;br /&gt;
through a set of values describing a cycle of a cosine wave. As it happens, a {{maxword|name=cycle~}} object&lt;br /&gt;
can read through ''any'' set of values, treating them as a single cycle of a waveform. These numbers must &lt;br /&gt;
be stored in our computer's memory, and can be loaded from a soundfile,&lt;br /&gt;
generated programmatically by an algorithm, or even drawn by hand. The MSP object&lt;br /&gt;
that maintains these pieces of memory is called {{maxword|name=buffer~}}.&lt;br /&gt;
&lt;br /&gt;
The {{maxword|name=buffer~}} object can be used easily; it requires a single argument:&lt;br /&gt;
a name to uniquely identify it. Any audio data stored in that {{maxword|name=buffer~}} becomes&lt;br /&gt;
associated with that name. The name of the {{maxword|name=buffer~}} is arbitrary and doesn't&lt;br /&gt;
have to match the name of the audio file loaded into it; the only requirement is&lt;br /&gt;
that it not conflict with other ''named'' items in open Max patches (such&lt;br /&gt;
as {{maxword|name=table}} objects or {{maxword|name=send}}/{{maxword|name=receive}} pairs). As you can see,&lt;br /&gt;
we've named the {{maxword|name=buffer~}} in our tutorial patcher &amp;lt;code&amp;gt;chris&amp;lt;/code&amp;gt;, after our&lt;br /&gt;
good friend Chris Dobrian, who made the original version of this (and many other)&lt;br /&gt;
tutorials.&lt;br /&gt;
&lt;br /&gt;
Messages sent to the object allow you to load in audio files, resize, or&lt;br /&gt;
clear the memory of the {{maxword|name=buffer~}}. The trick is this: the {{maxword|name=buffer~}} object&lt;br /&gt;
itself doesn't ''play back'' any audio; it simply holds onto the sample data&lt;br /&gt;
and associates a name with it that {{maxword|name=other}} MSP objects can use to get at the&lt;br /&gt;
data. A {{maxword|name=cycle~}} object can then be made to read from that {{maxword|name=buffer~}} by&lt;br /&gt;
typing the same name in as its argument. The initial frequency value for the {{maxword|name=cycle~}} object,&lt;br /&gt;
just before the buffer name, is optional.&lt;br /&gt;
&lt;br /&gt;
To get the sound into the {{maxword|name=buffer~}}, send it a &amp;lt;code&amp;gt;replace&amp;lt;/code&amp;gt; message,&lt;br /&gt;
followed by the name of an audio file in the search path of the Max program.&lt;br /&gt;
If you leave out the name of a file, Max will open an Open Document dialog&lt;br /&gt;
box, allowing you to select an audio file to load. The &amp;lt;code&amp;gt;replace&amp;lt;/code&amp;gt; message&lt;br /&gt;
reads in an audio file and automatically ''sizes'' the {{maxword|name=buffer~}} object's&lt;br /&gt;
memory to match the length of the audio file.&lt;br /&gt;
&lt;br /&gt;
Regardless of the length of the sound in the {{maxword|name=buffer~}}, the {{maxword|name=cycle~}} object&lt;br /&gt;
will only use a set number of samples from it for its waveform. (If you like, you can specify&lt;br /&gt;
a starting point in the {{maxword|name=buffer~}} for {{maxword|name=cycle~}} to begin its waveform,&lt;br /&gt;
either with an additional argument to {{maxword|name=cycle~}} or with a &amp;lt;code&amp;gt;set&amp;lt;/code&amp;gt; message&lt;br /&gt;
to {{maxword|name=cycle~}}.) In the example patch, we use an audio file that contains&lt;br /&gt;
exactly 512 samples called &amp;lt;code&amp;gt;gtr512.aiff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
'''Technical detail: In fact, {{maxword|name=cycle~}}''' uses 513 samples. The&lt;br /&gt;
513th sample is used only for interpolation from the 512th sample.&lt;br /&gt;
When {{maxword|name=cycle~}} is being used to create a periodic waveform, as in this&lt;br /&gt;
example patch, the 513th sample should be the same as the 1st sample. If&lt;br /&gt;
the {{maxword|name=buffer~}} contains only 512 samples, as in this example, {{maxword|name=cycle~}} supplies&lt;br /&gt;
a 513th sample that is the same as the 1st sample.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
* In the tutorial patcher, click on the {{maxword|name=message}} box that says &amp;lt;code&amp;gt;replace gtr512.aiff&amp;lt;/code&amp;gt;.&lt;br /&gt;
This loads in the audio file into our {{maxword|name=buffer~}} (named &amp;lt;code&amp;gt;chris&amp;lt;/code&amp;gt;).&lt;br /&gt;
Then click on the {{maxword|name=ezdac~}} object to turn the audio on. You won't hear&lt;br /&gt;
anything. Turn up the volume by setting the {{maxword|name=number}} box labeled &amp;lt;code&amp;gt;Volume&amp;lt;/code&amp;gt;&lt;br /&gt;
to something like &amp;lt;code&amp;gt;0.2&amp;lt;/code&amp;gt;. You still won't hear anything. Next, click on&lt;br /&gt;
the {{maxword|name=message}} box labeled &amp;lt;code&amp;gt;A&amp;lt;/code&amp;gt;. You should hear a short burst of what&lt;br /&gt;
sounds like noise. Click on the {{maxword|name=message}} labeled &amp;lt;code&amp;gt;B&amp;lt;/code&amp;gt;. You should hear a&lt;br /&gt;
rich oscillating tone fade in and out over a second. Click the other &amp;lt;code&amp;gt;message&amp;lt;/code&amp;gt; boxes&lt;br /&gt;
in turn, listening the the result. Notice the different values in the lists being sent&lt;br /&gt;
to the {{maxword|name=line~}} objects, as well as the different frequencies that&lt;br /&gt;
the {{maxword|name=cycle~}} objects in the tutorial are set to.&lt;br /&gt;
&lt;br /&gt;
There are several other objects that can use the data in a {{maxword|name=buffer~}},&lt;br /&gt;
as you will see in later chapters.&lt;br /&gt;
&lt;br /&gt;
===Creating complex envelopes with line~===&lt;br /&gt;
&lt;br /&gt;
In the previous example patch, we used {{maxword|name=line~}} to make a linearly&lt;br /&gt;
changing signal by sending it a list of two numbers. The first number in&lt;br /&gt;
the list was a target value and the second was the amount of time, in milliseconds,&lt;br /&gt;
for {{maxword|name=line~}} to arrive at the target value.&lt;br /&gt;
&lt;br /&gt;
[[Image:Basicchapter03b.png|border]]&lt;br /&gt;
''line~ is given a target value (1.) and an amount of time to get there (100 ms)''&lt;br /&gt;
&lt;br /&gt;
If we want to, we can send {{maxword|name=line~}} a longer list containing many value-time&lt;br /&gt;
pairs of numbers (up to 64 pairs of numbers). In this way, we can make a {{maxword|name=line~}} object&lt;br /&gt;
perform a more elaborate function composed of many adjoining line segments.&lt;br /&gt;
After completing the first line segment, {{maxword|name=line~}} proceeds immediately&lt;br /&gt;
toward the next target value in the list, taking the specified amount of time&lt;br /&gt;
to get there. In this way, we can great function curves for synthesizers that&lt;br /&gt;
are commonly referred to as ''envelopes''.&lt;br /&gt;
&lt;br /&gt;
[[Image:Basicchapter03c.png|border]]&lt;br /&gt;
&lt;br /&gt;
''A function made up of line segments - a classic 'envelope'''&lt;br /&gt;
&lt;br /&gt;
Synthesizer users are familiar with using this type of function to generate&lt;br /&gt;
envelopes such as the ‘ADSR’ curves that control the attack, decay, sustain,&lt;br /&gt;
and release of a sound's amplitude independently. That is what we're doing in&lt;br /&gt;
this example patch, although we can choose how many line segments we wish to&lt;br /&gt;
use for the envelope.&lt;br /&gt;
&lt;br /&gt;
* Click on the {{maxword|name=message}} boxes again in sequence and decipher how the&lt;br /&gt;
lists for each {{maxword|name=line~}} object affect the sound. Note that each &amp;lt;code&amp;gt;message&amp;lt;/code&amp;gt; box&lt;br /&gt;
begins with a &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; followed by a comma, this sends an individual message&lt;br /&gt;
of &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; to the {{maxword|name=line~}} object immediately followed by the subsequent list.&lt;br /&gt;
Sending a number by itelf to a {{maxword|name=line~}} object causes it to change ''immediately'' to&lt;br /&gt;
a value. An equivalent notation would be to start our envelope lists with &amp;lt;code&amp;gt;0 0&amp;lt;/code&amp;gt;&lt;br /&gt;
(go to 0 in 0 milliseconds, i.e. right now).&lt;br /&gt;
&lt;br /&gt;
===Add signals to produce a composite sound===&lt;br /&gt;
&lt;br /&gt;
Any time two or more signals are connected to the same signal inlet, those&lt;br /&gt;
signals are added together and their sum is used by the receiving object.&lt;br /&gt;
&lt;br /&gt;
[[Image:Basicchapter03d.png|border]]&lt;br /&gt;
''Multiple signals are added (mixed) in a signal inlet''&lt;br /&gt;
&lt;br /&gt;
Addition of digital signals is equivalent to unity gain mixing in analog&lt;br /&gt;
audio. It is important to note that even if all your signals have&lt;br /&gt;
amplitude less than or equal to 1, the sum of such signals can easily&lt;br /&gt;
exceed 1. In MSP it's fine to have a signal with an amplitude that&lt;br /&gt;
exceeds 1 anywhere within the signal chain, but before sending the signal&lt;br /&gt;
to {{maxword|name=dac~}} you must scale it (usually with a {{maxword|name=*~}} object) to&lt;br /&gt;
keep its amplitude less than or equal to 1. A signal with amplitude greater&lt;br /&gt;
than 1 will be distorted by {{maxword|name=dac~}}.&lt;br /&gt;
&lt;br /&gt;
In the example patch we're using three different {{maxword|name=cycle~}} objects&lt;br /&gt;
that are oscillating the waveform stored in the {{maxword|name=buffer~}} named &amp;lt;code&amp;gt;chris&amp;lt;/code&amp;gt;.&lt;br /&gt;
While up to now we're been playing them all one at a time, they could all&lt;br /&gt;
be mixed together to produce a composite instrument sound.&lt;br /&gt;
&lt;br /&gt;
* Set the volume of our tutorial patch to a maximum level of &amp;lt;code&amp;gt;0.3&amp;lt;/code&amp;gt; to&lt;br /&gt;
prevent clipping (remember we're using three different sounds, each with a&lt;br /&gt;
hypothetical maximum output of 1). Click on the {{maxword|name=button}} at the top&lt;br /&gt;
of the patcher to play all three signals simultaneously.&lt;br /&gt;
&lt;br /&gt;
Each of the three tones has a different amplitude envelope, causing&lt;br /&gt;
the timbre of the note to evolve over the course of its 1-second duration.&lt;br /&gt;
At the same time, even though all three tones are playing from the&lt;br /&gt;
same sample, they are set to different frequencies, creating a much&lt;br /&gt;
richer spectrum than exists in the original audio file being used for&lt;br /&gt;
the wavetable. As we'll see in the next tutorial, mixing wavetables of&lt;br /&gt;
different frequencies is a key technique in something called ''additive synthesis''.&lt;br /&gt;
&lt;br /&gt;
===Summary===&lt;br /&gt;
&lt;br /&gt;
The {{maxword|name=ezdac~}} object is a button for switching the audio on and&lt;br /&gt;
off. The {{maxword|name=buffer~}} object stores a sound in the computer's&lt;br /&gt;
memory. You can load an audio file into {{maxword|name=buffer~}} with&lt;br /&gt;
a &amp;lt;code&amp;gt;replace&amp;lt;/code&amp;gt; message. If a {{maxword|name=cycle~}} object has a typed-in&lt;br /&gt;
argument which gives it the same name as a {{maxword|name=buffer~}} object,&lt;br /&gt;
the {{maxword|name=cycle~}} will use the samples from that {{maxword|name=buffer~}} as its&lt;br /&gt;
waveform instead of the default cosine wave.&lt;br /&gt;
&lt;br /&gt;
Whenever you connect more than one signal to a given signal inlet,&lt;br /&gt;
the receiving object adds those signals together and uses the sum&lt;br /&gt;
as its input in that inlet. Exercise care when mixing (adding) audio&lt;br /&gt;
signals, to avoid distortion caused by sending a signal with amplitude&lt;br /&gt;
greater than 1 to the {{maxword|name=dac~}}.&lt;br /&gt;
&lt;br /&gt;
The {{maxword|name=line~}} object can receive a list in its left inlet that&lt;br /&gt;
consists of up to 64 pairs of numbers representing target values and&lt;br /&gt;
transition times. It will produce a signal that changes linearly from&lt;br /&gt;
one target value to another in the specified amounts of time. This&lt;br /&gt;
can be used to make a function of line segments describing any shape&lt;br /&gt;
desired, which is particularly useful as a control signal for amplitude&lt;br /&gt;
envelopes. You can achieve crossfades between signals by using different&lt;br /&gt;
amplitude envelopes from different {{maxword|name=line~}} objects.&lt;br /&gt;
&lt;br /&gt;
===See Also===&lt;br /&gt;
&lt;br /&gt;
{{maxword|name=buffer~}} - Store audio samples&lt;br /&gt;
&lt;br /&gt;
{{maxword|name=ezdac~}} - Audio output and on/off button&lt;br /&gt;
	&lt;br /&gt;
[[Category:Teaching Material]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>