Forum rss-feed

Forum

Developers: Prototype open-source OSC EigenD agent available

STICKY

written by: geert

Hi everyone,

Given the current developer interest and barnone's motivation to dig into the code, Jim has spent some time creating a prototype EigenD agent that is able to output EigenD data streams directly through OSC.

This implementation is just a start and was quickly written in two days to bootstrap the learning process of users that wish to participate in the development. Its serves both as a documented example for creating agents as well as an initial step towards the OSC plans that we've been making. As time progresses, our OSC support will mature and the EigenD OSC protocol will be formalized in more detail, but this should give you an idea of the direction we're heading into. We've discussed various approaches towards how to handle the OSC representation over the network and have hit limitations of the network stack in the past due to the massive amount of performance data that the Eigenharp generates. This performance data is essential to the expressiveness of the Eigenharp and we obviously want to allow it to be exposed in as much detail as possible. The document named "OSC" that comes with this example agent briefly explains what we consider the best approach, it will mature as we further work on the OSC support.

The document named 'Roadmap' explains how to use this OSC agent and gives a high-level developer-centric explanation of EigenD's internal architecture. The source code is heavily documented and should make it easy to adapt towards any other functionalities that you might want to implement with an agent.

The source code can be found on GitHub in the 1.4 branch of EigenD. Here is a direct link towards the source of just the plg_osc agent:
https://github.com/Eigenlabs/EigenD/tree/1.4/plg_osc

More information about getting involved in EigenD development can be found on this wiki page:
http://www.eigenlabs.com/wiki/Developers/

Please realize that we have very limited resources to provide direct support to external developers as we're hard at work wrapping up the initial release of EigenD 2.0 and Workbench. We hope that this example will give you enough information to make EigenD development more accessible.

Take care,

Geert

written by: dhjdhj

Tue, 22 Nov 2011 03:23:04 +0000 GMT

@barnone I implemented my basic Max patcher a little differently and avoided that problem with empty string. I'm still using a single regexp to detect that empty string but may replace it with a simple max external if efficiency becomes an issue.

Here are some top-down pictures of what I did.

EigenStrings The Eigen.Alpha.In object produces MIDI NoteOn/NoteOff messages (same as midiin) and pitchbend which can be fed into either a VST or an external MIDI instrument. The GenericVST is part of my Live Keyboard Rig Manager (see my blog here for more info on that library)


Eigen.Alpha.In This accepts nicely cleaned up KeyDown/KeyUp events, converts them to Row/Col number format (not sure I'm going to keep that, but it has some uses) and then the row/col info is converted into MIDI note numbers for a guitar-tuning layout.

Eigen.OSCInput Here I extract the raw OSC packets and I'm using a regex to feed me either a valid key number or 0 if the empty string is found.

The data is sent into the Eigen.OSCProcessor

Eigen.OSCProcessor Here, I'm basically keeping track of what keys are currently down by using the coll object using the event stream number as the index and the key number as the value. This patcher ensures that only a single keydown event is generated no matter how long a key is held.

So far, it has been totally glitchless so I'm optimistic about the approach.
My next step will be to properly integrate the continuous data for individual notes. It will be pretty trivial to generate polyphonic aftertouch events by finding the associated note number for the current stream and packing that with the pressure value. I'm not sure yet how I'm going to package the left-right data.


written by: geert

Tue, 22 Nov 2011 06:13:59 +0000 GMT

@dhjdhj, "not working" is pretty vague, can you give the exact steps you did, what happened and in case of an error provide the EigenD log files in ~/Library/Eigenlabs//log

You did load the "blank" factory setup before executing those commands, as instructed in the Roadmap docs?


written by: dhjdhj

Tue, 22 Nov 2011 11:47:37 +0000 GMT

Fair enough and I should berate myself for having not provided better information. Basically, after typing in each command, the eigencommander said "ok" each time but after all was done, no OSC data ever appeared.


I will carefully log what I do today and report back. But yes, I loaded the blank patch, ran the eigencommander and executed the commands as described in the roadmap. I'll do it all again today and check the logs.


written by: dhjdhj

Tue, 22 Nov 2011 18:59:49 +0000 GMT

What's the appropriate way to determine initial velocity when a note is first touched? I notice that the pressure value is continuous so I'm concerned that if I just snapshot when the key is first touched, I won't get the intended velocity. Or does the hardware detect initial finger velocity and start with that value?

I haven't looked at the actual datastream yet for this, I was just thinking about it while at my regular job and started wondering about it.


written by: NothanUmber

Tue, 22 Nov 2011 19:42:54 +0000 GMT

Having a look at EigenD/piw/src/piw_velocitydetect.c gives the answer how EigenD does it, they don't seem to use just one value but calculate it based on a number of value samples and scale factors.

Btw., still did not get familiar with some of the "defensive programming" concepts used in EigenD at various places. Isn't this more confusing than copy'n'paste-mistake preventing?
e.g.:


sumx_=sumy_=sumxy_=sumxsq_=0.0;
x_=0.0;
sumx_+=x_;
sumxsq_+=x_*x_;
x_++;
sumx_+=x_;
sumxsq_+=x_*x_;
x_++;


written by: dhjdhj

Tue, 22 Nov 2011 19:55:31 +0000 GMT

Well, I figured that they would have to be capturing a range of values but that then begs the question of what's the right number of samples to capture so that there isn't too much delay/latency.

I guess I will parameterize it with the Max patcher that I did so as to experiment with it.

As for that code sample, I'm not a fan of multiple assignment, nor the use of underscores nor abbreviated variable names so I don't even want to look at that stuff (grin). In that vein, I just came across a new book via O'Reilly called "The Art of Readable Code" by Boswell and Foucher and although I've just briefly perused it so far, it has a lot of good advice for creating readable code.

Personally, I'm in the "Knuth: Literate Programming" camp and believe strongly that code should be readable like a book. As soon as I see things like "return" in the middle of a function, I just turn off completely (grin). I don't know why such fundamental tenants of top-down programming from the likes of Hoare, Dijkstra, Wirth, and others are just ignored completely these days.


written by: NothanUmber

Tue, 22 Nov 2011 20:28:08 +0000 GMT

Yes, some of the conventions are a little bit... "eigen" as we say here ;)
But in small at least you get the feeling that the persons writing this know what they do and the implicit guidelines (that we may like or not) are at least mostly consistently used (even the "copy'n'paste" pattern above happens too often to be an oversight).
And as soon as you "zoom out" and start to look at things at a larger scale there is much conceptional beauty to find :)


