|
-
First of all it is impossible to hook up bluetooth with your pc unlesss you have the proper USB for it.
Even if you get the USB for it flash cannot detect it because
"you can't flash is a webprogramming language it doesn't understand hardware...flash is not a programming language so to speak it is a scripted language" ~ calmchess
and I do beleive it is still the same for CS5.
As for microphones, yes it does work and I have found a great tutorial on how to use it for the new flash player 10.1.
The tutorial is in french and I have translated it for you...
Since Flash Player 10.1, it is now possible to record the flow of the microphone as ByteArray, to listen, and then save it on your hard drive.
In fact, since Flash Player 10.1, using SampleDataEvent.SAMPLE_DATA, we may acquire in the raw stream from the microphone.
In this example, you can register, you listen, and then save the sound file in WAVE.
Code:
PHP Code:
import pack.WAVEncoder; var soundBytes:ByteArray = new ByteArray(); soundBytes.endian = Endian.LITTLE_ENDIAN; var mic:Microphone = Microphone.getMicrophone(); mic.gain = 100; mic.rate = 44; rec.addEventListener(MouseEvent.CLICK,onClickk); function onClickk(e:Event):void { mic.addEventListener(SampleDataEvent.SAMPLE_DATA, micSampleDataHandler); } function micSampleDataHandler(event:SampleDataEvent):void { while (event.data.bytesAvailable) { var sample:Number = event.data.readFloat(); soundBytes.writeFloat(sample); } } function playbackSampleHandler(event:SampleDataEvent):void { for (var i:int = 0; i < 8192 && soundBytes.bytesAvailable > 0; i++) { var sample:Number = soundBytes.readFloat(); event.data.writeFloat(sample); event.data.writeFloat(sample); } } eco.addEventListener(MouseEvent.CLICK,onClick); function onClick(e:Event):void { mic.removeEventListener(SampleDataEvent.SAMPLE_DATA, micSampleDataHandler); soundBytes.position = 0; var sound:Sound = new Sound(); sound.addEventListener(SampleDataEvent.SAMPLE_DATA, playbackSampleHandler); sound.play(); } function _saveFileHandler(e:Event):void { var encoder:WAVEncoder = new WAVEncoder ( ); var fileRef:FileReference = new FileReference ( ); fileRef.save( encoder.addHeaders ( testConvert(soundBytes) ), "monSon.wav" ); } function testConvert( p:ByteArray ):ByteArray { var ba:ByteArray = new ByteArray ( ); ba.endian = Endian.LITTLE_ENDIAN; p.position = 0; while ( p.position < p.length ) { ba.writeShort( p.readFloat ( ) * 32767); } return ba; } mySaveButton.addEventListener(MouseEvent.CLICK,_saveFileHandler);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|