Archive for the ‘Projects’ Category

20100303 Seen, gone.

Seen, gone.” is my first (serious) incursion in Android development. Yeah!

As the description says:

Take a picture, watch it morph into something different – yet related to its true origin. And before you can blink twice, it’s gone, destroyed by the very same hands that created it.

To escape from the usual demoscene non-interactive demonstrations, I decided to do something interactive but that still used a bit of processor power, so that I could see what could the platform do. I had already tried to do some audio stuff, but the results were a bit disastrous. I might come back to that field again; maybe I will be more inspired or I will know how to do things ‘the proper way’ and it will end up being a more satisfying experience.

For this, I began using Canvas and only integer math to speed things up but the results were horrible; using Canvas for this was just too much and there weren’t available cycles for anything else. It was unacceptably jerky. I even showed the app to my favourite betatester and he told me that he would uninstall the application immediately.

Since I was determined to improve things, I watched the mighty session by Chris Pruett at past year’s Google IO and understood why things weren’t quite working the way I expected them to do. After much cursing myself for not having watched the presentation before, I replaced Canvas with OpenGL ES –in which I still miss good old immediate mode, but hey… it’s way faster!– and float calculations (to my surprise, you can even afford a few float operations!), plus reorganized pretty much everything, and rewrote the rest. Core calculations could probably be optimized with native C code but I didn’t want to limit myself to non-portable code yet. Although… are there any Android devices which are not ARM based? Heh!

It’s been a very instructive experience; I’ve learnt a lot doing this –the Garbage Collector and I have become almost close friends, so to say– and obviously it will help me to create more Android applications in the future.

But in the meantime, there’s another demo waiting to be finished!

And yes, this app is what I wanted to finish a couple of days ago, just in case you missed that post.

20100209 Breakpoint demolog, days 1-7

So the quest is set, the aim is clear: create something for Breakpoint 2010. There won’t be another opportunity; not at least under the Breakpoint umbrella.

The organizers have expressed publicly they don’t wish to organize yet another edition of nowadays biggest demoscene event, so it’s now or never! (At least until a new event this good takes off).

I already have had stuff of mine shown in their big screen. But that was before the true Big Screen, with capital letters. The 70 square meters one. I must release something, I said to myself.

Of course, this means that in a way, I’m going to break my own self-imposed rule (I will release things when they are done), but I’m working in a slightly pressurised scenario in order to finish the demo before setting off for the airport.

I have decided to keep a somewhat sporadic short demolog to keep people informed of what I’m doing, trace’s style. Hopefully it will help/force me to do things, daily, so that I don’t slack or procrastinate, and maybe you may help me too when/if I get stuck somewhere ;)

I’ll keep things short –this is probably going to be the longest post in the series– so that writing here doesn’t starve me of time to code.

This is the current status of the project:

  • the theme is approximately set, but I won’t disclose it here
  • I’m working on converting my on-its-own rudimentary OO-C synth (sorollet) to a bit less rudimentary C++ synth that can be embedded and interfaced, VSTi style, so that I can sequence everything from Renoise and play with parameters and settings in real time…
  • … and convert Renoise’s Song.xml (inside the .xrns file) to my own data file — kind of means recreating a simple tracker which follows Renoise conventions (Lines Per Beat for example). I have taken a look at the Song.xml file, extracting and using the relevant data seems easy, specially since Sorollet was already using a tracker style format.
  • So far I have managed to compile a VST plug-in in Linux. I had to solve several issues like having to compile for 32 bit while using a 64 bit OS, because Renoise is 32 bit too, gdb not willing to cooperate most of the times, the VST SDK docs being scarce and incomplete and not ready for Linux and etc, but I’m slowly progressing. Now I have a basic synth that can play sines or triangles, and transpose octaves. Awesomeness!
  • This means I’m not using an mp3 this time. Could this fit into an intro? Maybe, but I don’t want to sacrifice code readability in order to make it fit into an intro… I’ll be more than content with making a demo!
  • I need to find a way of producing a working Windows executable. Sadly, party organisers won’t allow a non-Windows .exe to enter the demo compo. Big BOOOOOOH for them. I have thought of different solutions, the easier is to install mingw in a VirtualBoxed Windows I’ve got, recompile my sources there and run the exe in my main machine, using wine. But I still have to try that, and I hope it works in Windows Vista :-S
  • I still haven’t thought about the visual part, I fear I’ll have to script it as in ye olde times –no time for writing a visual timeline manager–, but I will probably use Lua to alleviate the pain.

Complimentary screenshot:

Sorollet VST

More later.

