holy crap - i've been playing with this so far and it's amazing - thanks so
much for your help

a

On 23 November 2011 14:44, allandt bik-elliott <alla...@gmail.com> wrote:

> fantastic - thanks very much
>
> a
>
>
> On 23 November 2011 14:33, Gerry Beauregard <gerry.beaureg...@sonoport.com
> > wrote:
>
>> My real-time spectrum analyzer code would be a good place to start.
>> http://www.audiostretch.com/spectrum/
>>
>> It grabs audio from the mic, applies a Hanning analysis window, does an
>> FFT, converts to a log-magnitude (dB scale) spectrum, and plots the
>> spectrum at regular time intervals.  It doesn't go quite so far as
>> extracting the pitch/note, but that's mostly a matter of finding the first
>> big peak in the spectrum, and doing a bit of interpolation around the peak
>> to get sub-FFT-bin accuracy.
>>
>> Code can be found here:
>>
>> http://gerrybeauregard.wordpress.com/2010/08/06/real-time-spectrum-analysis/
>>
>> It relies on my FFT which can be found here:
>> http://gerrybeauregard.wordpress.com/2010/08/03/an-even-faster-as3-fft/
>>
>> -Gerry
>>
>>
>>
>> On 2011-11-23  , at 22:11 , allandt bik-elliott wrote:
>>
>> > 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
>> > 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