Velato

From Esolang
Jump to navigation Jump to search
Velato
Paradigm(s) imperative
Designed by Daniel Temkin
Appeared in 2009
Computational class Turing complete
Reference implementation Velato
Influenced by Piet
File extension(s) .mid

Velato is an esoteric programming language that uses MIDI files as source code. Programs in Velato are defined by the pitch and order of notes. Velato is intended to allow for flexibility in composition, so functional programs will not necessarily sound like random notes. There is a tendency for Velato programs to have jazz-like harmonies.

Language overview

The first note sounded in a Velato program is the "command root" note. All intervals are read from this note until a new command root is established. The command root can be changed between statements, to allow for more musical (or at least less repetitive) progressions. Notes played as chords are interpreted in the order the notes appear within the MIDI track, regardless of a zero duration between them.

Syntax

Commands

Command Intervals differentiate between major and minor intervals. Fourths and fifths are always perfect. Depending on the compiler used, other intervals return syntax errors or are ignored.

Command First note Second note Followed by / Notes
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 Expression
End While Perfect 4th
If Perfect 5th Expression
Else Major 6th
End If Major 7th
Special Commands Major 6th
Input Perfect 4th Variable to store string
Print to screen Perfect 5th Expression to print
Input Major 6th Variable to store string

Expressions

Commands can be followed by any number of expressions. Notes used for expressions don't differentiate between major/minor or perfect/diminished. To avoid ambiguity, no augmented intervals can be used. So a tritone is always interpreted as a diminished 5th, not an augmented 4th.

Expression First note Second note Third note Followed by / Notes
value 3rd
variable 2nd Name of variable (single 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

Types

Type Note
int 2nd
char 3rd
double 4th

Values

Values are expressed as base-ten digits in sequence, ending with a perfect fifth. For floats, there are two perfect fifths: one to mark the decimal, the second to end.

Digit Note
(ignored) unison
0 minor 2nd
1 major 2nd
2 minor 3rd
3 major 3rd
4 perfect 4th
5 diminished 5th
end marker perfect 5th
6 minor 6th
7 major 6th
8 minor 7th
9 major 7th

Examples

Hello, world!

This is a sheet music representation of one possible "Hello, World" program:

Keep in mind that the order the concurrent notes in this representation appear in the actual MIDI file will affect the program.

Compilers and Interpreters

External resources

See also