20091117 Delicatessen v2

Let me introduce Delicatessen v2, the new version of my WordPress plug-in for finding out who’s bookmarked your posts in delicious.com

It has taken a bit too long to produce this version, but it at last behaves like a nice netizen, and won’t spam delicious.com with too many queries in a very little time, therefore you won’t get banned ;)

Delicatessen

More info and downloads in the Delicatessen page.

20091102 SyHi: my minimalistic syntax highlighting plug-in for WordPress

I had been using Code Snippet for a year, or a couple of years (I can’t really remember), and was more or less happy with it. Apart from the fact that it didn’t preserve some stuff properly, like double dashes and quotes. So then I tried adding another plug-in to the mix, Preserve Code Formatting. But both at the same time didn’t work out as I expected hoped.

The solution?

I made a new plug-in. It’s very minimalistic, starting with its name: SyHi.

How does it work?

The problem with other plug-ins is that they apply their formatting and then let WordPress continue modifying the posts’ text. That’s a totally bad idea, and that’s why quotes and dashes were systematically altered. On the other hand, this little clever plug-in takes the code blocks apart, sets them aside while leaving placeholder text where they were, and when WordPress has finished with all its filtering and texturizing, SyHi replaces the placeholder texts with the preserved, syntax highlighted beatiful pieces of code that the author entered.

The resulting code not only is nice to look at, but can be copied and pasted into a compiler and it will work with no modifications at all. No more please replace em dashes with double hyphens because WordPress modified the snippet’s output…: your blog readers can now simply copy and paste!

Alphatesters needed

So far I have tested SyHi with a test blog and this blog too. It looks fine, but I would be more than happy if somebody else wants to have a go at testing it. I would even add you to the Thanks section!

Unfortunately, the plug-in is not yet available in the wp-plugins directory; I’m waiting for them to approve my request so that you can install it from within the plugins admin page.

Plug-in page at WordPress directory: SyHi. You can also clone the SyHi github repository or download the latest version from there.

Samples

So you don’t believe me when I say this plug-in works great?

Using Python

noise_output = wave.open('noise.wav', 'w')
noise_output.setparams((2, 2, 44100, 0, 'NONE', 'not compressed'))

for i in range(0, SAMPLE_LEN):
        value = random.randint(-32767, 32767)
        packed_value = struct.pack('h', value)
        noise_output.writeframes(packed_value)
        noise_output.writeframes(packed_value)

noise_output.close()

What about php?

class SyHi
{
        protected $code_blocks;
        protected $geshi_instance = null;

        public function __construct()
        {
                // Execute pre and post process functions before and after each post content is processed
                add_filter('the_content', array(&$this, 'pre_process'), 2);
                add_filter('the_content', array(&$this, 'post_process'), 1000);

                // Same for each comment
                add_filter('comment_text', array(&$this, 'pre_process'), 2);
                add_filter('comment_text', array(&$this, 'post_process'), 1000);

                // Add the css stylesheet link to the <head>
                add_action('wp_head', array(&$this, 'add_css'), 1);
        }
}

OK and what about C/C++?

void luisita_reportErrors(lua_State *L, int st)
{
    if (st != 0)
    {
        std::cerr << "ERROR -- " << lua_tostring(L, -1) << std::endl;
        lua_pop(L, 1); // removes error message
    }
}

As you can see, double dashes are being respected, quotes are kept as they are, and code is nicely highlighted. And if you’re still feeling skeptical, keep browsing posts in this blog, since all code snippets go through SyHi.

Update: added the link to the plug-in’s repository :)

Update 2: let me clarify something: this plug-in can beautify snippets in pretty much every programming language you can think of, thanks to the huge language support provided by GeSHi. I have shown you only three examples as a simple demonstration, but you can even show Z80 assembler code!

The full list of supported languages is in the left column of the GeSHi website, under the Supported Languages header. Heck, it even has support for a language called BrainFuck!

20090716 “escena.org dentro v2″ sources released

Escena.org dentro v2

So here’s the last installment of my demoscene sources: escena.org dentro version 2. It was done for past year’s Inspire democompo and it won (incidentally, there weren’t any other entries in the compo but hey, it’s not my fault! :P).

This demo used a different approach; instead of building a whole scaffolding of C++ classes I just wrote some glue code with C++ in order to be able to draw something with OpenGL, and scripted everything else using Lua. It was also a bit of a benchmark. The result isn’t bad, given my lack of experience with Lua :)

Here’s the HD video (and here’s on vimeo, if you prefer it to youtube), and finally, here are the sources.

PS: The count down goes on to 1, and…