<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   <title>Appendix&nbsp;G.&nbsp;Speex Codec</title><link rel="stylesheet" type="text/css" href="html.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Red5 - Reference Documentation"><link rel="up" href="index.html" title="Red5 - Reference Documentation"><link rel="prev" href="h264.html" title="Appendix&nbsp;F.&nbsp;H264"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div xmlns="http://www.w3.org/TR/xhtml1/transitional" style="background-color:white;border:none;height:73px;border:1px solid black;"><a style="border:none;" href="http://osflash.org/red5" title="Red5 Open Source Flash Server"><img style="border:none;" src="images/red5-banner.png"></img></a><a style="border:none;" href="http://osflash.org/red5" title="Red5 Open Source Flash Server"><img style="border:none;position:absolute;padding-top:5px;right:42px;" src="images/red5-banner-logo.png"></img></a></div><div class="appendix"><div class="titlepage"><div><div><h1 class="title"><a name="speex"></a>Appendix&nbsp;G.&nbsp;Speex Codec</h1></div></div></div>
	
	<p>
		<a class="ulink" href="http://www.speex.org/" target="_top">Speex</a> is a new voice codec supported in Flash Player 10 and above. With the new release of flash player 10 this document explains a little about the new codec with this release. 
	</p>
	<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d5e3082"></a>G.1.&nbsp;Setting Up Flex SDk / Flex Builder</h2></div></div></div>
		
		<p>Flex SDK / Flex Builder needs to be setup to target flash player 10 playerglobal.swc which has the new features enabled.</p>
		<p>Taken from the Adobe Open Source area 
			<a class="ulink" href="http://opensource.adobe.com/wiki/display/flexsdk/Targeting+Flash+Player+10+Beta" target="_top">http://opensource.adobe.com/wiki/display/flexsdk/Targeting+Flash+Player+10+Beta</a>
		</p>
		<div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="d5e3087"></a>G.1.1.&nbsp;Get Flex 3 SDK</h3></div></div></div>
			
			<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
					<p>Download Flex SDK 3.0.3 or above. In Flex 3 extract into the sdks directory. </p>
				</li><li class="listitem">
					<p>Make sure that you have a Flash 10 playerglobal.swc at FLEX_SDK/frameworks/libs/player/10/playerglobal.swc.</p>
				</li></ul></div>
		</div>
		<div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="d5e3094"></a>G.1.2.&nbsp;Config Flex Config To Target Flash Player 10</h3></div></div></div>
			
			<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
					<p>Modify FLEX_SDK/frameworks/flex-config.xml. Edit &lt;target-player&gt;, replacing 9.0.115 with 10.0.0:</p>
				</li></ul></div>
			<div class="blockquote"><blockquote class="blockquote">
				<p> {{{
					   &lt;target-player&gt;10.0.0&lt;/target-player&gt;
					 }}}</p>
			</blockquote></div>
			<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
					<p>In &lt;external-library-path&gt;, edit the path-element for playerglobal.swc, replacing 9 with 10:</p>
				</li></ul></div>
			<div class="blockquote"><blockquote class="blockquote">
				<p> {{{
					   &lt;external-library-path&gt;
					     &lt;path-element&gt;libs/player/10/playerglobal.swc&lt;/path-element&gt; 
					   &lt;/external-library-path&gt;
					 }}}</p>
			</blockquote></div>
			<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
					<p>Do the same with &lt;library-path:</p>
				</li></ul></div>
			<div class="blockquote"><blockquote class="blockquote">
				<p> {{{
					   &lt;library-path&gt;
					   &lt;path-element&gt;libs&lt;/path-element&gt;
					   &lt;path-element&gt;libs/player/10&lt;/path-element&gt;
					   &lt;path-element&gt;locale/{locale}&lt;/path-element&gt;
					   &lt;/library-path&gt;
					 }}}</p>
			</blockquote></div>
			<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
					<p>In flex builder, right click the project and choose properties, choose Flex Compiler, choose the "Configure Flex SDKs" link on the right, choose add then choose the location of the newly downloaded SDK and give it a name. </p>
				</li><li class="listitem">
					<p>Back in the Flex Compiler config choose "Use a specific SDK and select in the list the Flex SDK configured previously. </p>
				</li></ul></div>
		</div>
	</div>
	<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d5e3116"></a>G.2.&nbsp;Code Example</h2></div></div></div>
		
		<p>Setup the Microphone class to use the new Speex Codec.</p>
		<div class="literallayout"><p><br>
_microphone&nbsp;=&nbsp;Microphone.getMicrophone();<br>
if&nbsp;(_microphone)&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;//_microphone.setLoopBack(true);<br>
&nbsp;&nbsp;&nbsp;&nbsp;_microphone.codec&nbsp;=&nbsp;SoundCodec.SPEEX;<br>
&nbsp;&nbsp;&nbsp;&nbsp;_microphone.encodeQuality&nbsp;=&nbsp;10;<br>
&nbsp;&nbsp;&nbsp;&nbsp;_microphone.rate&nbsp;=&nbsp;44;<br>
&nbsp;&nbsp;&nbsp;&nbsp;_microphone.framesPerPacket&nbsp;=&nbsp;2;<br>
&nbsp;&nbsp;&nbsp;&nbsp;_microphone.gain&nbsp;=&nbsp;50;<br>
&nbsp;&nbsp;&nbsp;&nbsp;_microphone.setUseEchoSuppression(true);<br>
&nbsp;&nbsp;&nbsp;&nbsp;ns.attachAudio(_microphone);<br>
}&nbsp;else&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;Error("Audio&nbsp;Not&nbsp;Connected");<br>
}<br>
</p></div>
	</div>
	<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d5e3120"></a>G.3.&nbsp;FFMpeg and Speex</h2></div></div></div>
		
		<p>According to Art Clarke subversion revision 
			<a class="ulink" href="http://svn.mplayerhq.hu/ffmpeg/trunk/?pathrev=15028" target="_top">r15028</a> of the FFMpeg source code has the capabilities of decoding the Speex codec from FLV files. 
		</p>
	</div>
	<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="SpeexCodecLinks"></a>G.4.&nbsp;Links</h2></div></div></div>
		
		<p>* 
			<a class="ulink" href="http://www.speex.org/" target="_top">http://www.speex.org/</a>
		</p>
		<p>* 
			<a class="ulink" href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/media/SoundCodec.html" target="_top">http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/media/SoundCodec.html</a>
		</p>
		<p>* 
			<a class="ulink" href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/media/Microphone.html" target="_top">http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/media/Microphone.html</a>
		</p>
	</div>
</div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navfooter"><hr></hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="h264.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right">&nbsp;</td></tr><tr><td width="40%" align="left" valign="top">Appendix&nbsp;F.&nbsp;H264&nbsp;</td><td width="20%" align="center"><span style="color:white;font-size:90%;"><a href="http://osflash.org/red5" title="Red5">Red5 Open Source Flash Server</a></span></td><td width="40%" align="right" valign="top">&nbsp;</td></tr></table></div></body></html>