Search code examples
actionscript-3audiomicrophone

AS3 and the microphone class


In Java there is a method of the AudioFormat called

getSampleRate

This returns the number of samples per second.

I was wondering what the best way to achieve this with the microphone in flash is. I am not sure if I need to add a SamplesDatatEvent and use extract() or ??

I need to know the number of samples per second from the audio coming into the mic.


Solution

  • The Microphone class has a 'rate' getter/setter: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Microphone.html#rate

    Seems to default to either 8kHz or 11kHz, settable up to 44kHz (44.1, I assume).

    You can add a 'SampleDataEvent' listener to get access to the bytes.