Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none
Accepted Solution

Microphone support in beta 3 simulator

Has anyone attempted to or succeeded at using the microphone (flash.media.Microphone) under the latest simulator?

 

I see that Microphone.isSupported is returning true, and I can get ActivityEvent and SampleDataEvents, but it doesn't seem to be picking up actual sound. 

 

I haven't tried analyzing what the data actually looks like yet, but the activity level mostly sits down near 0.  I get sporadic activity events (true/false transitions) that don't seem have any relationship to the sound in the room, and the levels only just barely touch 10 then drop again instantly.

 

Running the same test program via ADL (on my host machine) and saying "testing" in a normal voice gives me levels up around 50 and normal-looking activity transitions.

 

Just curious whether anyone else has tried and got any real results.  Thanks.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: Microphone support in beta 3 simulator

I am afraid this is not yet supported peter.

 

 

API known issues

The following APIs are currently not implemented: 
Camera 
Microphone 
CameraUI 
CameraRoll 
Geolocation 

(80891)

 

Source

 

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Microphone support in beta 3 simulator

Thanks for the link, zezke!  I had read that page but didn't remember all the details, I guess.

 

(Anyone else find that the alternating background colours in that list makes it pretty hard to read?)


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: Microphone support in beta 3 simulator

I agree, gray on gray seldom works for anyone.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
New Contributor
Posts: 6
Registered: ‎07-27-2010
My Device: Not Specified

Anyway to build PlayBook app without using Adobe products?

Hi,

 

Anyway to build PlayBook app without using Adobe products?

 

SH

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Anyway to build PlayBook app without using Adobe products?

@shaider2000, please don't ask new questions in existing threads.  For one thing, very few people will see your post, as it won't show up in the Forum Message List.

 

Go to that link and click on New Message to start a new topic.  And the answer, by the way, is you can use only free command line tools or third-party IDEs and such (I do).  Ask again in a new thread and you'll get lots of responses.  Also considering searching the forum first, as this isn't the first time it's been asked.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Highlighted
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Microphone support in beta 3 simulator

@zezke, I'm happy to say I'll have to retract my acceptance of your post as a solution. Smiley Happy

 

mike_test.png

 

Turns out that the API is certainly supported and the simulator supports it, but there appear to be issues in the simulator (who could have guessed?).  ;-)

 

Basically the SampleDataEvents are arriving much more slowly than they should be.  It appears very sluggish, and after only a few seconds (e.g. 7.7 in the above image) the data is already lagging behind by many seconds.  Running in ADL the lag stays around 0.2s constant, and the calculated rate approaches 8kHz over time, as it should (averaging out various inaccuracies).

 

But it does record the correct data! The image shows the middle of the word "PlayBook".

 

So the answer to my original question is yes, the Microphone does work in the simulator, but only about as well as many of the other new simulator features. ;-)

 

The actual sample rate, by the way, appears to be correct (in spite of my "rate" value shown in the app).  It's just that the sample buffers get backlogged for some reason, and are not delivered to the code as quickly as they arrive.  If I let it run for a long time, I'd probably see gradual memory loss since it must be storing these all somewhere.  For proof that the data is actually correct, just delayed, below is a comparison of the simulator versus my host machine, recording the same sound (me whistling at a constant pitch, probably around 2kHz).  Yes, there's all kinds of aliasing going on, but they wouldn't look that similar if the simulator sampling rate was wrong.

mike_test_comparison.png


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Microphone support in beta 3 simulator

Interesting... I had the idea of changing the Microphone.rate setting to see what effect it would have.  I just assumed it would make things much worse, with significantly greater lag.

 

As it turns out, although rate settings of 5, 8, and 11 (these rate values approximately the sampling rate in kHz) all show some of this lag, when I set it to 22 or 44 it keeps up and works perfectly!

mike_test_rate_22.png

 

So I'll make this the answer: flash.media.Microphone is basically supported, though with some issues.  Using Microphone.rate of 22 would be advisable to avoid the sample lag issue, and 44 seems to work fine as well though with this flaky simulator version I'm a bit worried about overloading it and getting The Freeze.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!