You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by scott matheson <sc...@matheson.it> on 2016/03/22 22:09:14 UTC

Checking the Microphone

Hi
   I record my student voices and i wan to check the Mic is actually “work” buy checking for data in the recording stream, any one got some code they could share 

Thanks 

Scott

Re: Checking the Microphone

Posted by Matthew Weir <ma...@yahoo.com.INVALID>.
Actually, looking at a post from this developer, it looks like the .bytesAvailable > x is the main target to determine the amount of sound. https://forums.adobe.com/thread/1096313
//if audio bytes is greate than 4 read the recorded byte array data and write it into the sound
for (var i=0; i<8192; i++)
{
if (soundBytes.bytesAvailable > 4)
{
var sample:Number = soundBytes.readFloat();
e.data.writeFloat(sample);
e.data.writeFloat(sample);
}
}


 

    On Tuesday, March 22, 2016 5:22 PM, Matthew Weir <ma...@yahoo.com.INVALID> wrote:
 

 I don't have a mic on me, so I can't test it.  However this might be in the area you are looking for:
microphone.addEventListener(SampleDataEvent.SAMPLE_DATA, onSampleData);

private function onSampleData(event:SampleDataEvent):void { while(event.data.bytesAvailable > 0)
 _buffer.writeFloat(event.data.readFloat()); }
taken from: https://code.google.com/archive/p/micrecorder/downloads
 

    On Tuesday, March 22, 2016 5:09 PM, scott matheson <sc...@matheson.it> wrote:
 

 Hi
  I record my student voices and i wan to check the Mic is actually “work” buy checking for data in the recording stream, any one got some code they could share 

Thanks 

Scott



  

Re: Checking the Microphone

Posted by Matthew Weir <ma...@yahoo.com.INVALID>.
I don't have a mic on me, so I can't test it.  However this might be in the area you are looking for:
microphone.addEventListener(SampleDataEvent.SAMPLE_DATA, onSampleData);

private function onSampleData(event:SampleDataEvent):void { while(event.data.bytesAvailable > 0)
 _buffer.writeFloat(event.data.readFloat()); }
taken from: https://code.google.com/archive/p/micrecorder/downloads
 

    On Tuesday, March 22, 2016 5:09 PM, scott matheson <sc...@matheson.it> wrote:
 

 Hi
  I record my student voices and i wan to check the Mic is actually “work” buy checking for data in the recording stream, any one got some code they could share 

Thanks 

Scott