Tasty eel

A few posts ago I mentioned how I had to remove the scripting in HourGlass, that was based on Qt’s scripting capabilities, because of threading related problems. I speculated on the possibility of perhaps changing the scripting to use the Lua language. However, some experiments done on that proved out to be somewhat discouraging. Lua isn’t entirely trivial to embed into C++ without stability and memory issues. This isn’t a criticism of Lua as a whole, simply a statement that it was getting too complicated for me to handle for something like this. After all, HourGlass doesn’t require extremely advanced scripting capabilities, rather just the ability to take in some numbers (like the parameter values of the grains/fragments), calculate something based on those, and get those new results back to the C++ side for the DSP and other things.

Considering that extreme sophistication wasn’t really required, I looked again at the “eel” evaluation engine included in the Cockos’ WDL libraries, and after some testing decided that is the way to go for now, and Qt Script has been entirely eliminated from HourGlass code.

An example script for overriding the grains transpose property :

tab[0]=0.0;tab[1]=5.0;

tab[2]=7.0;tab[3]=12.0;

transpose=tab[count % 4]-12;

“transpose” and “count” are special variables initialized on the C++ side, that the scripts can read and manipulate. “transpose” is obviously the transposition amount on the grain and “count” is increased on the C++ side each time a new grain needs to be generated. So what this script does, is that it transposes the grains in a cycle of 4 pitches and finally also transposes everything down by 12 semitones.

Lots of thanks to Justin Frankel/Cockos for making eel2 available! I could obviously imagine all sorts of enhancements it could use, but for simple use cases it does the job very nicely to add some scripting capabilities. (I also know eel isn’t strictly a “scripting engine”, but nevermind that, ok…)

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s