BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 12-30-2010, 08:44 AM   #1 (permalink)
New Member
 
Join Date: Aug 2010
Model: 9000
PIN: N/A
Carrier: E_PLUS
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Real Time Sound Synthesis on BB

Please Login to Remove!

Hi all,

i'm working on a user event based real time sound synth. app. that should work with raw audio, using a ring buffer that constantly feeds the data to the blackberry player and loops the sound until some user event happens. Since the player doesn't support raw audio i'm sending a WAV header (with modified media length so the player doesn't stop when the end of a sample is reached) when the player starts and before i'm sending the actual audio data. Currently i can play a custom generated sine tone but i'm facing a major problem when trying to change the sample (resample the sine at a new frequency and send it to the player) at real time. The idea was, since i can't modify the readpointer of the player, to flush the player buffer with StreamingBufferControl.flush(), to reset the player and when he requests the new data to send him the new samples, but that didn't work out at all. I've tried debugging the player to see what exactly is happening after a flush and the result was:

- After calling flush() a com.rim.flush Event is sent from the player
- The player plays the old sample for a couple of seconds
- Buffers are set to 0 and the player requests 4 times the new sample
- Now the player starts playing the new sample

Here's the debugging text:

Code:
******************
Player Event : com.rim.flush
******************
MP: h=16777216,s=PL: mStat: 3220
******************
Player Event : com.rim.timeUpdate
******************
MP: h=16777216,s=PL: mStat: 4200
******************
Player Event : com.rim.timeUpdate
******************
MP: h=16777216,s=PL: mStat: 5200
******************
Player Event : com.rim.timeUpdate
******************
MP: h=16777216,s=PL: mStat: 6220
******************
Player Event : com.rim.timeUpdate
******************
MN: flushBuffers0(16777216)=0
***************** Copying : 204797 bytes of data to player at index : 3
***************** 
***************** Copying : 204800 bytes of data to player at index : 0
***************** 
***************** Copying : 204797 bytes of data to player at index : 3
***************** 
***************** Copying :122880 bytes of data to player at index :  0
*****************
***************** Copying : 204796 bytes of data to player at index : 4
*****************
MP: h=16777216,s=PL: mStat: 7240
******************
Player Event : com.rim.timeUpdate
******************
MP: h=16777216,s=PL: mStat: 8260
******************
Player Event : com.rim.timeUpdate
*****************
***************** Copying : 165932 bytes of data to player at index : 0
Could someone please explain to me how the bb player works or give me some ideas to how i can work around this problem.

I still don't understand why the player is requesting 4 times the data. Is it possible that the player has multiple buffers to play the audio without any delays, so that when a flush occurs it plays the data from all buffers first before reseting them?

PS: multiple players didn't work out, the delay time starting the new player and buffering the data took to long.

Thanks in advance
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads for: Real Time Sound Synthesis on BB
Thread Thread Starter Forum Replies Last Post
BB Sound drivers jvelarde General 9700 Series Discussion - Bold 2 5 05-23-2010 10:45 PM
Last Contact Time: What is REAL??!!?? Getting very irritated with DEAD users. RJeffDay BES Admin Corner 5 02-01-2010 10:46 AM
Long time BB user heavily considering the Pre Skinflaps BlackBerry Versus 8 06-17-2009 08:08 AM
Bluetooth Headset Reviews barjohn Bluetooth Connection 500 12-06-2007 06:47 AM
Desktop Manager Can't Sync Device Time Correctly traveler20 RIM Software 0 04-14-2007 01:32 PM





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.