Hi Anthony,

On every platform I've tried, when using the microphone input each 
SampleDataEvent gives 2048 samples. 

>>> Up until now, I really didn't care about things like latency, as I was 
>>> merely attempting to learn algorithms for post processing related tasks; 
>>> yet, now that I have become interested in realtime tasks, and would love to 
>>> be able to perform them in the browser, it's becoming an issue.

I hear ya!  The high latency for Flash audio both on input and output makes it 
basically unusable for any application where near real-time response is 
required.  The lack of support for stereo audio input and MIDI, the 
single-threaded execution model, and the generally poor performance of AS3 
(compared to C#, for example) also don't help matters!  That said, there are 
still plenty of interesting audio applications that are possible even within 
the above limitations.

Incidentally, the latency for the Flash audio output (and perhaps the audio 
input) varies a lot depending on the operating system. In my experience, 
Android is the worst, Windows is better, and Mac is quite good.  But the best 
I've seen is on the BlackBerry Playbook.  

Got a Playbook for free at the Singapore Blackberry DevCon, which I went to 
mainly because I could get a free copy of FlashBuilder Premium (which normally 
costs more than the conference fees). I figured I'd immediately put the free 
Playbook up for sale on eBay, but decided to keep it after being pleasantly 
surprised at how well it worked, especially for Flash.

Cheers,

-Gerry

On 2011-12-22  , at 07:15 , Anthony Pace wrote:

> Hey Karl,
> 
> Not sure if you read my question completely, or if you did and what I wrote 
> was too confusing; yet, I do already know how to set the sampling rate (e.g. 
> mic.rate = 44, or 11, or w/e ).
> 
> What I was asking, is if there is anyway to access the sample buffer before 
> the bytes get reported by the SampleDataEvent; for, at least on my machine, 
> it only reports a minimum of 2048 samples about every 47 ms, but I really 
> want to have access to 512 samples in about 12 ms, or even 256 in sample in 
> about 6 ms.
> 
> When you adjust the sample rate, you can get lower sample sets returned; yet, 
> as the rate has been decreased you receive them with the same amount of 
> latency.  (e.g at a rate of 11 you get 512 samples when the SampleDataEvent 
> fires, but you still get them in the3 same amount of time, which is about 47 
> ms on average).
> 
> Now do you see what see what I am referring to?
> 
> 
> 
> On 12/21/2011 5:29 PM, Karl DeSaulniers wrote:
>> Did a google for "controlling mic sample rates in as3"
>> FYI
>> 
>> Best,
>> Karl
>> 
>> On Dec 21, 2011, at 2:08 PM, Anthony Pace wrote:
>> 
>>> Wow.  Just read through my post, and saw the errors.  Guess I shouldn't get 
>>> 3 hours sleep and then try to type.
>>> 
>>> Second try:
>>> 
>>> No replies? Okay then.  As the player doesn't seem to make the buffered 
>>> data available unless it has a full 2^n chunk within a given timeframe, and 
>>> also considering that there doesn't seem to be a way to just grab the 
>>> currently buffered bytes, then I guess doing what I want just isn't 
>>> possible, at least in this version of the player (hope for the future).
>>> 
>>> This is really sad; for, imho, the developer should be able to at least 
>>> state the minimum sample size he wants reported per SampleDataEvent, and 
>>> not just the rate per second.
>>> 
>>> In combination with setting the desired sampling rate (e.g mic.rate = 44), 
>>> being able to set the minimum buffer amount to be reported, and to set no 
>>> delays would be perfect .
>>> 
>>> e.g.
>>> mic.sampleBufferMin = 8; // 2^8 = 256  must be value between 8 and etc...
>>> mic.sampleBufferMin = 9;// 2^9 = 512 is what would work in my case
>>> mic.reportImmediately = true; //to avoid having to wait until the next 
>>> frame is collected if it couldn't collect enough to report in time
>>> 
>>> or even being able to access the bytes already in the buffer without having 
>>> to wait until SampleDataEvent is allowed to fire
>>> e.g.
>>> myByteArray = mic.pollBuffer(); //or bytesLoaded or w/e you would prefer to 
>>> call it
>>> 
>>> Up until now, I really didn't care about things like latency, as I was 
>>> merely attempting to learn algorithms for post processing related tasks; 
>>> yet, now that I have become interested in realtime tasks, and would love to 
>>> be able to perform them in the browser, it's becoming an issue.
>>> 
>>>> 
>>>> 
>>>> On 12/20/2011 4:32 PM, Anthony Pace wrote:
>>>>> Just in case you are wondering why...
>>>>> although I know I could just split up the sample amount into smaller 512 
>>>>> sample chunks, I am interested in doing some lower latency effects, and 
>>>>> the delay is just too much to bare right now.
>>>>> 
>>>>> 
>>>>> 
>>>>> On 12/20/2011 3:37 PM, Anthony Pace wrote:
>>>>>> Is this possible?
>>>>>> 
>>>>>> When recording from the Mic, in this case at 44100hz I can't get the 
>>>>>> SampleDataEvent to report sample chunks of less than 2048 samples.   The 
>>>>>> problem really is that it flash waits about 47 ms on average to report a 
>>>>>> sample chunk (although my counter shows it updates between 33ms and 
>>>>>> 60ms), and in some cases even though there is no load, it waits until it 
>>>>>> can report 4098 samples (even though there is no load); yet, I only 
>>>>>> need/want 512 samples in approximately 12ms on average.
>>>>>> 
>>>>>> If, while keeping the same sample rate, there is some official way to 
>>>>>> decrease the chunk size being reported and the time it takes to report 
>>>>>> it, I can't see it; therefore, I am hoping there may be some way of just 
>>>>>> getting to the Sample Data before it's reported?
>>>>>> _______________________________________________
>>>>>> Flashcoders mailing list
>>>>>> Flashcoders@chattyfig.figleaf.com
>>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> Flashcoders mailing list
>>>>> Flashcoders@chattyfig.figleaf.com
>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>> 
>>>> 
>>>> _______________________________________________
>>>> Flashcoders mailing list
>>>> Flashcoders@chattyfig.figleaf.com
>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>> 
>>> 
>>> _______________________________________________
>>> Flashcoders mailing list
>>> Flashcoders@chattyfig.figleaf.com
>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>> 
>> Karl DeSaulniers
>> Design Drumm
>> http://designdrumm.com
>> 
>> _______________________________________________
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>> 
> 
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to