<?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: Frequency Modulation Is Easy</title>
	<atom:link href="http://code.compartmental.net/2008/12/23/frequency-modulation-is-easy/feed/" rel="self" type="application/rss+xml" />
	<link>http://code.compartmental.net/2008/12/23/frequency-modulation-is-easy/</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: wray</title>
		<link>http://code.compartmental.net/2008/12/23/frequency-modulation-is-easy/comment-page-1/#comment-763</link>
		<dc:creator>wray</dc:creator>
		<pubDate>Mon, 20 Apr 2009 18:18:20 +0000</pubDate>
		<guid isPermaLink="false">http://code.compartmental.net/?p=141#comment-763</guid>
		<description>I was curious if this is the sort of thing that needs to be implemented so that I can play a sound slower than it is meant to be played -- like a record player. I&#039;ll see if I can figure it out......</description>
		<content:encoded><![CDATA[<p>I was curious if this is the sort of thing that needs to be implemented so that I can play a sound slower than it is meant to be played &#8212; like a record player. I&#8217;ll see if I can figure it out&#8230;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pietro</title>
		<link>http://code.compartmental.net/2008/12/23/frequency-modulation-is-easy/comment-page-1/#comment-753</link>
		<dc:creator>pietro</dc:creator>
		<pubDate>Tue, 24 Mar 2009 20:55:38 +0000</pubDate>
		<guid isPermaLink="false">http://code.compartmental.net/?p=141#comment-753</guid>
		<description>yes, it would be nice to have the possibility to do FM in minim.
I&#039;m teaching electronic music and I would love to use processing and minim in a more extensive way, but it is not always possible.
I got stuck in a main problem: I can &quot;get&quot; the samples of any audio buffer into an array, but I don&#039;t know how to &quot;write&quot; a processed array into a buffer in an easy way.
This does neither allow a straightforward  implementation of FM or AM algorithms nor a basic thing such as the modulation of the amplitude of a signal by an amplitude envelope.

...really hope that I will be able to use more processing and minim for my electronic music course! It&#039;s a great environment.

here it is an implementation of the AM algorithm (actually a simple ring modulator) done as an AudioEffect:

class Amplitude_Modulation implements AudioEffect
{  // the mono version doesn&#039;t do anything
  void process(float[] samp)
  {
    float[] AM = new float[samp.length];
    
    for (int j = 0; j &lt; samp.length; j++)  AM[j] = samp[j];
    
    // we have to copy the values back into samp for this to work
    arraycopy(AM, samp);
  }
 
  void process(float[] samp1, float[] samp2)
  {
    float[] AM = new float[samp1.length];
 
    for (int j = 0; j &lt; samp1.length; j++)  AM[j] = samp1[j]*samp2[j];
    // we have to copy the values back into samp for this to work
    arraycopy(AM, samp1);
    arraycopy(AM, samp2);
  }
}

///////////////////////////////////////////////////////////////////////////////
 
import ddf.minim.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
 
Minim minim;

AudioOutput out1;


SineWave sine1;
SineWave sine2;

Amplitude_Modulation AM; 
 
void setup()
{
  size(512, 200, P3D);
 
  minim = new Minim(this);
  // try changing the buffer size to see how it changes the effect
  out1 = minim.getLineOut();

  AM = new Amplitude_Modulation();
  
  sine1 = new SineWave(400, 0.4, out1.sampleRate()); 
  sine1.setPan(1);
  sine2 = new SineWave(50, 0.4, out1.sampleRate());
  sine2.setPan(-1);

  out1.addSignal(sine1);
  out1.addSignal(sine2);
  out1.addEffect(AM);

}</description>
		<content:encoded><![CDATA[<p>yes, it would be nice to have the possibility to do FM in minim.<br />
I&#8217;m teaching electronic music and I would love to use processing and minim in a more extensive way, but it is not always possible.<br />
I got stuck in a main problem: I can &#8220;get&#8221; the samples of any audio buffer into an array, but I don&#8217;t know how to &#8220;write&#8221; a processed array into a buffer in an easy way.<br />
This does neither allow a straightforward  implementation of FM or AM algorithms nor a basic thing such as the modulation of the amplitude of a signal by an amplitude envelope.</p>
<p>&#8230;really hope that I will be able to use more processing and minim for my electronic music course! It&#8217;s a great environment.</p>
<p>here it is an implementation of the AM algorithm (actually a simple ring modulator) done as an AudioEffect:</p>
<p>class Amplitude_Modulation implements AudioEffect<br />
{  // the mono version doesn&#8217;t do anything<br />
  void process(float[] samp)<br />
  {<br />
    float[] AM = new float[samp.length];</p>
<p>    for (int j = 0; j &lt; samp.length; j++)  AM[j] = samp[j];</p>
<p>    // we have to copy the values back into samp for this to work<br />
    arraycopy(AM, samp);<br />
  }</p>
<p>  void process(float[] samp1, float[] samp2)<br />
  {<br />
    float[] AM = new float[samp1.length];</p>
<p>    for (int j = 0; j &lt; samp1.length; j++)  AM[j] = samp1[j]*samp2[j];<br />
    // we have to copy the values back into samp for this to work<br />
    arraycopy(AM, samp1);<br />
    arraycopy(AM, samp2);<br />
  }<br />
}</p>
<p>///////////////////////////////////////////////////////////////////////////////</p>
<p>import ddf.minim.*;<br />
import ddf.minim.effects.*;<br />
import ddf.minim.signals.*;</p>
<p>Minim minim;</p>
<p>AudioOutput out1;</p>
<p>SineWave sine1;<br />
SineWave sine2;</p>
<p>Amplitude_Modulation AM; </p>
<p>void setup()<br />
{<br />
  size(512, 200, P3D);</p>
<p>  minim = new Minim(this);<br />
  // try changing the buffer size to see how it changes the effect<br />
  out1 = minim.getLineOut();</p>
<p>  AM = new Amplitude_Modulation();</p>
<p>  sine1 = new SineWave(400, 0.4, out1.sampleRate());<br />
  sine1.setPan(1);<br />
  sine2 = new SineWave(50, 0.4, out1.sampleRate());<br />
  sine2.setPan(-1);</p>
<p>  out1.addSignal(sine1);<br />
  out1.addSignal(sine2);<br />
  out1.addEffect(AM);</p>
<p>}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

