[AS3]as3.0声音波形转换
as3声音,as3波形,不能显示波型,只能显示音量,或者在enterFrame中显示音量,搞个伪波型吧
as3声音,as3波形,不能显示波型,只能显示音量,或者在enterFrame中显示音量,搞个伪波型吧
- package
- import flash.display.Sprite;
- import flash.events.Event;
- import flash.media.Microphone;
- import org.papervision3d.materials.ColorMaterial;
- import org.papervision3d.materials.utils.MaterialsList;
- import org.papervision3d.objects.primitives.Cube;
- import org.papervision3d.view.BasicView;
- /**
- * ...
- * @author FLASH023
- */
- public class Main extends BasicView
- {
- private var mic:Microphone;
- private var materialslist:MaterialsList;
- private var cube_array:Array;
- public function Main():void {
- init();
- startRendering ();
- }
- private function init():void {
- mic=Microphone.getMicrophone ();
- mic.setLoopBack(true);
- mic.setUseEchoSuppression(true);
- cube_array = [];
- wavCubeInit();
- cameraInit();
- }
- private function cameraInit():void {
- camera.z=200;
- cameracamera.x=camera.y=100;
- }
- private function wavCubeInit():void {
- var _cormaterial:ColorMaterial = new ColorMaterial(0x096288);
- materialslist =new MaterialsList;
- materialslist.addMaterial (new ColorMaterial(0xB9DFCF), "top");
- materialslist.addMaterial (_cormaterial, "bottom");
- materialslist.addMaterial (_cormaterial , "front");
- materialslist.addMaterial (_cormaterial, "back");
- materialslist.addMaterial (_cormaterial, "left");
- materialslist.addMaterial (_cormaterial, "right");
- var _p:uint = 10;
- while (_p--) {
- var _cube:Cube = new Cube(materialslist, 20, 10, 20);
- _cube .z = -_p * 20;
- cube_array.unshift(_cube);
- scene.addChild (_cube );
- }
- }
- override protected function onRenderTick(_evt:Event=null ):void {
- var _n:int = int(mic.activityLevel/10);
- for (var _p:String in cube_array) {
- Cube(cube_array[_p]).visible = Boolean (int(_p) <= _n);
- }
- super.onRenderTick();
- }
- }
- }
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3.0的sound类常用技巧整理
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例
请稍候...