Advertisement
henke37

Audio reverser

Jun 6th, 2013
490
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import flash.media.*;
  2. import flash.utils.*;
  3. import flash.events.*;
  4.  
  5. trace("location X",getTimer());
  6.  
  7. var buff:ByteArray=new ByteArray();
  8.  
  9. var s:Sound=new Test();
  10.  
  11. var read:uint;
  12. do {
  13.     read=s.extract(buff,4096);
  14. } while(read==4096);
  15.  
  16. trace("location Y",getTimer());
  17.  
  18. var s2:Sound=new Sound();
  19. s2.addEventListener(SampleDataEvent.SAMPLE_DATA,gen);
  20.  
  21. var pos:uint=buff.length;
  22.  
  23. function gen(e:SampleDataEvent):void {
  24.    
  25.     for(var i:uint;i<8000 && pos > 0;++i,pos-=8) {
  26.         buff.position=pos-8;
  27.         e.data.writeFloat(buff.readFloat());
  28.         e.data.writeFloat(buff.readFloat());
  29.     }
  30. }
  31.  
  32. s2.play();
  33.  
  34. trace("location Z",getTimer());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement