hey guys

does anyone have any references / links to help me understand how to
extract the note / tone / pitch from a sound captured from a mic

i have a view to deal with the mic and i am capturing the output correctly
but i need to understand how to check it for specific pitch ranges

here is my class so far - i'd like the controller to be able to apply some
logic to decide how the app should respond from there (using
controller.updateAudioSample(audioChunk);)

[CODE]
package uk.co.publicis.toothbrushdetectorapp.views
{
// imports
        ...
 public class MicView extends View implements IView
{
private var _mic : Microphone;
 public function MicView(model:Model, controller:Controller=null)
{
super(model, controller);
 init();
}
 private function init():void
{
if (Microphone.isSupported)
{
_mic = Microphone.getMicrophone();
_mic.enableVAD = true;
_mic.encodeQuality = 0;
_mic.rate = 8;
}
}
 /* INTERFACE uk.co.publicis.toothbrushdetectorapp.views.IView */
 public function destroy():Boolean
{
disable();
_mic = null;
 return true;
}
 public function enable():Boolean
{
if (Microphone.isSupported)
{
_mic.addEventListener(ActivityEvent.ACTIVITY, handleActivity);
 // odd behaviour - if this is not added here, no ActivityEvent.ACTIVITY
will be captured either.
// makes it impossible to start / stop capturing the SAMPLE_DATA on
ACTIVITY events
_mic.addEventListener(SampleDataEvent.SAMPLE_DATA, handleSampleData);
}
 return true;
}
 public function disable():Boolean
{
if (Microphone.isSupported)
{
_mic.removeEventListener(ActivityEvent.ACTIVITY, handleActivity);
_mic.removeEventListener(SampleDataEvent.SAMPLE_DATA, handleSampleData);
}
 return true;
}
 private function handleActivity(e:ActivityEvent):void
{
if (e.activating)
{
controller.activate();
}
else
{
controller.deactivate();
}
 }
 private function handleSampleData(e:SampleDataEvent):void
{
var audioChunk:ByteArray = e.data as ByteArray;
controller.updateAudioSample(audioChunk);
}
 public function get model():TBDModel
{
return _model as TBDModel;
}
 public function get controller():TBDController
{
return _controller as TBDController;
}
}
}
[/CODE]

thanks in advance
a
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to