written by: dhjdhj

Tue, 22 Nov 2011 20:41:04 +0000 GMT

At this point, I am thilled to have the conceptual beauty of MaxMSP running the show....I've been wanting this since I first got my Eigenharp and I am hating every moment that I am not able to work on enhancing it :-)

I wonder how many people are interested in a Max based Eigenharp environment and whether it's worth having a separate forum dedicated to that approach. It would be great to share Max patchers, particularly if we can start building on each others' efforts.


written by: NothanUmber

Tue, 22 Nov 2011 21:28:14 +0000 GMT

Max has it's merits for sure. And imho EigenD and Max don't exclude each other. E.g. I could imagine that it would be nice to build an EigenD Max-agent at some point: An agent that loads a defined Max-patch (starting Max when it's not already running first). Then it communicates with the Max-patch at startup (e.g. via OSC with a Max-side "EigenD-interface"-subpatch) that gives configuration information like number of inputs/outputs of the patcher to the EigenD agent which instanciates a corresponding EigenD agent. All data coming to the EigenD agent is delegated (e.g. via OSC) to Max and vice versa.
So you could rapidly prototype agents in Max, use them in conjunction with the existing native EigenD agents, connect and configure it in Workbench and change it on the fly, while it's running in Max. (You would presumably only have to restart when you change input/output configurations).
Sounds interesting!

P.S.: The opposite should also be possible: writing an EigenD-agent wrapper patcher for Max that behaves like a subpatch from outside but really connects to a running EigenD system and instantiates a configured agent there or connects to an already running one and delegates data back and forth - so in this case the "plumbing" would happen in Max - many possibilities :)


written by: dhjdhj

Tue, 22 Nov 2011 22:18:10 +0000 GMT

I guess I still don't understand what can be done within the EigenD environment that could not be done natively with Max and so I have always seen Max (along with external synths, soft or hard) as a viable alternative/replacement, at least for the kinds of things that got me excited about the Eigenharp.

Now that I have Max working, I've just ordered a second base station so that I can work with the Alpha on a daily basis. No longer will it sit in the corner of my studio unused!!!


written by: dhjdhj

Tue, 22 Nov 2011 23:36:54 +0000 GMT

ok --- I deleted all the logs so as to start from scratch. Here are the steps I took

1) Started EigenD, which loaded my default setup (which is my original guitar setup + the OSC stuff which I was able to save the other day)
2) Loaded Max and the appropriate Max/Eigenharp processing
3) Play the eigenharp, everything works fine.

