<?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"
	>
<channel>
	<title>Comments on: Simple 3-band EQ with Flash Player 10</title>
	<atom:link href="http://www.blixtsystems.com/2008/05/simple-3-band-eq-with-flash-player-10/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blixtsystems.com/2008/05/simple-3-band-eq-with-flash-player-10/</link>
	<description>BlixtSystems Flash Actionscript development</description>
	<pubDate>Fri, 21 Nov 2008 03:56:06 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Tweaking the samplesCallbackEvent loop &#124; blixtsystems.com</title>
		<link>http://www.blixtsystems.com/2008/05/simple-3-band-eq-with-flash-player-10/#comment-211</link>
		<dc:creator>Tweaking the samplesCallbackEvent loop &#124; blixtsystems.com</dc:creator>
		<pubDate>Fri, 30 May 2008 00:19:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.blixtsystems.com/?p=41#comment-211</guid>
		<description>[...] One would think then that the conclusion is that the best approach when processing audio if one like to avoid placing the code inside the samplesCallbackEvent loop seems to be calling the processing code once and then iterate over the size of the buffer in the class for the effect. This is exactly what I was suggested by Spender when I posted a 3-band EQ example. [...]</description>
		<content:encoded><![CDATA[<p>[...] One would think then that the conclusion is that the best approach when processing audio if one like to avoid placing the code inside the samplesCallbackEvent loop seems to be calling the processing code once and then iterate over the size of the buffer in the class for the effect. This is exactly what I was suggested by Spender when I posted a 3-band EQ example. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: {Code}Trip &#187; Astro - FileReference + Sound API</title>
		<link>http://www.blixtsystems.com/2008/05/simple-3-band-eq-with-flash-player-10/#comment-98</link>
		<dc:creator>{Code}Trip &#187; Astro - FileReference + Sound API</dc:creator>
		<pubDate>Sat, 24 May 2008 03:47:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.blixtsystems.com/?p=41#comment-98</guid>
		<description>[...] Simple 3-Band EQ with Flash Player 10, por Leo Bergman [...]</description>
		<content:encoded><![CDATA[<p>[...] Simple 3-Band EQ with Flash Player 10, por Leo Bergman [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: spender</title>
		<link>http://www.blixtsystems.com/2008/05/simple-3-band-eq-with-flash-player-10/#comment-69</link>
		<dc:creator>spender</dc:creator>
		<pubDate>Thu, 22 May 2008 21:21:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.blixtsystems.com/?p=41#comment-69</guid>
		<description>ah well. maybe the improvement was more pronounced with me because of the way I am chaining several fx together... method calls really slowed things down.</description>
		<content:encoded><![CDATA[<p>ah well. maybe the improvement was more pronounced with me because of the way I am chaining several fx together&#8230; method calls really slowed things down.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leo</title>
		<link>http://www.blixtsystems.com/2008/05/simple-3-band-eq-with-flash-player-10/#comment-68</link>
		<dc:creator>Leo</dc:creator>
		<pubDate>Thu, 22 May 2008 12:39:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.blixtsystems.com/?p=41#comment-68</guid>
		<description>Ok, I did some testing and I don't manage to improve the performance by removing the function calls inside the loop for filling the buffer.
In fact it's even marginally slower.

Basically What I did was this:
&lt;pre language="as"&gt;
while (i &lt; BUFFER_SIZE) {
	_sampleBufferL[i] = _samples.readFloat();
	_sampleBufferR[i] = _samples.readFloat();
	i  ;
}
			
_eqL.compute(_sampleBufferL);
_eqR.compute(_sampleBufferR);
			
i = 0;
while (i &lt; BUFFER_SIZE) {
	l = _sampleBufferL[i];
	r = _sampleBufferR[i];
	_out_snd.samplesCallbackData.writeFloat(l);
	_out_snd.samplesCallbackData.writeFloat(r);
	i  ;
}&lt;/pre&gt;

In the EQ class I then loop through the _sampleBuffer and write over the sample with the modified value.

I did use an extra loop to split up the values from the _samples into separate vectors for the left and right channels, but I also tested by processing the two channels as one so I did not need that loop, and still the method of calling the EQ.compute function for each iteration is still somewhat faster.

I have updated the source in the the original link to process the channels independently, which made an audible improvement, as well as having it display the average time it takes for each samplesCallbackEvent to process.

If you are interested in the modified source I used for testing the approach suggested by spender (as I understood it at least) you can &lt;a href="http://www.blixtsystems.com/dl/EQExample2.zip" rel="nofollow"&gt;grab it here&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Ok, I did some testing and I don&#8217;t manage to improve the performance by removing the function calls inside the loop for filling the buffer.<br />
In fact it&#8217;s even marginally slower.</p>
<p>Basically What I did was this:</p>
<pre language="as">
while (i < BUFFER_SIZE) {
	_sampleBufferL[i] = _samples.readFloat();
	_sampleBufferR[i] = _samples.readFloat();
	i  ;
}

_eqL.compute(_sampleBufferL);
_eqR.compute(_sampleBufferR);

i = 0;
while (i < BUFFER_SIZE) {
	l = _sampleBufferL[i];
	r = _sampleBufferR[i];
	_out_snd.samplesCallbackData.writeFloat(l);
	_out_snd.samplesCallbackData.writeFloat(r);
	i  ;
}</pre>
<p>In the EQ class I then loop through the _sampleBuffer and write over the sample with the modified value.</p>
<p>I did use an extra loop to split up the values from the _samples into separate vectors for the left and right channels, but I also tested by processing the two channels as one so I did not need that loop, and still the method of calling the EQ.compute function for each iteration is still somewhat faster.</p>
<p>I have updated the source in the the original link to process the channels independently, which made an audible improvement, as well as having it display the average time it takes for each samplesCallbackEvent to process.</p>
<p>If you are interested in the modified source I used for testing the approach suggested by spender (as I understood it at least) you can <a href="http://www.blixtsystems.com/dl/EQExample2.zip" onclick="javascript:pageTracker._trackPageview('/downloads/dl/EQExample2.zip');" rel="nofollow">grab it here</a>.</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leo</title>
		<link>http://www.blixtsystems.com/2008/05/simple-3-band-eq-with-flash-player-10/#comment-66</link>
		<dc:creator>Leo</dc:creator>
		<pubDate>Thu, 22 May 2008 10:48:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.blixtsystems.com/?p=41#comment-66</guid>
		<description>@Aran
Thanks for pointing that out. I cannot test it in IE right now since I seem to have messed up my Flash player activeX install when trying to install FP10 on top of FP9, which usually works when using KewBee PluginSwitcher, but not this time :(

@spender
Good points.
It's obvious that even with the speed of AVM2 working with audio will mean a lot of effort spent optimizing, especially if doing processing on many tracks.
And well spotted about the stereo issue.
I will make an updated version implementing your suggestions.</description>
		<content:encoded><![CDATA[<p>@Aran<br />
Thanks for pointing that out. I cannot test it in IE right now since I seem to have messed up my Flash player activeX install when trying to install FP10 on top of FP9, which usually works when using KewBee PluginSwitcher, but not this time <img src='http://www.blixtsystems.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /><br />
@spender<br />
Good points.<br />
It&#8217;s obvious that even with the speed of AVM2 working with audio will mean a lot of effort spent optimizing, especially if doing processing on many tracks.<br />
And well spotted about the stereo issue.<br />
I will make an updated version implementing your suggestions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: spender</title>
		<link>http://www.blixtsystems.com/2008/05/simple-3-band-eq-with-flash-player-10/#comment-64</link>
		<dc:creator>spender</dc:creator>
		<pubDate>Thu, 22 May 2008 09:16:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.blixtsystems.com/?p=41#comment-64</guid>
		<description>Hi,

Good work! This stuff is fun, eh?

You may want to consider doing all your calculations within a loop without external method calls. So, in Main.samplesCallback, your processing loop is calling _eq.compute on a sample by sample basis. I have found that the cost of function calls in this inner loop is very expensive. It would be better to pass _samples to the EQ instance, and operate on the entire buffer in a loop that has no external dependencies (i.e. does not call user defined methods). This will substantially reduce the number of function calls, and you'll get much better performance that way.

I'm also wondering if it is safe to pass both channels through the same filter. There is clearly some sort of feedback in the compute method, meaning that previous values passed to the compute function will affect its current output. Bearing this in mind, you are bleeding left and right channel data into one another by reusing the same filter for both the left and right channels.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Good work! This stuff is fun, eh?</p>
<p>You may want to consider doing all your calculations within a loop without external method calls. So, in Main.samplesCallback, your processing loop is calling _eq.compute on a sample by sample basis. I have found that the cost of function calls in this inner loop is very expensive. It would be better to pass _samples to the EQ instance, and operate on the entire buffer in a loop that has no external dependencies (i.e. does not call user defined methods). This will substantially reduce the number of function calls, and you&#8217;ll get much better performance that way.</p>
<p>I&#8217;m also wondering if it is safe to pass both channels through the same filter. There is clearly some sort of feedback in the compute method, meaning that previous values passed to the compute function will affect its current output. Bearing this in mind, you are bleeding left and right channel data into one another by reusing the same filter for both the left and right channels.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aran</title>
		<link>http://www.blixtsystems.com/2008/05/simple-3-band-eq-with-flash-player-10/#comment-62</link>
		<dc:creator>Aran</dc:creator>
		<pubDate>Thu, 22 May 2008 02:30:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.blixtsystems.com/?p=41#comment-62</guid>
		<description>Well, it is a very neat trick for crashing my IE7 instantly anyhow :) I get this error when I try to change a slider:

Error: Error #1023: Stack overflow occurred.

If I say dismiss all, IE7 just closes instantly!

BTW - I have Flash player - WIN 10,0,1,218 (debug) which might not be the version everyone else is using from labs...</description>
		<content:encoded><![CDATA[<p>Well, it is a very neat trick for crashing my IE7 instantly anyhow <img src='http://www.blixtsystems.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> I get this error when I try to change a slider:</p>
<p>Error: Error #1023: Stack overflow occurred.</p>
<p>If I say dismiss all, IE7 just closes instantly!</p>
<p>BTW - I have Flash player - WIN 10,0,1,218 (debug) which might not be the version everyone else is using from labs&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FlashPlayer 10 is making noise (links) at Adobe, MAKE SOME NOISE</title>
		<link>http://www.blixtsystems.com/2008/05/simple-3-band-eq-with-flash-player-10/#comment-53</link>
		<dc:creator>FlashPlayer 10 is making noise (links) at Adobe, MAKE SOME NOISE</dc:creator>
		<pubDate>Wed, 21 May 2008 13:55:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.blixtsystems.com/?p=41#comment-53</guid>
		<description>[...] Keith Peters (Bit-101) - Astro Dynamic Sound! Joa Ebert - Simple Astro Synthesizer (polyphone!) Joa Ebert - Astroboy (8Bitboy updated) Joa Ebert - Astroflanger (Sound.extract)  Simple 3-band EQ with Flash Player 10 [...]</description>
		<content:encoded><![CDATA[<p>[...] Keith Peters (Bit-101) - Astro Dynamic Sound! Joa Ebert - Simple Astro Synthesizer (polyphone!) Joa Ebert - Astroboy (8Bitboy updated) Joa Ebert - Astroflanger (Sound.extract)  Simple 3-band EQ with Flash Player 10 [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
