开发者

How to filter sound coming from microphone in flash (10.1)?

I hove some sound coming from microphone. i need to add sound filter to it and to play it to the guy which talks into tha开发者_StackOverflow社区t microphone.

How to do such thing?


Take a look at this air application.This can be converted for use in Adobe Flash Player 10.1.

http://download.macromedia.com/pub/developer/air/sample_apps/microphone.zip

It allows you to access the raw data from the microphone in Flash

Now for applying the filter check: http://code.google.com/p/standingwave/


As far as I know this can be done with air: http://www.adobe.com/devnet/air/flex/articles/using_mic_api.html

here is the example code that does what you are asking:

import flash.media.Sound;
import flash.utils.ByteArray;
protected var soundRecording:ByteArray;
protected var soundOutput:Sound;
protected function playbackData():void
{
    soundRecording.position = 0;

    soundOutput = new Sound();
    soundOutput.addEventListener(SampleDataEvent.SAMPLE_DATA, playSound);

    soundOutput.play();
}

private function playSound(soundOutput:SampleDataEvent):void
{
    if (!soundRecording.bytesAvailable > 0)
        return;
    for (var i:int = 0; i < 8192; i++)
    {
        var sample:Number = 0;

        // apply your filter here
        if (soundRecording.bytesAvailable > 0)
            sample = soundRecording.readFloat();
    soundOutput.data.writeFloat(sample); 
    soundOutput.data.writeFloat(sample);  
     }                
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