Tag Archive for 'opensource'

AS3V

At the end of my FOTB session I wanted to show you my latest tool called AS3V. Time was short and there was a small glitch so I could not show it. But now I can explain what AS3V really is without having to rush.

AS3V is basically a tool that can check for syntactical correctness. It will do with your code what a compiler does but it keeps formatting metadata. That way it can generate an XML skeleton of your code and apply rules on the XML.

You can have a look at the first output AS3V produces here. The original source code is included in the comment at the top.

As you can see it will be possible to force coding standards for instance and to warn if code could be optimized. I hope that it will be possible to have a first version of a stable parser soon. ANTLR is still giving me a lot of trouble but it is the first time for me working with such a tool as well.

PixelBender Runtime Compilation

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.

AS3C — take a look inside

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)

Sound.extract() rocks!

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 :)

Pratique d’ActionScript 3

We really have a premiere this time. Thibault Imbert just released his book “Pratique d’ActionScript 3″ for free.

The story behind this is pretty sad but I have to say this is an awesome move from Thibault. It is about 1000 pages and took more than a year of work.

So if you are French you definitly have to check it out. And do not forget to donate some bucks to support Thibault if the book is useful for you!

I am a FlexSDK contributor

Today I submitted my first patch to the FlexSDK after becomming a contributor. Lets see how this all will work in the future. It feels like I am working for free and fixing bugs that Adobe should work on but in several cases it is so much easier to just do the stuff and fix it yourself in 5min instead of writing 2h emails. Although I am not so happy about it.

Getting the Flex SDK to work is pretty easy if you manage several hurdles. It is quite cool to debug the ActionScript compiler while compiling your project.

The next thing I want to fix is the Bindable meta tag. [Bindable] in ActionScript projects is a pain if you do not compile with the flex.swc library and there is no reason for the compiler to embed the overhead of creating event dispatchers all over the place.

We are here already using “our” new compiler. Again it will be quite interesting to see how all this works out with Adobe and how they will judge about feature submissions.

AS3 compiler open-source: the logical consequences

With the release of the Flex 3 SDK the ActionScript compiler (ASC) became open-source as well. As you know I am working on my own “compiler” to inline bytecode directly with ActionScript. My approach is a post-compile compiler because I wrote it while the ASC was still closed source and ther was no way to do that different.

I still like the approach but it is of course not the best way. The only logical consequence now is to write a patch for the ASC and add some new keywords to it. This would be also easier than what I have to do currently because I am working with bytecode only and the compiler is half a compiler and half a virtual machine. I think it would be great if a community starts to evolve around the SDK and builds a version with more advanced features. Nicolas?

What the FUI?

FUITalking about FUI. What is FUI? It is a framework for fast device GUI creation. This means it does not imply a fancy ComboBox or stuff like that. Sliders, Knobs, Triggers and LEDs is what FUI is about. Originally André Michelle had the idea to create a tile-based and skinable system which uses a simple editor that outputs you a file. You load the file, connect the parameters with your visible elements and that’s it.

Now we are getting closer to a final version and this is why I want to show a little preview. It looks currently not very attractive but that is what the skins are good for. So to get the idea imagine you have a filter. This filter has a parameter like gain. This parameter goes from 0 to 0.5. The Parameter framework André already built allows you to do anything you want in a clean and easy way using new Parameter( new MappingNumberLinear( 0, 0.5 ). Now to change this parameter you can connect it to a FUI element like fui.connect( 'gainSlider', gainParameter ). The user will see a slider he can drag around, you saved a lot of work and can concentrate on the fun part (…the filter!).

The example is built using the following code:
[as][SWF(width='288',height='384',backgroundColor='0xeeeeee',frameRate='255')]
public class FuiTest extends Sprite
{
private const param0: Parameter = new Parameter( new MappingNumberLinear( .25, .75 ), .5 );
private const param1: Parameter = new Parameter( new MappingBoolean(), false );
private const inter0: InterpolationLinear = new InterpolationLinear( new MappingNumberLinear() );

private var point: ControlPoint;

public function FuiTest()
{
param0.addChangedCallbacks( onParameterChanged );

inter0.addControlPoint( new ControlPoint( 0, 0 ) );
inter0.addControlPoint( point = new ControlPoint( .5, .5 ) );
inter0.addControlPoint( new ControlPoint( 1, 1 ) );

var fui: Fui = Fui.build( ByteArray( new FURNACE ) );

fui.connect( ’slider0′, param0 );
fui.connect( ’slider1′, param1 );
fui.connect( ’slider2′, param0 );
fui.connect( ’slider3′, param0 );

fui.connect( ‘knob0′, param0 );
fui.connect( ‘knob1′, param1 );

fui.connect( ‘label0′, new Formatter( ‘P0: %04.2f, P1: % 4i’, param0, param1 ) );
fui.connect( ‘label1′, ‘Just a label’ );

fui.connect( ’switch0′, param1 );
fui.connect( ‘trigger0′, param1 );

fui.connect( ‘interp0′, inter0 );
fui.connect( ‘interp1′, inter0 );

fui.x = 64;
fui.y = 64;

addChild( fui );
}

private function onParameterChanged( p: Parameter, old:*, newV:* ): void
{
point.x = p.getValue();
}
}[/as]

It is easy, clean and will save you (and us) hours of boring stuff. The framework is designed in a way that a skin can do whatever the developer wants. Currently we are missing some of the last components and then of course an editor written in AS3 using AIR.

Update: I just added Group support. This way you can connect a Parameter that is using MappingValues with a set of SwitchButton objects for instance. You can connect any set of values this way with any set of components. It looks like this:

[as]private const param2: Parameter = new Parameter( new MappingValues( [ 'FUI', 'GROUPS', 'EXAMPLE' ] ), ‘FUI’ );
//…
fui.connect( ‘label1′, new Formatter( ‘P2: %s’, param2 ) );

var group: Group = new Group( fui );
group.addComponent( ‘group0′, ‘FUI’ );
group.addComponent( ‘group1′, ‘GROUPS’ );
group.addComponent( ‘group2′, ‘EXAMPLE’ );

group.connect( param2 );[/as]

popforge sprintf

The upcomming FUI framework needs strong string formatters to bind parameters on labels for instance. Using the sprintf syntax is easy and very powerful in that case. Just imagine you can format and bind your parametes with labels in one easy step like fui.connect( 'label', new Formatter( 'Volume: %.2f\nBPM: % 4i', volume, bpm ) );. Fantástico!

By the way. There is already a great ActionScript 3 version of sprintf out there developed by Manish Jethani. Our version follows the specs a little bit closer (e.g. not displaying 0 for 0-precision integers), supports more specifiers (eEgG) , the asterisk for width/precision and we have type length plus nice error reporting (if you are not familiar with the syntax).

So that as a side-node — FUI is getting closer.

Furnace format

There was a quiet additon to the popforge repository. It is our own file format to put your library in a single file. Basically it is just like a zip file. The format is built buy a header, item headers and items. This way it is very easy to navigate through the file and also allows easy streaming access.

At the end it is just a container format that is simple to use. There is a prototype AIR GUI to create the files and then you need one line to transform the file into a simple furnace library which gives you access to all your files again.

I appended the file specifications to the FurnaceFormat.as file for now. Any suggestions are welcome. Checksums are one thing we definitly want to include in the next version.




Close
E-mail It