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.

Comments: Post a Comment

<< Home

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