I wrote a while ago about our tween engine at Hobnox but I did not post any performance demos.
Here are the results for 1000 DisplayObjects with manipulation on their scaleX, scaleY, alpha, x, y and rotation properties. It is also very important that you take a look at the memory behaviour. A click starts the tweening.
As you can see it makes a lot of sense to stay type-safe and to manage the memory you are using on your own.
I will talk about those concepts in my next session AudioTool’s Private Parts in Brighton and Boston. Since optimization on a code level is trivial the main performance boost is achieved by re-thinking algorithms, structures and concepts. I guess one of the most interesting topics will be the optimization of our cable solver which was running O(n^2) (really!), then O(n(n+1)/2) and could be minimized to a rare O(n(n-4)/2) worst-case.
Share This
Tinic posted today his PixelBender assembler and disassembler. This makes me happy, because now I can post an experiment I could not show for a while.
If you know PixelBender, than you know that you can not create loops. What you could do is unroll all constant loops with a fixed length. If you know simple convolution filters like a blur, you know that you need an xy-loop and you know it should not be possible with PixelBender at all. Let me prove you wrong and have a look at dynamic loop unrolling with PixelBender (be careful with high values!).
I built a library to assemble and disassemble PixelBender kernels at runtime. I wrapped it also in a high level API so basically you can create a new Kernel by doing var kernel: Kernel = new Kernel();. Then when you need your shader as a ByteArray you simple call kernel.compile(). There are still some glitches here and there but I hope that I can release the source code pretty soon.
Share This
I have started working on AS3C at the end of last year. After a quick prototype the development stagnated and I added just several fixes and tests to the code. Basically I started AS3C as a complete C# newcommer and because of that the code is very ugly.
Due to the fact that I do not have much free time to continue developing AS3C I think it is the right time to release the source-code on the one hand and to let people experiment with it on the other hand.
You can either download the sources and build AS3C manually (you will need zlib.net) or download a binary from trunk/bin/.
When using AS3C you will need the ActionScript from the SVN. Remember that you write real ActionScript code which gets translated by AS3C. There is also one undocumented and very experimental feature existing. If you run as3c.exe -optimize main.swf you could get some speed improvements if you have heavy loops using the Math class. But it could also destroy the SWF so do not forget to make a backup :o)
Share This
As André already mentioned we have finally got an Ogg Vorbis Encoder in ActionScript 3. André wrote a lot about the benefits already.
Now what I really like about the encoder is the way we could minimize the encoding time by ~50%! I know two implementations of Ogg Vorbnis. One is written in C and another one in Java. What we did first was just getting it to work and it looked pretty much like the C/Java version. Then we started optimizing the code by comparing the encoding results always to reference files. I am quiet happy because on my machine we reduced the encoding time from 32sec to 16.5sec with simple optimizations and tricks.
Where to go from here? Of course we think the best we can do is to open-source the encoder. But there are a couple of other things in my mind. I started modifing Tamarin and added two functions to the Math class. Those convert a Number to its binary IEEE32 single-precision representation and vice versa. With those two functions we could get huge speed improvements for performance hungry tasks like this one. I hope Adobe will not forget about this as well — there seems to be general problem currently trying to support the simple Flash user on the one hand and the “Flash explorer” on the other hand.
I know you may ask what this feature could be good for, but doing floating point math using bitwise operations is a killer when it comes to performance. We are currently not allowed to do this and there is no reason for that.
Share This
When Tinic Uro was implementing the dynamic audio features he was also giving us a very nice present called Sound.extract(). And it is simply awesome!
I wrote a simple experiment yesterday night using the popforge library. Yes — you can use it still with the new features and it is a great help. I just had to convert the sample data into a format for popforge.
The experiment is a simple flanger applied to an MP3. André wrote the flanger about a year ago but it is still fun listening.
The sourcecode will also show you how to loop sounds using Sound.extract(). It is a very safe way so that you get always as much data as you need.
There is only one problem right now. I wanted to use the new FileReference features so that you can load your own MP3s into the flanger. But unfortunately there is currently no easy way to do this. You would have to load the bytes, then create a SWF at runtime and inject the MP3. Then you could load that SWF with Loader.loadBytes() and once that is complete you can extract the sound. I thought doing that would be a little bit too much for a small demo :)
Share This
Another simple example here. I think it was a little bit hard for me to understand first how to do animations with Pixel Bender based on user input.
The user input is currently only a Math.random() but I think you will get the idea. I always put the output of the shader back into it and get a nice wave effect.
Share This
Remember the 8bitboy? It was our first application to test how good dynamic audio works in the Flash Player. It was also the very first application we ported to test the new Flash Player 10 audio capabilities.
Here is the Astro version.
I was very happy when I ported the 8bitboy because it was very simple. You just have to replace the sound buffer we were using with the callback of the Sound object and pull for samples from the processors.
Share This
Here is a simple example how to write your own synthesizer in Astro with multiple voices and a simple ADSR envelope. I thought I write it so that not everybody is posting hurtful high-frequency oscillators.
You will see why latency really matters when programming audio applications once you start pressing some keys. It is not really possible to play anything but hopefully this well get adressed before the final version of the FP10.
Also there is currently not a really great way to develop with FDT for Astro. It is too bad but I hope the guys at Powerflasher will release an update pretty soon as well. Right now you can compile the example using Ant.
Share This
This evening Kai-Philipp and me were playing around with the Hobnox Audiotool to test some of the upcomming Midi features.
In the middle of the performance we lost the connection to the little cubes and had to restart the Midi bridge between Flash and the devices. It is still in an early stage but a whole load of fun.
The little cubes were provided by our colleague Oliver who is currently reviewing them. They are comming from percussa.com and are able to send CC values based on their orientation.
Share This
I am so happy — this year I will speak at FITC Toronto! And it is for me the first conference outside of Europe. So what will it be about? It is the first release and session about my currently nameless inline compiler. This tool allows you to write and debug bytecode by writing ActionScript. It includes also a lot of other nifty features like method injection — which is by the way a real killer-feature. If you do not understand it right now don’t worry: you will love it!
The compiler is currently in a working state (although I finally have to support bytecode 0×1b) and I am implementing several optimization techniques. This is not so easy but I hope to find some solutions to enable branch elimination, constant folding and loop unrolling (which is already getting pretty close) to name a few.
I do not want to spoil the fun so any updates are kept private until the FITC for now.
Share This