<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Manual: Oscillator</title>
	<atom:link href="http://code.compartmental.net/tools/minim/manual-oscillator/feed/" rel="self" type="application/rss+xml" />
	<link>http://code.compartmental.net</link>
	<description></description>
	<lastBuildDate>Sun, 05 Feb 2012 07:48:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Joujou avec Substrate &#8230; Partie 2: inspiration et premiers tests. &#124; Le Press de Fabien</title>
		<link>http://code.compartmental.net/tools/minim/manual-oscillator/comment-page-1/#comment-4044</link>
		<dc:creator>Joujou avec Substrate &#8230; Partie 2: inspiration et premiers tests. &#124; Le Press de Fabien</dc:creator>
		<pubDate>Tue, 27 Dec 2011 09:10:39 +0000</pubDate>
		<guid isPermaLink="false">http://code.compartmental.net/manual-oscillator/#comment-4044</guid>
		<description>[...] la note est joué dans processing via la lib Minim. l&#8217; instrument en question est un simple oscillator en l&#8217; occurrence un [...]</description>
		<content:encoded><![CDATA[<p>[...] la note est joué dans processing via la lib Minim. l&#8217; instrument en question est un simple oscillator en l&#8217; occurrence un [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: April 7 &#8211; Harrison &#8211; Sensor in Processing &#124; Creative Computing, Spring 2011</title>
		<link>http://code.compartmental.net/tools/minim/manual-oscillator/comment-page-1/#comment-3813</link>
		<dc:creator>April 7 &#8211; Harrison &#8211; Sensor in Processing &#124; Creative Computing, Spring 2011</dc:creator>
		<pubDate>Thu, 07 Apr 2011 20:32:15 +0000</pubDate>
		<guid isPermaLink="false">http://code.compartmental.net/manual-oscillator/#comment-3813</guid>
		<description>[...] I got a lot form the Minim Oscillator example here: http://code.compartmental.net/tools/minim/manual-oscillator/ [...]</description>
		<content:encoded><![CDATA[<p>[...] I got a lot form the Minim Oscillator example here: <a href="http://code.compartmental.net/tools/minim/manual-oscillator/" rel="nofollow">http://code.compartmental.net/tools/minim/manual-oscillator/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ddf</title>
		<link>http://code.compartmental.net/tools/minim/manual-oscillator/comment-page-1/#comment-3729</link>
		<dc:creator>ddf</dc:creator>
		<pubDate>Wed, 17 Nov 2010 05:07:20 +0000</pubDate>
		<guid isPermaLink="false">http://code.compartmental.net/manual-oscillator/#comment-3729</guid>
		<description>Well, you could override the value method of Oscillator, do your work and then return super.value(). You could also check out the UGen framework in the Beta release, which already contains an ADSR class that you can use.</description>
		<content:encoded><![CDATA[<p>Well, you could override the value method of Oscillator, do your work and then return super.value(). You could also check out the UGen framework in the Beta release, which already contains an ADSR class that you can use.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Sorahan</title>
		<link>http://code.compartmental.net/tools/minim/manual-oscillator/comment-page-1/#comment-3514</link>
		<dc:creator>Brian Sorahan</dc:creator>
		<pubDate>Sun, 31 Oct 2010 17:09:27 +0000</pubDate>
		<guid isPermaLink="false">http://code.compartmental.net/manual-oscillator/#comment-3514</guid>
		<description>Tried to create a custom oscillator class with amp envelope generator thusly:

&lt;code&gt;
public class MyOscillator extends Oscillator {
  AsrEnvelope   env;
  
  public MyOscillator(float newFreq, float newAmp, float newSampleRate) {
    super( newFreq, newAmp, newSampleRate );
    env       = new AsrEnvelope(10f, 200f, 10f, 1f);
  }
  
  protected float value(float step) {
    return env.generate() * (float) Math.sin( TWO_PI * step);
  }

  public void trigger() {
    env.trigger();
  }
}

public class AsrEnvelope {
  float attack;        // Attack time in ms
  float sustain;      // Sustain time in ms
  float release;      // Release time in ms
  float start;         // Start time of envelope in ms
                       // Set every time envelope is triggered
  float len;           // Overall length of envelope in ms
  float end;           // End of envelope in ms
                       // Set every time envelope is triggered
  float amplitude;     // Amplitude used to scale the envelope values



  public AsrEnvelope(float newA, float newS, float newR, float newAmp) {
    amplitude = newAmp;
    attack    = newA;
    sustain   = newS;
    release   = newR;
    start     = 0f;
    len       = attack + sustain + release;
    end       = len;
  }

  public void trigger() {
    start = millis();
    end = start + len;
  }

  public float generate() {
    float ms    = millis();
    float b1    = start + attack;
    float b2    = b1    + sustain;
    float b3    = b2    + release;
    float value;

    if(start &lt;= ms &amp;&amp; ms &lt; b1) {
      value = map(ms, start, b1, 0f, amplitude);
    }
    else if(b1 &lt;= ms &amp;&amp; ms &lt; b2) {
      value = amplitude;
    }
    else if(b2 &lt;=ms &amp;&amp; ms &lt; b3) {
      value = map(ms, b2, b3, amplitude, 0f);
    }
    else {
      value = 0f;
    }
    return value;
  }
}
&lt;/code&gt;

But it didn&#039;t seem to work because env.generate() is not being called from within the value method of Oscillator. How to better implement an envelope generator class?

Thx
BS</description>
		<content:encoded><![CDATA[<p>Tried to create a custom oscillator class with amp envelope generator thusly:</p>
<p><code><br />
public class MyOscillator extends Oscillator {<br />
  AsrEnvelope   env;</p>
<p>  public MyOscillator(float newFreq, float newAmp, float newSampleRate) {<br />
    super( newFreq, newAmp, newSampleRate );<br />
    env       = new AsrEnvelope(10f, 200f, 10f, 1f);<br />
  }</p>
<p>  protected float value(float step) {<br />
    return env.generate() * (float) Math.sin( TWO_PI * step);<br />
  }</p>
<p>  public void trigger() {<br />
    env.trigger();<br />
  }<br />
}</p>
<p>public class AsrEnvelope {<br />
  float attack;        // Attack time in ms<br />
  float sustain;      // Sustain time in ms<br />
  float release;      // Release time in ms<br />
  float start;         // Start time of envelope in ms<br />
                       // Set every time envelope is triggered<br />
  float len;           // Overall length of envelope in ms<br />
  float end;           // End of envelope in ms<br />
                       // Set every time envelope is triggered<br />
  float amplitude;     // Amplitude used to scale the envelope values</p>
<p>  public AsrEnvelope(float newA, float newS, float newR, float newAmp) {<br />
    amplitude = newAmp;<br />
    attack    = newA;<br />
    sustain   = newS;<br />
    release   = newR;<br />
    start     = 0f;<br />
    len       = attack + sustain + release;<br />
    end       = len;<br />
  }</p>
<p>  public void trigger() {<br />
    start = millis();<br />
    end = start + len;<br />
  }</p>
<p>  public float generate() {<br />
    float ms    = millis();<br />
    float b1    = start + attack;<br />
    float b2    = b1    + sustain;<br />
    float b3    = b2    + release;<br />
    float value;</p>
<p>    if(start &lt;= ms &amp;&amp; ms &lt; b1) {<br />
      value = map(ms, start, b1, 0f, amplitude);<br />
    }<br />
    else if(b1 &lt;= ms &amp;&amp; ms &lt; b2) {<br />
      value = amplitude;<br />
    }<br />
    else if(b2 &lt;=ms &amp;&amp; ms &lt; b3) {<br />
      value = map(ms, b2, b3, amplitude, 0f);<br />
    }<br />
    else {<br />
      value = 0f;<br />
    }<br />
    return value;<br />
  }<br />
}<br />
</code></p>
<p>But it didn&#8217;t seem to work because env.generate() is not being called from within the value method of Oscillator. How to better implement an envelope generator class?</p>
<p>Thx<br />
BS</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ddf</title>
		<link>http://code.compartmental.net/tools/minim/manual-oscillator/comment-page-1/#comment-1746</link>
		<dc:creator>ddf</dc:creator>
		<pubDate>Fri, 05 Feb 2010 02:15:04 +0000</pubDate>
		<guid isPermaLink="false">http://code.compartmental.net/manual-oscillator/#comment-1746</guid>
		<description>No, current code for Oscillator steps the value being passed to the value method like so:

&lt;code&gt;
step += stepSize;
step = step - PApplet.floor(step);
&lt;/code&gt;

It may not be immediately clear that this keeps the value between 0 and 1, but the idea is that stepSize will never be so large as to send the value above 2.</description>
		<content:encoded><![CDATA[<p>No, current code for Oscillator steps the value being passed to the value method like so:</p>
<p><code><br />
step += stepSize;<br />
step = step - PApplet.floor(step);<br />
</code></p>
<p>It may not be immediately clear that this keeps the value between 0 and 1, but the idea is that stepSize will never be so large as to send the value above 2.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew</title>
		<link>http://code.compartmental.net/tools/minim/manual-oscillator/comment-page-1/#comment-1685</link>
		<dc:creator>Matthew</dc:creator>
		<pubDate>Mon, 01 Feb 2010 14:44:58 +0000</pubDate>
		<guid isPermaLink="false">http://code.compartmental.net/manual-oscillator/#comment-1685</guid>
		<description>Hello!

The value of the step parameter coming in to the value method in the SineWave example is not actually normalised between 0 and 1 as it continues to rise past 1 the longer you run the sketch for. It is therefore the number of seconds since the sketch started. (I think ... ). 

cheers

Matthew</description>
		<content:encoded><![CDATA[<p>Hello!</p>
<p>The value of the step parameter coming in to the value method in the SineWave example is not actually normalised between 0 and 1 as it continues to rise past 1 the longer you run the sketch for. It is therefore the number of seconds since the sketch started. (I think &#8230; ). </p>
<p>cheers</p>
<p>Matthew</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ddf</title>
		<link>http://code.compartmental.net/tools/minim/manual-oscillator/comment-page-1/#comment-1597</link>
		<dc:creator>ddf</dc:creator>
		<pubDate>Sat, 16 Jan 2010 17:03:24 +0000</pubDate>
		<guid isPermaLink="false">http://code.compartmental.net/manual-oscillator/#comment-1597</guid>
		<description>Yep, you are correct, that&#039;s what the current implementation is. I&#039;ve updated the page to reflect that.</description>
		<content:encoded><![CDATA[<p>Yep, you are correct, that&#8217;s what the current implementation is. I&#8217;ve updated the page to reflect that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Palmera blog &#187; Archivo del Blog &#187; Síntesis Modular con Processing</title>
		<link>http://code.compartmental.net/tools/minim/manual-oscillator/comment-page-1/#comment-1570</link>
		<dc:creator>Palmera blog &#187; Archivo del Blog &#187; Síntesis Modular con Processing</dc:creator>
		<pubDate>Mon, 11 Jan 2010 00:22:55 +0000</pubDate>
		<guid isPermaLink="false">http://code.compartmental.net/manual-oscillator/#comment-1570</guid>
		<description>[...] Minim, la clase Oscillator es la base de los generadores de sonido. Cuando se llama al método &#8220;generate&#8221;, este [...]</description>
		<content:encoded><![CDATA[<p>[...] Minim, la clase Oscillator es la base de los generadores de sonido. Cuando se llama al método &#8220;generate&#8221;, este [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith Wansbrough</title>
		<link>http://code.compartmental.net/tools/minim/manual-oscillator/comment-page-1/#comment-1508</link>
		<dc:creator>Keith Wansbrough</dc:creator>
		<pubDate>Tue, 22 Dec 2009 22:48:42 +0000</pubDate>
		<guid isPermaLink="false">http://code.compartmental.net/manual-oscillator/#comment-1508</guid>
		<description>There&#039;s a typo in the SineWave class above - the body of value() should be

  return (float)Math.sin(TWO_PI*step);

since Oscillator already takes care of the frequency().  At least with the latest version of Processing (1.0.9).</description>
		<content:encoded><![CDATA[<p>There&#8217;s a typo in the SineWave class above &#8211; the body of value() should be</p>
<p>  return (float)Math.sin(TWO_PI*step);</p>
<p>since Oscillator already takes care of the frequency().  At least with the latest version of Processing (1.0.9).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

