<?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: Animation &amp; audio synchronization</title>
	<atom:link href="http://www.hisschemoller.com/2010/animation-audio-synchronization/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hisschemoller.com/2010/animation-audio-synchronization/</link>
	<description>Flash actionscript and audio programming. And Java.</description>
	<lastBuildDate>Mon, 12 Dec 2011 14:08:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Wouter</title>
		<link>http://www.hisschemoller.com/2010/animation-audio-synchronization/comment-page-1/#comment-3023</link>
		<dc:creator>Wouter</dc:creator>
		<pubDate>Sat, 29 Jan 2011 12:22:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.hisschemoller.com/?p=488#comment-3023</guid>
		<description>Hi Tendouji, I hope you could find your answers in the source code. It&#039;s difficult to explain clearer in English than in ActionScript :-).

Anyway, about these durations:

(p)(q) is the easy one. The audio system latency, the time it takes your audio driver and soundcard to process the samples and present them as sound on the soundcard&#039;s audio output. This is just a simple calculation: You need two values: The position property of the flash.events.SampleDataEvent that is passed to your SampleData event listener and the position property of flash.media.SoundChannel object that was returned by the play() method of your flash.media.Sound object. Then it&#039;s this calculation: ((sampleDataEventInstance.position / 44.1) – soundChannelInstance.position). See Adobe&#039;s &lt;a href=&quot;http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/SampleDataEvent.html&quot; rel=&quot;nofollow&quot;&gt;SampleDataEvent reference&lt;/a&gt;.

(a)(p) is internal to your Flash application: SampleDataEvents are received at regular intervals. But if you have calculated when a sound has to start playback it would be a coincidence that that starttime would be the exact moment, on the millisecond, that a sampledata event is received. More likely the sound should start somewhere in between. The duration (a)(p) is that time difference. So if the sound you want to play should start somewhere between the current and the next sampledata event then the first sample of the sound should not be on position zero of the buffer but on position (a)(p).

Hope this helps, Maybe a clearer answer can be found elsewhere.</description>
		<content:encoded><![CDATA[<p>Hi Tendouji, I hope you could find your answers in the source code. It&#8217;s difficult to explain clearer in English than in ActionScript :-).</p>
<p>Anyway, about these durations:</p>
<p>(p)(q) is the easy one. The audio system latency, the time it takes your audio driver and soundcard to process the samples and present them as sound on the soundcard&#8217;s audio output. This is just a simple calculation: You need two values: The position property of the flash.events.SampleDataEvent that is passed to your SampleData event listener and the position property of flash.media.SoundChannel object that was returned by the play() method of your flash.media.Sound object. Then it&#8217;s this calculation: ((sampleDataEventInstance.position / 44.1) – soundChannelInstance.position). See Adobe&#8217;s <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/SampleDataEvent.html" rel="nofollow">SampleDataEvent reference</a>.</p>
<p>(a)(p) is internal to your Flash application: SampleDataEvents are received at regular intervals. But if you have calculated when a sound has to start playback it would be a coincidence that that starttime would be the exact moment, on the millisecond, that a sampledata event is received. More likely the sound should start somewhere in between. The duration (a)(p) is that time difference. So if the sound you want to play should start somewhere between the current and the next sampledata event then the first sample of the sound should not be on position zero of the buffer but on position (a)(p).</p>
<p>Hope this helps, Maybe a clearer answer can be found elsewhere.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wouter</title>
		<link>http://www.hisschemoller.com/2010/animation-audio-synchronization/comment-page-1/#comment-3015</link>
		<dc:creator>Wouter</dc:creator>
		<pubDate>Thu, 27 Jan 2011 21:09:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.hisschemoller.com/?p=488#comment-3015</guid>
		<description>Thanks. The programming is the difficult part for me too, but fun at the same time. Depending what your goal is it might be worthwhile to have a look at Processing (www.processing.org). I think it&#039;s easier than Actionscript.</description>
		<content:encoded><![CDATA[<p>Thanks. The programming is the difficult part for me too, but fun at the same time. Depending what your goal is it might be worthwhile to have a look at Processing (www.processing.org). I think it&#8217;s easier than Actionscript.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tendouji</title>
		<link>http://www.hisschemoller.com/2010/animation-audio-synchronization/comment-page-1/#comment-2142</link>
		<dc:creator>Tendouji</dc:creator>
		<pubDate>Mon, 02 Aug 2010 08:40:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.hisschemoller.com/?p=488#comment-2142</guid>
		<description>Hi,

I am working on the sample no. 1, animation follows audio. But can you explain further on the technical code on how to write this? I am a bit lost in getting the duration (a)(p) plus duration (p)(q).

:/</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I am working on the sample no. 1, animation follows audio. But can you explain further on the technical code on how to write this? I am a bit lost in getting the duration (a)(p) plus duration (p)(q).</p>
<p>:/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Free sound effects</title>
		<link>http://www.hisschemoller.com/2010/animation-audio-synchronization/comment-page-1/#comment-2104</link>
		<dc:creator>Free sound effects</dc:creator>
		<pubDate>Thu, 22 Jul 2010 08:48:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.hisschemoller.com/?p=488#comment-2104</guid>
		<description>Great post. I can think of a lot of reasons to synch audio and visual on a web site.
The programming would be the difficult part for me, I come from the music and sound area but maybe it is worth the dive..
Thank you.</description>
		<content:encoded><![CDATA[<p>Great post. I can think of a lot of reasons to synch audio and visual on a web site.<br />
The programming would be the difficult part for me, I come from the music and sound area but maybe it is worth the dive..<br />
Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alistair</title>
		<link>http://www.hisschemoller.com/2010/animation-audio-synchronization/comment-page-1/#comment-1611</link>
		<dc:creator>Alistair</dc:creator>
		<pubDate>Mon, 05 Apr 2010 03:01:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.hisschemoller.com/?p=488#comment-1611</guid>
		<description>Hi Wouter,
I just discovered your blog. You&#039;ve written some excellent articles and examples and got me excited about programming audio in Flash again :) I&#039;m just about to start an audio project where I need the animation to follow the sound and it&#039;s reassuring to find that you have similar solutions to the ones I was thinking of. Thanks, and keep up the good work.</description>
		<content:encoded><![CDATA[<p>Hi Wouter,<br />
I just discovered your blog. You&#8217;ve written some excellent articles and examples and got me excited about programming audio in Flash again :) I&#8217;m just about to start an audio project where I need the animation to follow the sound and it&#8217;s reassuring to find that you have similar solutions to the ones I was thinking of. Thanks, and keep up the good work.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

