<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>BlackBerry Developer Blog &#187; audio</title>
	<atom:link href="http://devblog.blackberry.com/tag/audio/feed/" rel="self" type="application/rss+xml" />
	<link>http://devblog.blackberry.com</link>
	<description></description>
	<lastBuildDate>Fri, 17 May 2013 17:47:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='devblog.blackberry.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/9ef0a66c09615fa946c4179662398878?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>BlackBerry Developer Blog &#187; audio</title>
		<link>http://devblog.blackberry.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://devblog.blackberry.com/osd.xml" title="BlackBerry Developer Blog" />
	<atom:link rel='hub' href='http://devblog.blackberry.com/?pushpress=hub'/>
		<item>
		<title>Full Duplex Audio Engine for BlackBerry 10 VoIP Developers</title>
		<link>http://devblog.blackberry.com/2013/01/blackberry-10-voip/</link>
		<comments>http://devblog.blackberry.com/2013/01/blackberry-10-voip/#comments</comments>
		<pubDate>Wed, 02 Jan 2013 19:15:09 +0000</pubDate>
		<dc:creator>Gurtej S.</dc:creator>
				<category><![CDATA[Native SDK Development]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[audio subsystem]]></category>
		<category><![CDATA[audio support]]></category>
		<category><![CDATA[bbm]]></category>
		<category><![CDATA[BlackBerry 10]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[PJSIP]]></category>
		<category><![CDATA[VoIP]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=12809</guid>
		<description><![CDATA[Figure shows a high level audio block diagram of BlackBerry 10 audio subsystem and BlackBerry 10 APIs If you haven’t already heard, RIM’s subscriber base just grew to 80 million users &#8212; and of those users, 60 million use BlackBerry Messenger (BBM). If you are thinking about growing your user base, why not just port [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=12809&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-12810" alt="TITLE_IMAGE" src="http://rimdevblog.files.wordpress.com/2012/12/voip.jpg?w=600&#038;h=276" width="600" height="276" /></p>
<p style="text-align:center;"><i>Figure shows a high level audio block diagram of BlackBerry 10 audio subsystem and BlackBerry 10 APIs</i></p>
<p>If you haven’t already heard, RIM’s subscriber base just grew to 80 million users &#8212; and of those users, 60 million use BlackBerry Messenger (BBM). If you are thinking about growing your user base, why not just port your existing VoIP solution to BlackBerry 10?</p>
<p>For VoIP developers, how can this be possible? Well, it’s simple: BlackBerry 10 is powered by a QNX operating system, and you can benefit from this POSIX-compliant platform by porting open source libraries – whether that is PJSIP/PJMEDIA or your existing propriety VoIP stack.</p>
<p>As a VoIP developer, you may wonder if BlackBerry 10 provides the core ingredients for you to integrate your existing stack (SIP, RTP, Jitter buffer, SDP etc.) to BlackBerry 10’s underlying platform. Good news is that we have already done the work and validated this for you.</p>
<p>BlackBerry 10 audio subsystems consist of:</p>
<ul>
<li>Full duplex audio support</li>
<li>Interface to the microphone, receiver, loudspeaker and headset</li>
<li>Analog-to-Digital Conversion for the microphone</li>
<li>Digital-to-Analog Conversion for the speaker</li>
<li>Hardware Audio Routing to select audio user interface (headset, speakerphone&#8230;)</li>
<li>Io-audio enables voice processing (AEC, NR, Gain Control) and routes audio to voice path</li>
<li>Automatic Least cost audio routing over Wi-Fi or cellular radio</li>
<li>Volume control</li>
</ul>
<p>What’s important here is that these features are available to you today through the Audio Library APIs as part of the BlackBerry 10 Native SDK. The Audio Library is based on the QNX Sound Architecture API functions and has a lot of similarities to the Advanced Linux Sound Architecture (ALSA) APIs. These are not directly compatible, but for those of you that come from the Linux world and choose to use ALSA this would definitely be a good opportunity for you to port your existing code to BlackBerry 10.</p>
<p>So why wait &#8211; get started today! The knowledge base article below directs you to sample code that demonstrates how to integrate your existing VoIP stack with the BlackBerry 10 audio subsystem.</p>
<p><a href="http://supportforums.blackberry.com/t5/Native-Development/BlackBerry-10-Audio-Subsystem/ta-p/2018769" target="_new">http://supportforums.blackberry.com/t5/Native-Development/BlackBerry-10-Audio-Subsystem/ta-p/2018769</a></p>
<p>You can follow existing success stories at:<br />
<a href="http://blog.truphone.com/2012/05/blackberry-10-the-developers-advantage-1.html" target="_new">http://blog.truphone.com/2012/05/blackberry-10-the-developers-advantage-1.html</a><br />
<a href="http://devblog.blackberry.com/2012/07/voip-development-on-blackberry-10/" target="_new">http://devblog.blackberry.com/2012/07/voip-development-on-blackberry-10/</a></p>
<p>PJSIP Blog:<br />
<a href="http://blog.pjsip.org/2012/06/14/initial-support-for-blackberry-10-bb10-now-available/" target="_new">http://blog.pjsip.org/2012/06/14/initial-support-for-blackberry-10-bb10-now-available/</a><br />
<a href="https://trac.pjsip.org/repos/wiki/Getting-Started/BB10" target="_new">https://trac.pjsip.org/repos/wiki/Getting-Started/BB10</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/12809/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/12809/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=12809&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2013/01/blackberry-10-voip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/41e8b1a2189dfce0a51887beab21795d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gurtejsan1</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2012/12/voip.jpg" medium="image">
			<media:title type="html">TITLE_IMAGE</media:title>
		</media:content>
	</item>
		<item>
		<title>Hello OggVorbis</title>
		<link>http://devblog.blackberry.com/2012/08/hello-oggvorbis/</link>
		<comments>http://devblog.blackberry.com/2012/08/hello-oggvorbis/#comments</comments>
		<pubDate>Tue, 07 Aug 2012 16:48:39 +0000</pubDate>
		<dc:creator>Ramprasad Madhavan</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Native SDK Development]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[BlackBerry 10]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[OggVorbis]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[OpenAL]]></category>
		<category><![CDATA[sample code]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=10567</guid>
		<description><![CDATA[Using a sample project to show how to set up and use OpenAL and OggVorbis with the BlackBerry 10 Native SDK.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=10567&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>The audio portion of a native game or app has traditionally been a land of &#8220;#ifdefs&#8221; and low-level platform specific code. This is especially true when targeting different devices supporting differing audio formats.</p>
<p>OpenAL, from Khronos, is designed to solve that exact problem. It is an open source, cross platform 3D Sound API for use in games and multimedia apps. Thankfully, OpenAL 1.1 is readily available on BlackBerry® 10. It is supported on multiple platforms and due to its API looking strikingly similar its 3D graphics cousin OpenGL API, it has proved to be very easy to learn and integrate. OpenAL, however, does not directly support compressed audio formats out-of-the-box. This could result in games having bigger audio files and hence a bigger memory footprint.</p>
<p>Enter OggVorbis.</p>
<p>There are several compressed audio formats and associated libraries available and I recommend OggVorbis for the following reasons:</p>
<ul>
<li>It’s lightweight</li>
<li>It’s open source</li>
<li>It’s professional quality audio encoding</li>
<li>It’s streaming support</li>
</ul>
<p>If you need further convincing, please visit <a href="http://www.vorbis.com/faq/" target="_new">their site</a>.</p>
<p>This blog post uses a sample project to show how to set up and use OpenAL and OggVorbis with the BlackBerry 10 Native SDK. The sample is forked off the famous &#8220;cascades cowbell app&#8221; and minor modifications have been made to show how to load and play .ogg and .wav files. Assuming you are already familiar with the BlackBerry 10 Native SDK, here are the main steps to follow:</p>
<p><span id="more-10567"></span></p>
<h3><strong>Convert your assets</strong></h3>
<p>Download a tool of your choice from <a href="http://www.vorbis.com/software" target="_new">http://www.vorbis.com/software</a> to convert the heavy WAV PCM files to the slender OGG files.</p>
<h3><strong>Add the OggVorbis library to your project</strong></h3>
<p>OggVorbis is already ported and available at the BlackBerry Github community, so go ahead download the <a href="https://github.com/blackberry/OggVorbis" target="_new">source code</a> <code>()</code> and compile it using BlackBerry 10 Native SDK. Once compiled, add the library (example: libvorbis.a) and the headers into a folder inside the cowbell application project directory. Let&#8217;s call it &#8220;external-lib&#8221;. Now modify the cowbell.pro project to include the header and library files.</p>
<pre>LIBS   += -lOpenAL -lalut -L../external-lib/oggvorbis/lib/qnx/arm/ -L../external-lib/oggvorbis/lib/qnx/x86/ -lvorbis

INCLUDEPATH += ../src ../external-lib/oggvorbis/include
SOURCES += ../src/*.cpp 
HEADERS += ../src/*.h</pre>
<p>Now that we have the project setting done, we can focus on loading and playing the .ogg file.</p>
<h3><strong>Open the OGG file</strong></h3>
<p>The function that opens up the access to the OggVorbis file is <code>ov_open</code>. Declare an <code>OggVorbis_File</code> file type that is returned by the ov_open. This file will be used to decode the OggVorbis file.</p>
<pre>OggVorbis_File ogg_file;
ALenum format;
int result;
unsigned int size = 0;

rewind(file);

// Open the ogg file
if (ov_open(file, &amp;ogg_file, NULL, 0) &lt; 0)
fclose(file);</pre>
<h3><strong>Calculate the unpacked audio file size</strong></h3>
<p>In order to load the uncompressed data into an OpenAL buffer, we need to store the audio data in a temporary buffer. The size of the audio buffer can be found using a simple formula: (<em>number of channels</em>) * (<em>number of samples</em>) * (<em>number of bytes per packet</em>)</p>
<p>The number of channels info can be retrieved into vorbis_info using the ov_info function. The number of samples can be found using the ov_pcm_total function.</p>
<pre>vorbis_info* info;
// Get the file info for creating the audio buffer
info = ov_info(&amp;ogg_file, -1);

if (info-&gt;channels == 1)
	format = AL_FORMAT_MONO16;
else
	format = AL_FORMAT_STEREO16;

// buffer size = (no. of channels) * (no. of samples) * 2 (for 16 bit)
unsigned int data_size = ov_pcm_total(&amp;ogg_file, -1) * info-&gt;channels * 2;</pre>
<h3><strong>Decode the audio file</strong></h3>
<p>Once we have a temp buffer allocated, the <code>ov_read</code> function can be used to read and decode blocks of audio data.</p>
<pre>char* data = new char[data_size];

// Read the Ogg file into audio buffer
while (size &lt; data_size) {
	result = ov_read(&amp;ogg_file, data + size, data_size - size, 0, 2, 1, &amp;section);
	if (result &gt; 0)
		size += result;
	else if (result &lt; 0) {
		delete data;
		return false;
	}
	else {
		break;
	}
}</pre>
<h3><strong>Load the data into an OpenAL buffer</strong></h3>
<p>Assuming we have already initialized OpenAL context and audio buffers to hold audio data, we can now upload the unpacked data into it.</p>
<pre>// Load PCM data into OpenAL buffer.
alBufferData(buffer, format, data, data_size, info-&gt;rate);

ALenum error = alGetError();
if (error != AL_NO_ERROR)
	reportOpenALError(error);</pre>
<p>Playing the audio is no different than playing regular PCM audio data.</p>
<p>The full sample is available under an Open Source license at <a href="https://github.com/blackberry/Cascades-Community-Samples/tree/master/HelloOggVorbis" target="_new">here</a>. Enjoy and consider participating in our Open Source community</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/10567/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/10567/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=10567&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2012/08/hello-oggvorbis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/ba5492209a7823e5998202d3e638830d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rmadhavan</media:title>
		</media:content>
	</item>
	</channel>
</rss>
