Skip to content

Nodes


The core aim of the IVLS framework is to cover the needs of event-driven features comprehensively, proposing that all feature designs can be represented with a simple, consistent design pattern (or abstraction) called the node.

A node is a block of code that represents a software feature. Since our features are event-driven, nodes contain snippets of code which execute in response to those events, and we refer to them as callbacks.

Representing our software features as nodes allows us to ensure our code is readable and testable by drawing boundaries between every feature; furthermore, representing event responses as callbacks within those nodes allows us to communicate what events the feature responds to.

Writing Features With Nodes


Let's take a look at how this might manifest in our code. The most basic form nodes take is the following structure. Let's say we have a node called Harmonize:

node Harmonize:
    { callbacks would go here }
end node

You'll notice it's quite sparse; this feature doesn't currently do anything in response to any events, because it has no callbacks. Nevertheless, for syntactical purposes, it's important to understand the above node is still considered a valid by IVLS, even if nothing is in it.

Let's add a few callbacks:

node Harmonize:
    cb Init:
        { Code here would execute in response to the instrument loading }
    cb CC:
        { Code here would execute in response to MIDI CC changes }
    cb TransportStart:
        { Code here would execute in response to the DAW playback starting }
    cb NoteOn:
        { Code here would execute in response to incoming nodes }
end node

The structure of this node illustrates for us clearly: the Harmonize feature executes code when the instrument loads, when MIDI CC values change, when the DAW begins playback, and when notes are played.

NOTE: The Init, CC, and TransportStart callbacks will automatically execute in response to those events. However, the NoteOn callback is a special callback that requires some extra setup in order to execute. This will be explained properly in Unit 2 - Playback System.