Abstraction/Application


Building abstractions is done by starting with a concrete object and making variable one of its part. If you abstract a part which appears explicitly in the expression, this part will become variable. If the part does not appear, nothing happens thus giving as result a constant function, that is a function which gives always the same result whatever is the argument.

Technically, the abstraction process is based on a occurrence detection mechanism which allows to detect where the object one want to make variable appears and replace it with a new variable.

They are currently two occurrence detection mechanisms built in the system:

- A strict occurrence detection mechanism for complex objects, that is more complex that a single note. In this case the occurrence detection mechanism only match objects which are the same that means which are syntactically equivalent. This strict occurrence detection mechanism works for all objects more complex than a single note: that is SEQ, MIX, TRANSP... objects but also abstractions. It means that an abstraction used in an object can be later itself abstracted and replace by a new one.

- The abstraction mechanism for simple notes is less strict. It means that a note can be abstracted in another note even if they are not exactly the same, that is to say if they don't have the same pitch, velocity, duration or channel. For example:

- abstracting a note with pitch 60 in a note with pitch 72 will result in a function which transpose by 12 (the difference between 72 and 60).
- abstracting a note with duration 1 second in a note with duration 2 second will result in a function which expand by 2 (the multiplicative coefficient between 1 and 2).

For notes, the difference in pitch will result in the creation of a transposition operation, the difference in velocity will result in the creation of a attenuation operation, the difference in duration will result in the creation of a expand operation and the difference in channels will result in the creation of a channel shifting operation.

This abstraction mechanism only works for notes with the same colors. For example abstracting a blue note in a red note will give a constant function as result.

Abstraction and applications can also be defined by some rules or in the builder.