4) Closed Max
5) Selected the Blank setup in EigenD and loaded it
6) Opened EigenCommander and executed the commands (with a delay after the 'alpha manager create' command
7) Reopened Max and the patchers.
8) Nothing works --- no OSC arrives into Max

I have archived the logs and will email them to your support email address as I can't find any way to upload the archive into this forum.


written by: dhjdhj

Tue, 22 Nov 2011 23:51:38 +0000 GMT

Follow up --- after the failure above, I closed EigenD and Max.
I then restarted EigenD which reloaded by original setup again. HOWEVER when it was done, the lights on the bottom row did not turn on and when I run Max, I get no OSC input.

I then closed everything again and power-cycled the eigenharp base station. Everything then worked again with my default guitar setup.

I did not have to reboot my Mac.


written by: NothanUmber

Wed, 23 Nov 2011 00:01:19 +0000 GMT

Ah, EigenD and Max again :)
"In theory, practice and theory are the same; in practice, they are not" - so much insight in one sentence :P
Don't have much to add to what was already written, both are taylored towards different scenarios by default but are and stay (fingers crossed...) open enough to allow to do virtually anything. So no, there is virtually nothing you can do with EigenD that can't be done with Max - if you have the enthusiam to make this real.

Good to hear that you have fun, looking forward to your experiments! :)

*edit* ah, posts in between, perhaps I should reload my browser before posting ;) This sounds strange, hopefully support can help.


written by: dhjdhj

Wed, 23 Nov 2011 00:30:12 +0000 GMT

Hey --- I was pushing for Max support a year and a half ago --- nothing new from me (grin).

As for Yogi Berra, wonderful cliches but I think it's right that Max is a reasonable alternative (as opposed to additional) approach that will be far more accessible to many casual users.

I've been dabbling with the pressure, trying to find a reasonable way to detect an initial "velocity", not too happy with what I'm getting but then I decided to play around with mapping the pressure to CC7 (I'm still doing solo so not worried about chords yet) with a little non-linear scaling and I have to say it's very interesting to play sounds that way.

So much to explore, so little time!


written by: mikemilton

Wed, 23 Nov 2011 01:39:52 +0000 GMT

Max and casual are not words that strike me as ever being in the same sentence.

I'm heartened you are happily on your way.

My own course is not in that direction.


written by: natcl

Wed, 23 Nov 2011 17:03:57 +0000 GMT

I've been programming Max patches for almost 10 years now and I have to say the software evolved greatly in the last few years and is much easier to use than before. I can understand that it's not everyone's cup of tea, but musically it allows a freedom that is rarely seen elsewhere. Sometimes I have an idea and it's a matter of minutes to code in Max where if I had used a more common language like C or Python it would have taken me hours or days.


written by: dhjdhj

Wed, 23 Nov 2011 18:43:01 +0000 GMT

That's right --- and Max is used by a significant demographic in the arts world many of who have no technical training and they're certainly not software developers. Third party libraries (free and commercial) are available from a number of universities and independent vendors as well as from artists just making their stuff available to be shared.

Of course, it's also part of Ableton Live, which is another very significant demographic and many of those users spend a lot of time with control surfaces and other exotic devices. I bet a significant percentage of those users would be interested in the Pico (at least) now that it can be used directly via Max.

Version 6 which just came out recently is much enhanced, more accessible due to the explicit focus on making it easier for new users to approach, and is significantly cheaper than was 5.x. Exciting stuff!

(Just bought a nice MIDI Bagpipe softsynth from someone in Scotland to use with my Alpha --- off to the studio to play with it!)


written by: dhjdhj

Fri, 25 Nov 2011 13:56:23 +0000 GMT

Any luck figuring out why I couldn't get a blank setup to work? Were the logs I sent in of any help?


written by: dhjdhj

Fri, 25 Nov 2011 13:56:26 +0000 GMT

Any luck figuring out why I couldn't get a blank setup to work? Were the logs I sent in of any help?


written by: john

Fri, 25 Nov 2011 14:21:30 +0000 GMT

Hi David

I'm afraid the OSC Agent is not yet a supported part of EigenD - it's a prototype to assist people in learning to develop first and foremost. It may make it into a supported release soonish (most likely 2.1 or 2.2) but we really don't have the bandwidth to figure out problems with it at the moment - you'd probably need to instrument it yourself if you want to understand what is going on. Jim wrote it in two days and it has had no testing so it's really not what we'd call production code - it was written as example code for the developer community only.

John



Please log in to join the discussions