<?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_Dynamics_Tutorial_1:_Envelope_Following&amp;feed=atom&amp;action=history</id>
		<title>MSP Dynamics Tutorial 1: Envelope Following - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://cycling74.com/wiki/index.php?title=MSP_Dynamics_Tutorial_1:_Envelope_Following&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://cycling74.com/wiki/index.php?title=MSP_Dynamics_Tutorial_1:_Envelope_Following&amp;action=history"/>
		<updated>2013-05-23T08:21:33Z</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_Dynamics_Tutorial_1:_Envelope_Following&amp;diff=821&amp;oldid=prev</id>
		<title>Gtaylor@rtqe.net at 15:29, 28 June 2012</title>
		<link rel="alternate" type="text/html" href="http://cycling74.com/wiki/index.php?title=MSP_Dynamics_Tutorial_1:_Envelope_Following&amp;diff=821&amp;oldid=prev"/>
				<updated>2012-06-28T15:29:39Z</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:29, 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;Click here to open the tutorial patch: [[01nEnvelopeFollowing.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;01nEnvelopeFollowing.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_Dynamics_Tutorial_1:_Envelope_Following&amp;diff=768&amp;oldid=prev</id>
		<title>Admin at 21:10, 25 June 2012</title>
		<link rel="alternate" type="text/html" href="http://cycling74.com/wiki/index.php?title=MSP_Dynamics_Tutorial_1:_Envelope_Following&amp;diff=768&amp;oldid=prev"/>
				<updated>2012-06-25T21:10:54Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;http://cycling74.com/wiki/index.php?title=MSP_Dynamics_Tutorial_1:_Envelope_Following&amp;amp;diff=768&amp;amp;oldid=717&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://cycling74.com/wiki/index.php?title=MSP_Dynamics_Tutorial_1:_Envelope_Following&amp;diff=717&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;Click here to open the tutorial patch: 01nEnvelopeFollowing.maxpat  ===Introduction===  In this group of tutorials, we'll look at different ways to work with ''dynamics'' ...&quot;</title>
		<link rel="alternate" type="text/html" href="http://cycling74.com/wiki/index.php?title=MSP_Dynamics_Tutorial_1:_Envelope_Following&amp;diff=717&amp;oldid=prev"/>
				<updated>2012-06-22T21:10:19Z</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=01nEnvelopeFollowing.maxpat&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;01nEnvelopeFollowing.maxpat (page does not exist)&quot;&gt;01nEnvelopeFollowing.maxpat&lt;/a&gt;  ===Introduction===  In this group of tutorials, we&amp;#039;ll look at different ways to work with &amp;#039;&amp;#039;dynamics&amp;#039;&amp;#039; ...&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: [[01nEnvelopeFollowing.maxpat]]&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
In this group of tutorials, we'll look at different ways to work&lt;br /&gt;
with ''dynamics'' in audio signals. The ability to use and control&lt;br /&gt;
the ''amplitude'' of an audio waveform is important for many applications,&lt;br /&gt;
from the macro level (audio compression) to the micro level (distortion).&lt;br /&gt;
In this first tutorial, we'll learn to derive control values from amplitude&lt;br /&gt;
parameters of an audio signal which we can use to control parameters&lt;br /&gt;
elsewhere in the signal chain. This technique is called ''envelope following''.&lt;br /&gt;
&lt;br /&gt;
===The envelope, please...===&lt;br /&gt;
&lt;br /&gt;
We've learned from working with MSP that digital audio is represented as&lt;br /&gt;
a stream of discrete samples, each of which represent the ''amplitude'' of&lt;br /&gt;
a signal at a given time. However, when we actually think about (and use)&lt;br /&gt;
the term amplitude, we aren't necessarily thinking of it on a sample-by-sample&lt;br /&gt;
basis. Instead, we discuss the amplitude of a sound based on how ''loud'' it&lt;br /&gt;
seems to us as listeners. Alternately, we create objective measurement systems&lt;br /&gt;
to attempt to quantify this (subjective) loudness, such as level meters in&lt;br /&gt;
audio mixing software. Both of these systems look at the amplitude of an&lt;br /&gt;
audio signal not on a sample-by-sample level, but ''averaged'' over time.&lt;br /&gt;
This technique of deriving the macro-amplitude of a sound's loudness or&lt;br /&gt;
volume (as opposed to the micro-amplitude of the sample values) is&lt;br /&gt;
called ''envelope following''.&lt;br /&gt;
&lt;br /&gt;
We use the term envelope in synthesizer design to refer to the overall dynamic&lt;br /&gt;
shape of the sound. For example, a sound that fades in smoothly and then fades&lt;br /&gt;
out over the same amount of time could be said to have a triangular envelope.&lt;br /&gt;
A sound with a short attack, a long sustain, and a short fade might look like&lt;br /&gt;
a trapezoid. Similarly, we can take any sound source and, with a little bit&lt;br /&gt;
of work, abstract its envelope:&lt;br /&gt;
&lt;br /&gt;
[[Image:Dynamicschapter01a.png|border]]&lt;br /&gt;
''&amp;quot;Is that you?&amp;quot;: waveform (top) and envelope (bottom)''&lt;br /&gt;
&lt;br /&gt;
To create the envelope above, we looked at the samples within the waveform and&lt;br /&gt;
tracked their ''average'' amplitude over time. There are several strategies&lt;br /&gt;
to do this in MSP, involving a trio of objects that allow us to smooth audio&lt;br /&gt;
signals based on different parameters.&lt;br /&gt;
&lt;br /&gt;
* In the tutorial patcher, familiarize yourself with the area labeled &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;.&lt;br /&gt;
This is a basic sample playback patcher that loads an audio file into a {{maxword|name=buffer~}} object&lt;br /&gt;
and plays it in an endless loop using the {{maxword|name=groove~}} object. Start the audio, turn&lt;br /&gt;
up the {{maxword|name=gain~}} slider, and make sure you can hear the drum loop as it plays.&lt;br /&gt;
&lt;br /&gt;
===Envelope following in MSP===&lt;br /&gt;
&lt;br /&gt;
* Look at the two objects in yellow attached to the output of the {{maxword|name=groove~}} object.&lt;br /&gt;
&lt;br /&gt;
The first thing that needs to be accomplished when deriving the smoothed amplitude&lt;br /&gt;
of a sound is to convert the signal into a ''rectified'' wave; that is, to&lt;br /&gt;
ignore the difference between negative and positive sample values and only&lt;br /&gt;
concentrate on their distance from &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;. We can do this by taking the absolute&lt;br /&gt;
value of a signal, which can be accomplished using the {{maxword|name=abs~}} object in MSP.&lt;br /&gt;
&lt;br /&gt;
The {{maxword|name=snapshot~}} object allows us to convert one sample of an MSP signal&lt;br /&gt;
into a floating-point number output from the object as a Max event. Every time&lt;br /&gt;
the object receives a &amp;lt;code&amp;gt;bang&amp;lt;/code&amp;gt;, it takes the current audio sample and outputs&lt;br /&gt;
it into Max as a number which can be viewed, scaled, or used to trigger Max events.&lt;br /&gt;
In the case of our patcher, the absolute value of our {{maxword|name=groove~}} object's&lt;br /&gt;
output is being used to drive the height of a {{maxword|name=multislider}} object, with&lt;br /&gt;
the {{maxword|name=snapshot~}} providing the intermediary translation from an MSP signal&lt;br /&gt;
t. a Max message. As we can see, the bouncing up and down of the {{maxword|name=multislider}}&lt;br /&gt;
gives us a vague impression of the amplitude of the drum loop. However, a more&lt;br /&gt;
accurate impression of how we ''hear'' the sound can be accomplished by smoothing&lt;br /&gt;
those values.&lt;br /&gt;
&lt;br /&gt;
* Look at the patcher logic labeled &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; in our tutorial. In the {{maxword|name=number}} box&lt;br /&gt;
labeled 'Up' type the value &amp;lt;code&amp;gt;1.&amp;lt;/code&amp;gt; and hit return. In the {{maxword|name=number}} box&lt;br /&gt;
labeled 'Down' type the value &amp;lt;code&amp;gt;100.&amp;lt;/code&amp;gt; and hit return. Observe the results as&lt;br /&gt;
plotted in the {{maxword|name=multislider}} objects below. Now do the reverse (type &amp;lt;code&amp;gt;1.&amp;lt;/code&amp;gt; as&lt;br /&gt;
the 'Down' value and &amp;lt;code&amp;gt;100.&amp;lt;/code&amp;gt; as the 'Up' value). Notice the difference?&lt;br /&gt;
&lt;br /&gt;
The output of the {{maxword|name=send~}} object (which consists of our drum loop) is&lt;br /&gt;
converted to an absolute value, run through an object called {{maxword|name=rampsmooth~}},&lt;br /&gt;
and plotted in a {{maxword|name=number}} box and two {{maxword|name=multislider}} objects. The&lt;br /&gt;
right-hand {{maxword|name=multislider}} is in one of its scrolling modes, which allows&lt;br /&gt;
us to see values as they unfold over time. The {{maxword|name=rampsmooth~}} object&lt;br /&gt;
performs a linear smoothing operation on an input signal. Its two arguments&lt;br /&gt;
(or numbers given at its middle and right inlets) control the way in which the&lt;br /&gt;
smoothing behaves. The middle inlet controls over how many samples the object&lt;br /&gt;
will smooth a changing value when it is ''rising''; the right inlet controls&lt;br /&gt;
how many samples it takes for a signal to ''fall''. These two values allow&lt;br /&gt;
us to independently smooth increasing and decreasing sample values, so that&lt;br /&gt;
sharp onsets can be kept in the envelope but abrupt silences generate a tail.&lt;br /&gt;
&lt;br /&gt;
* Look at the area of the tutorial labeled &amp;lt;code&amp;gt;3&amp;lt;/code&amp;gt;. As before, enter &amp;lt;code&amp;gt;1.&amp;lt;/code&amp;gt;&lt;br /&gt;
in the {{maxword|name=number}} box labeled 'Up' and &amp;lt;code&amp;gt;100.&amp;lt;/code&amp;gt; in the {{maxword|name=number}} box&lt;br /&gt;
labeled 'Down'. Observe the envelope drawn in the {{maxword|name=multislider}}. Now do&lt;br /&gt;
the reverse (type &amp;lt;code&amp;gt;1.&amp;lt;/code&amp;gt; as the 'Down' value and &amp;lt;code&amp;gt;100.&amp;lt;/code&amp;gt; as the 'Up' value).&lt;br /&gt;
Type &amp;lt;code&amp;gt;100.&amp;lt;/code&amp;gt; for both values.&lt;br /&gt;
&lt;br /&gt;
The {{maxword|name=slide~}} object smooths audio signals through logarithmically&lt;br /&gt;
smoothing the input signal. The two values provide it work as denominators&lt;br /&gt;
for new rising or falling energy entering the (smoothed) signal. For example,&lt;br /&gt;
an 'Up' value of &amp;lt;code&amp;gt;1000&amp;lt;/code&amp;gt; means it will take 1000 samples for a&lt;br /&gt;
single-sample transition from &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; to occur. The larger&lt;br /&gt;
the 'Up' and 'Down' values, the smoother the curve.&lt;br /&gt;
&lt;br /&gt;
* Look at patcher area &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt;. In the {{maxword|name=number}} box labeled 'Delta',&lt;br /&gt;
type &amp;lt;code&amp;gt;0.01&amp;lt;/code&amp;gt; and hit return. Observe the results. Type an even smaller&lt;br /&gt;
number, such as &amp;lt;code&amp;gt;0.0001&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The {{maxword|name=deltaclip~}} object works in a different manner from {{maxword|name=rampsmooth~}}&lt;br /&gt;
and {{maxword|name=slide~}}. It sets a threshold for the amount an audio signal can change,&lt;br /&gt;
and clips the outgoing signal to that amount. Setting the &amp;lt;code&amp;gt;min&amp;lt;/code&amp;gt;&lt;br /&gt;
and &amp;lt;code&amp;gt;max&amp;lt;/code&amp;gt; values for the delta to &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will allow&lt;br /&gt;
samples to pass normally provided they don't change by more than that amount.&lt;br /&gt;
Smaller values will smooth the audio signal in a ''relative'' way so that&lt;br /&gt;
the resulting envelope traces a much narrower set of values than the incoming signal.&lt;br /&gt;
&lt;br /&gt;
If we put a burst of noise through the different envelope following&lt;br /&gt;
techniques shown in our tutorial patcher, we can see the difference&lt;br /&gt;
between the curves they generate:&lt;br /&gt;
&lt;br /&gt;
[[Image:Dynamicschapter01b.png|border]]&lt;br /&gt;
''Different envelope followers on a noise burst.''&lt;br /&gt;
&lt;br /&gt;
Each of these envelope-following techniques have different musical and&lt;br /&gt;
sonic applications and have different signatures. A logarithmic envelope&lt;br /&gt;
follower controlling the volume of a synthesizer, for example, would&lt;br /&gt;
have a very different ''sound'' than a linear one.&lt;br /&gt;
&lt;br /&gt;
===Using envelopes as control signals===&lt;br /&gt;
&lt;br /&gt;
* Look at the patcher logic labeled &amp;lt;code&amp;gt;5&amp;lt;/code&amp;gt; in the tutorial. Turn up&lt;br /&gt;
the {{maxword|name=gain~}} slider to hear the output of the {{maxword|name=cycle~}} object.&lt;br /&gt;
Using the {{maxword|name=umenu}}, select the different envelope followers as a control&lt;br /&gt;
input. If you like, change their parameters as well to see what types of&lt;br /&gt;
different effects you can achieve.&lt;br /&gt;
&lt;br /&gt;
The three envelope following patcher areas send their output signals&lt;br /&gt;
through {{maxword|name=send~}} objects to any {{maxword|name=receive~}} set to the appropriate&lt;br /&gt;
name. In the case of patcher logic &amp;lt;code&amp;gt;5&amp;lt;/code&amp;gt;, this signal (ranging&lt;br /&gt;
from &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; controls the frequency of a {{maxword|name=cycle~}} object,&lt;br /&gt;
mapping the control signal to between &amp;lt;code&amp;gt;100&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;1100&amp;lt;/code&amp;gt; Hz. The&lt;br /&gt;
difference between the three envelope type should be apparent if they are&lt;br /&gt;
set to fairly strong smoothing values.&lt;br /&gt;
&lt;br /&gt;
* Turn down the {{maxword|name=gain~}} slider in patcher area &amp;lt;code&amp;gt;5&amp;lt;/code&amp;gt; and look at&lt;br /&gt;
the patcher logic labeled &amp;lt;code&amp;gt;6&amp;lt;/code&amp;gt;. Turn up the {{maxword|name=gain~}} slider and&lt;br /&gt;
select different sources for a control signal from the {{maxword|name=umenu}}.&lt;br /&gt;
&lt;br /&gt;
In this example, we use our envelope control signal to modulate the cutoff&lt;br /&gt;
frequency of a {{maxword|name=lores~}} filter, creating a dynamic wah-wah effect on a&lt;br /&gt;
mixed and detuned waveform.&lt;br /&gt;
&lt;br /&gt;
* Turn down patcher area &amp;lt;code&amp;gt;6&amp;lt;/code&amp;gt; and look at the patcher logic labeled &amp;lt;code&amp;gt;7&amp;lt;/code&amp;gt;.&lt;br /&gt;
Turn up the {{maxword|name=gain~}} slider and select different envelopes from&lt;br /&gt;
the {{maxword|name=umenu}}.&lt;br /&gt;
&lt;br /&gt;
In this example, we are using our envelope to create an 'auto-wah' on the&lt;br /&gt;
drum loop itself. This is a very common use of envelope following in music&lt;br /&gt;
production, where a control signal derived from an audio signal is used to&lt;br /&gt;
control a parameter of an effect applied to that same audio clip further&lt;br /&gt;
down the chain. Using this logic, we could use our envelope follower to&lt;br /&gt;
apply control signals to any signal-processing procedure we want in MSP.&lt;br /&gt;
&lt;br /&gt;
===Summary===&lt;br /&gt;
&lt;br /&gt;
When talking about the ''amplitude'' of an audio signal, we distinguish&lt;br /&gt;
between the sample-by-sample amplitude and the overall loudness of a sound.&lt;br /&gt;
This second shape is called the ''envelope'' of a sound, and the signal&lt;br /&gt;
processing involved in deriving it is called ''envelope following''.&lt;br /&gt;
Envelopes of audio signals can be created by looking at the absolute (rectified)&lt;br /&gt;
waveform (created with the {{maxword|name=abs~}}) object and smoothing it using MSP objects&lt;br /&gt;
such as {{maxword|name=rampsmooth~}}, {{maxword|name=slide~}}, or {{maxword|name=deltaclip~}}. These smoothed&lt;br /&gt;
control signals can then be scaled and use to control parameters on an synthesis&lt;br /&gt;
or signal processing operation you like. The MSP {{maxword|name=snapshot~}} object is useful&lt;br /&gt;
for converting MSP audio signals into floating-point Max numbers which can be&lt;br /&gt;
viewed using objects such as {{maxword|name=multislider}}.&lt;br /&gt;
&lt;br /&gt;
===See Also===&lt;br /&gt;
&lt;br /&gt;
{{maxword|name=abs~}} - Absolute value of a signal&lt;br /&gt;
&lt;br /&gt;
{{maxword|name=snapshot~}} - Convert signal values to numbers&lt;br /&gt;
&lt;br /&gt;
{{maxword|name=rampsmooth~}} - Smooth an incoming signal&lt;br /&gt;
&lt;br /&gt;
{{maxword|name=slide~}} - Filter a signal logarithmically&lt;br /&gt;
&lt;br /&gt;
{{maxword|name=deltaclip~}} - Limit changes in signal amplitude&lt;br /&gt;
&lt;br /&gt;
[[Category:Teaching Material]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>