by Daniel Temkin
4. January 2009 12:38
Here is the complete list of commands currently implemented in Velato. For an introduction to the language, see the previous blog post.
List of Commands
All statements start with the command root, followed by one of the following commands. Intervals are from the currant command root note.
| command | second note | third note | followed by... |
| Change Root Note |
Major 2nd |
|
New root note |
| Let (assignment) |
Minor 3rd |
|
Variable as single note, then expression |
| Declare variable |
Minor 6th |
|
Variable as single note, then type |
| Blocks |
Major 3rd |
|
|
| While |
|
Major 3rd |
|
| End While |
|
Perfect 4th |
|
| If |
|
Perfect 5th |
|
| Else |
|
Major 6th |
|
| End If |
|
Major 7th |
|
| Special Commands |
Major 6th |
|
|
| Print to screen |
|
Perfect 5th |
Expression to print |
List of Other Expressions
If an operation is expecting an expression, the list that follows will determine what expression is interpreted. Expressions do not start with the command root note, but all intervals are still determined from it.
Expressions don't differentiate between perfect/diminished, major/minor, so that they can be diatonic to the scale used in the rest of the command. For example, if you're in C, this helps you avoid having a progression like C E C Eb, which could sound random or unmusical, depending on context. The programmer can pick which of the two intervals fits the song better.
| expression | first note | second note | third note | followed by... |
| value |
3rd (maj/min) |
|
|
|
| variable |
|
2nd |
|
Name of varaible (since note) |
| pos. (+) int |
|
5th |
|
Single note for each digit, ending with Perfect 5th to mark end of number |
| neg. (-) int |
|
3rd |
|
Single note for each digit, ending with Perfect 5th to mark end of number |
| char |
|
4th |
|
Char as ASCII int: single note for each digit, ending with Perfect 5th to mark end of number |
| pos. (+) double |
|
6th |
|
Single note for each digit, first Perfect 5th to mark decimal point, second Perfect 5th marking end of number |
| neg. (-) double |
|
7th |
|
Single note for each digit, first Perfect 5th to mark decimal point, second Perfect 5th marking end of number |
| conditional |
2nd |
|
|
|
| = |
|
2nd |
|
|
| > |
|
3rd |
|
|
| < |
|
4th |
|
|
| NOT |
|
5th |
|
(also used for NOT < (indicating greater than or equal to) and NOT = |
| AND |
|
6th |
|
|
| OR |
|
7th |
|
|
| procedural |
6th |
|
|
|
| grouping |
|
6th |
|
|
| ( |
|
|
6th |
|
| ) |
|
|
2nd |
|
| math operation |
5th |
|
|
|
| simple |
|
5th |
|
|
| + |
|
|
3rd |
|
| - |
|
|
2nd |
|
| * |
|
|
5th |
|
| / |
|
|
4th |
|
| % (mod) |
|
|
6th |
|
| exponential / other |
|
7th |
|
|
| power |
|
|
2nd |
|
| log |
|
|
3rd |
|
The only interval without a choice is a 4th. There is no augmented 4th, a tritone is always interpreted as a diminished 5th.
Each number of half-steps is interpreted as a unique interval -- so that there are no enharmonic intervals that may lead to ambigous commands. If an expression requires a 4th, only the Perfect 4th can be used, not an augmented 4th (tritone), which is considered a Diminished 5th in Velato. If a 3rd is required, either the Minor 3rd or Major 3rd can be used.
This is the interval list used by Velato:
| 2nd |
Minor 2nd |
1 half-step |
| 2nd |
Major 2nd |
2 half-steps |
| 3rd |
Minor 3rd |
3 half-steps |
| 3rd |
Major 3rd |
4 half-steps |
| 4th |
Perfect 4th |
5 half-steps |
| 5th |
Diminished 5th |
6 half-steps |
| 5th |
Perfect 5th |
7 half-steps |
| 6th |
Minor 6th |
8 half-steps |
| 6th |
Major 6th |
9 half-steps |
| 7th |
Minor 7th |
10 half-steps |
| 7th |
Major 7th |
11 half-steps |
Types:
When a type needs to indicated (such as in a variable declaration), this table shows how they are indicated:
| type | note |
| int |
2nd |
| char |
3rd |
| double |
4th |
Numbers:
Individual digits in a number are determined by half-steps from the command root, excluding the Perfect 5th.
In C, these are the numbers tied to each note:
| c# |
d |
d# |
e |
f |
f# |
g |
g# |
a |
a# |
b |
| 0 |
1 |
2 |
3 |
4 |
5 |
- |
6 |
7 |
8 |
9 |
Characters:
All characters are entered by their ASCII int. You can find a table of ASCII values here.
That's pretty much it. There are a few commands/expressions not yet implemented in Velato -- when they become available, I'll add them to this post.
The next post will be a walk-through of how to write programs in Velato.