Wednesday, December 13, 2006


How can I create my own custom language to generate timed events? ( Part II )

In Part I I've shown how to define a simple custom language. Now I'll show how actions can be taken controlled by the custom instructions in the language.

Generating an Action

The Action component is used to generate an action when a certain parsing rule is matched.
The following schematic shows how to generate a Midi NoteOn event for each of the lines in the parsed text.

The rule defined to the right of the Action component is matched twice for the example text of:


Because the rule is matched twice, the Action component will send an event through the 3rd output also twice. Those two events will flow to a Midi event component which will generate two midi events. The inputs to the component are set to generate a NoteOn midi message with velocity 127 for the Midi note with the integer number parsed by the parsing components and delayed into the future by the number of seconds specified by the first parsed real number. The 2nd real number is ignored for now.

N60,2,1 = generate NoteOn message for note 60 at current time + 2 seconds
N64,1,3 = generate NoteOn message for note 64 at current time + 1 second

We also want to generate NoteOff messages. We can use the second parsed real to define the duration of the note. We can also actually connect the Midi events to a very simple sine wave generator to hear the result as in the following schematic:

Here is the schematic.

Now the meaning becomes:
N60,2,1 = generate NoteOn message for note 60 at current time + 2 seconds and a corresponding NoteOff message 1 second later
N64,1,3 = generate NoteOn message for note 64 at current time + 1 second and a corresponding NoteOff message 3 seconds later

We can use our custom language to define a group of midi notes or even a melody, chords etc. It's not the easiest way to edit a song but then again it is a very simple language that can easily be extended to include instructions to control parameters in a synth, like pan, cutoff, to generate triggers for visual animated events, to generate chords from custom chord instructions etc

Here is a more complicated example that demonstrates sequencing several synth parameters with a custom parser.

Tuesday, December 12, 2006


How can I create my own custom language to generate timed events? ( Part I )

The synthmaker parsing components allow for a custom language to be defined and actions to be taken controlled by the parsed text.

Defining a syntax

I'll start with a very simple example. The following schematic defines a syntax of the letter N followed by an Integer number, followed by a comma , followed by a real number, followed by another comma, followed by another real number.

Here is the schematic.

That syntax is defined by the components str>>int>>str>>real>>str>>real. The str components have an input to specify which exact string has to be matched. The int and real components output the parsed numbers. An example of a valid syntax would be:
The CustomParse component outputs a boolean to indicate if the parsed text has the correct syntax. It also has an input to trigger the actual parsing. To trigger the parsing all you have to do is click on the middle red square of the trigger button

Zero or more matches

Now if you try the following text:


the custom parser will fail giving a wrong syntax error as shown in the following screen capture:

That's because the syntax has been defined for 1 and only 1 match. To specify that we want several possible matches of our syntax we have to use the Kleene Star rule which means zero or more matches. The new schematic would be as follows:

Now we have a custom language with a simple syntax. In the next part I'll show how to convert those instructions into actions that generate Midi events.

Monday, December 11, 2006


About this blog

I've started this blog to answer questions I often get asked related to synthmaker.

For those that don't know synthmaker, I'd describe it as a Visual Programming development environment. It is currently mainly used for creating sound in the form of virtual software synthesizers but the whole framework has been developed to eventually grow into a more general Visual Programming development environment.

The next stage, already under development, is the implementation of a new Events engine.
The new engine makes it possible to create custom sequencers for controlling Midi events and general parameters with sub-sample precision allowing for full songs to be created within synthmaker without requiring an external host.

In the near future my entries in this blog will probably be related to the new Events engine as it is what I'm working on at the moment.

Please note that the new events engine is not part of the full version of synthmaker. It is still under development and will be made available through the experimental version of synthmaker called synthmakerX. The experimental schematics use the extension osmx rather than the normal osm and wont load in the normal version of synthmaker. At the moment only beta testers will have access to synthmakerX, also for now beta testers have to be synthmaker registered users.

This page is powered by Blogger. Isn't yours?