Announcing Zajal, a new Ruby-based creative coding language!

Hi everyone!

First time poster, long time OF user. I’m really excited to share with the community the work I’ve been doing over the past few months. I’ve been building a new creative coding language based on Ruby and powered by OF that’s designed to make it as easy as possible to go from an idea in your head to working code on the machine. I waited until the language stabilized a bit before announcing it, but without further ado, OF community, meet Zajal!

Here’s a quick run down of some of the more interesting features.

Live Coding
Any changes you make and save to a running sketch are visible instantly in the sketch window. This makes it possible to sculpt your code as you go and tweak it as you see fit. Here’s an example of it in action.

http://vimeo.com/21720233

Clean Syntax
Being based on Ruby makes Zajal very elegant to begin with, and the syntax I’ve built on top of Ruby strives to be as clean and readable as possible. This is an example of the canonical brownian motion sketch.

openFrameworks Functionality
Internally, Zajal is built on OF 7, and is planned to support everything OF does. The difference is you get all that power through a clean and flexible language that’s completely live. At the moment, support for graphics, images, fonts, math, serial and video is stable, with graphics being the most complete and tested. Support for Arduino is working, but still a bit crashy. Live coding still applies, which means you can live code your hardware! This is an interactive video installation made by Haitham Ennasr that uses Zajal’s video and Arduino support to drive it.

http://vimeo.com/23137157

Package Manager
Not 100% finished yet, but I’m building Ruby’s package manager, Ruby Gems, into Zajal to make sharing code super easy. It has the added benefit of exposing Zajal programmers to the whole repertoire of Ruby code in the Gems repository! There’s some really great stuff out there. This is an example of Zajal sending OSC messages to Super Collider to play tones. Zajal doesn’t support OSC natively, but I was able to pull in a Ruby Gem to do just that (lines 1 and 2).

http://vimeo.com/23617725

I’m also working on a way to incorporate OF’s addons into the Gems system.

Lack of an Editor
Zajal is distributed as an interpreter, which means you can write code in whatever text editor you like. XCode, TextMate, Coda, TextWrangler, BBEdit, vim, emacs, ed, cat…whatever floats your boat!

There’s a whole bunch more already in there, and even more that I have planned. I just wanted to quickly throw out the most prominent features to you all. What’s available now was built as my MFA thesis at the Design+Technology program at Parsons The New School for Design, and I’m going to spend my time post graduation building the rest out. Reactions while testing have been positive, and I really believe in this language. Using OF on this project has been a blast, and I’ve learned more about it than I ever thought I would! It’s really a testament to how good this library is that it could be repurposed into something like Zajal. I’m super excited to share it with this incredible community and to get your feedback on it! If you’re interested, follow the links below, download the interpreter on the main site, check out the examples, play around with it and let me know what you think!

http://zajal.cc/ - Main site
https://github.com/nasser/zajal/ - Code repository
http://docs.zajal.cc/ - Documentation (in varying states of completion)
http://sketch.zajal.cc/ - Sketch book with example code
http://forum.zajal.cc/ - Forums (a bit lonely right now)
http://blog.zajal.cc/ - Developer blog
http://amt.parsons.edu/mfadt/thesis/2011/zajal/ - Zajal’s page on the Parsons thesis site
@zajalcode - Twitter mirror of the blog

Wow, that looks incredible. I will be sure to check it out. I’ve participated in some live-coding events where Max/MSP was the weapon of choice, and everybody used it for audio only, but I think it would be awesome to do live-coding in duos. One performer coding up the audio-part (in Max/MSP or supercollider for example) and the other taking care of the visuals. Zajal seems to be perfect for that kind of performances.

Is there already an audioReceived-method built in?

Duo live coding sounds awesome! You could have Zajal programmer’s sketch firing off OSC messages to a supercollider programmer’s server. With both the sketch and server changing live, that could be awesome!

I tried to work audio_received and audio_requested into Zajal a few months ago, but those methods are called from a different thread which caused the Ruby VM to freak out. I have a few ideas as to how to work around that. I couldn’t get to it by thesis time, but its definitely on the list and coming soon!

If the audio_received method would be implemented it would be possible to do live-coding of audioreactive visuals. Now that would be awesome :slight_smile: Please keep us posted!

hey nasser that looks great! i did some live coding audio reactive visuals using somehow modified python bindings for OF. are you using swig or some similar tool to generate the ruby bindings? with swig i remember having to use a -threads flag to enable ofSoundStream functionality.

i’ve uploaded the code in case it’s useful, it’s super messy and compiled for linux64 bits but perhaps it can give you some clues about the threads stuff:

http://github.com/arturoc/openFrameworks/tree/live-coding

and everything is in this commit:

https://github.com/arturoc/openFrameworks/commit/5a39261b93e7da586a0bb6b445d4b442093e030e

@daanvanhasselt I know! Super excited about the possibilities!

@arturo I hand coded the bindings. Since I was building an interpreter, I needed really fine control that SWIG or similar couldn’t give me. The OF live code stuff looks really interesting! Thanks for the heads up, I’ll look into it for sure. I have a large-scale threading strategy that I need to implement to get around some limitations in the current build and the audio_requested/received stuff will probably get fixed there.

I’m very excited in this project because I love Ruby too.
But unfortunately with Zajal Ruby and OF loose one big advantage (at least from my side as a linux-only-user): cross-plattformness.
I tried to compile it on linux with no luck :frowning:

Ha! Yeah, the current build won’t even work on Mac OS 10.5 let alone Linux/Windows. In the interest of time, I prioritized working demonstrable features over cross platform support for my thesis. It’s definitely on the list, though, so I wouldn’t say its a disadvantage of Zajal as a language, but a disadvantage of the current build.

If you’re interested in giving it a shot, we can talk about what would have to be done for it to compile on Linux. Let me know!

we definitely should! :slight_smile:

I’d love to be able to use this on Linux.

The idea was definetely there. Keep us posted on any kind of update you do on your project. Actually are you still working on it or you droped the idea? let me know.

rik

This looks promising :slight_smile: I am researching of live coding languages for my thesis project so i’ll be very happy to have a chat with you. I’ll contact you by PM.

@erikhuhvpa Definitely still working on it! Zajal isn’t getting dropped any time soon. I’m actually at an art+technology-center-in-Beirut developing it over the summer, so expect some exciting updates!

@Alejandro I’m sure we’d have a lot to talk about! PM me.