2 Replies Latest reply on Sep 25, 2009 2:49 PM by Philippe Chaurand

    Dynamic sound effect / buffer too big

    Philippe Chaurand



      I m using a 'Sound' instance (with the 'SampleDataEvent' event) to apply sound effects to a song in realtime.

      The problem is that I m forced to write at least 2048 samples every time. It means that the minimum delay/buffer is 50 ms, which is too much.


      As the 'data' property of the 'SampleDataEvent' is a 'ByteArray', I tried to write in it outside the 'SampleDataEvent' callback (with 'setInterval') ---> but if I do so, it plays no sound at all. Do I have to be in the callback function to write in this 'ByteArray' ?


      Do you have an idea to use a smaller buffer (256 samples should be great !) ?

      Maybe another way to apply my sound effects (not with 'SampleDataEvent') ?




        • 1. Re: Dynamic sound effect / buffer too big
          David_F57 Level 5



          This may mean a bit of learning but have you considered looking at pixel bender as a way to apply the effects ?, there is a reasonable amount of information about useing shaderjob with pixelbender filters to apply affects to binary data in realtime.(for both video and audio). As I am not sure what it is you are doing I may be way off base here but thought it never hurts to offer an option.



          • 2. Re: Dynamic sound effect / buffer too big
            Philippe Chaurand Level 1



            Thanx. Yeah, I m already using pixel bender to apply effects (such a great tool !).

            But my problem is the buffer length : 50ms is too much ---> there is a (very short but annoying) delay between the moment when I press the button and the moment when the effect is applied.


            This delay/buffer/latency should be rather 5 or 10ms for realtime use.


            So any idea ? Cheers