Archive for the 'as3' Category

Rasselbock Recordings

Besides implementing OggVorbis I was working on an effect for a while. It is called the Rasselbock and will probably not make it into the next launch but since I love the device so much I have some top-secret recordings of what that little guy can do.

It is basically an IDM/glitch-type effect unit with a lot of cool features. It supports sequenced effects like gate, stutter, etc. and keeps them synchronized to the beat. A killer feature is that it includes also a sequenced mixing unit. This sounds maybe a little bit bizzare but once you can play with it you will probably love it.

All of these songs were made in about 5 minutes and are very cheap. Anyways it is a lot of fun to take any sort of instrument (like a metronome) and route it through the Rasselbock.

ActionScript 3 Vorbis Encoder

Vorbis Encoding TimesAs 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.

Water with Pixel Bender

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.

8bitboy on steroids

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.

Tweening and object pools

Some days ago I was writing a tween engine for our library here at Hobnox and when I was comparing it with the other ones out there which are quiet popular (Tweener, TweenLite) I was pretty surprised that my engine was performing about 10fps faster than TweenLite when tweening 1000 objects. It was 40fps for me, 28fps for TweenLite and 14fps for Tweener. It is not only faster but the memory usage is constant and small — on a Mac it was constant 11mb for my engine versus up to 22mb for TweenLite for instance.

Since I am currently not allowed to post the source-codes I want to talk a little bit about the ideas behind the engine.

Continue reading ‘Tweening and object pools’

ActionScript 3 optimization techniques

If you attended my session about bytecode inlining at FITC Toronto you might remember that I said I have a document covering a lot of common optimization techniques.

After talking to so many of you and getting nice feedback I decided to release it in a state which is a work in progress.

My main idea is still to put this into a Wiki so everybody can share his or her knowledge. Since I am pretty busy the next weeks I do not know when this will happen so for now I hope you get some use out of the PDF.

Confusion (AS3 Remix)

This movie requires Flash Player 9

This little remix has been created using the Hobnox AudioTool. For the recording I used Audacity which is the reason why it does not sound very saturated — there is something wrong with my settings.

The mix itself is quiet simple but the 303 pattern is not 100% accurate I think. Anyways I love that sound. Remember the whole audio data is calculated realtime in AS3 (44.1khz, 16bit, stereo) …and I had to use my crappy laptop touch-pad while performing ;-)

The original song is “New Order - Confusion (Rave Mix)” which is also part of the soundtrack from the first Blade movie.

Hello As3c!

A little sneak preview for a tool I am currently working on. What you can see is inline assembler instructions in between ActionScript 3 code. You can also place breakpoints and debug your code like you expect it.

The tool has also some other options that can be very helpful. Stay tuned — once it is robust and nice I will let you know for pure low-level fun and optimizations.

Hello world!


__asm(
'.fun:',
Op.findPropertyStrict('public::trace'),
Op.pushString('Hello World!'),
Op.callPropertyVoid('public::trace', 1),
Op.jump('.fun')
);

Would it not be great to write that inline ASM in ActionScript 3 while being able to maintain full debugging capabilities? I think so ;). By the way I hope you noticed that Nicolas just revealed awesome news about future haXe additions.

Hydra

The keynote at Adobe MAX at Chicago just finished. Get your hands on Hydra now!

via Kevin Goldsmith

I am currently reading through the Hydra manual. Actually it is kinda sad again. It is cool BUT the cool stuff is not available in Flash. Anyways I thinkwe can squeeze a lot of nice effect out of this anways.

My very first Hydra filters:

kernel BlendModeADD
{
  parameter pixel4 intensity;

  void evaluatePixel(in image4 source, out pixel4 result)
  {
    pixel4 in_pixel = sampleLinear( source, outCoord() );
    result = in_pixel + intensity;
  }
}

Here is another one:

kernel ColorMatrixFilter
{
  parameter float4x4 matrix;

  void evaluatePixel(in image4 source, out pixel4 result)
  {
    pixel4 in_pixel = sampleLinear( source, outCoord() );
    result = in_pixel * matrix;
  }
}

I think pure AS3 developers will like this syntax ;)

Update: Here is a simple sharpen filter. Check out the two techinques. I think both are completly wrong but it works. Time will definitly tell how to use this proper.

kernel Sharpen
{
    parameter float strength;

    void evaluatePixel(in image4 source, out pixel4 result)
    {
        int i;
        int j;

        float2 coords = outCoord();
        pixel4 s = pixel4( -strength, -strength, -strength, -strength );
        pixel4 total = pixel4(0,0,0,0);
        float factor = 8.0 * strength + 1.0;
        pixel4 f = pixel4(factor,factor,factor,factor);

        for ( i = -1; i <= 1; i++ )
        {
            for ( j = -1; j <= 1; j++ )
            {
                pixel4 current = sampleLinear( source, coords + float2(i,j));

                if ( i == 0 && j == 0 )
                {
                    total += f * current;
                }
                else
                {
                    total += s * current;
                }
            }
        }

        result = total;
    }

    /*
    void evaluatePixel(in image4 source, out pixel4 result)
    {
        float2 coord = outCoord();
        pixel4 tL = sampleLinear(source, coord - float2(1,1));
        pixel4 tM = sampleLinear(source, coord - float2(0,1));
        pixel4 tR = sampleLinear(source, coord + float2(1,-1));
        pixel4 mL = sampleLinear(source, coord - float2(1,0));
        pixel4 mR = sampleLinear(source, coord + float2(1,0));
        pixel4 bL = sampleLinear(source, coord - float2(1,-1));
        pixel4 bM = sampleLinear(source, coord + float2(0,1));
        pixel4 bR = sampleLinear(source, coord - float2(-1,-1));
        pixel4 mM = sampleLinear( source, outCoord() );
        pixel4 s = pixel4( -strength, -strength, -strength, -strength );
        float ms = 8.0 * strength + 1.0;
        pixel4 up = pixel4(ms,ms,ms,ms);
        result = s * tL + s * tM + s * tR + s * mL + s * mR + s * bL + s * bM + s * bR + mM * up;
    }
    */
}

Update 2: More hydra examples.




Close
E-mail It