Musical notes

Musical notes is an esoteric programming language that uses notes as symbols. It was inspired by Velato, another music-based esolang, and brainfuck. Musical notes was invented by Tom Price-Nicholson in 2014. It is possible to create programs in Musical notes; however, more complex programs may take up a large amount of space.
== Syntax ==
Musical notes is based on, as the name suggests, musical notes. The pitch of the note determines its function. Musical notes behaves as if it has an instruction tape, like brainfuck, with a pointer that can move and be used to change the values of the instruction tape. At the start, the pointer is at position zero, and all cells are set to zero. The instruction tape is the same as the data tape in brainfuck.
=== Notes ===
The only notes used are the crotchet, minim, dotted minim and semibreve, with values of 1, 2, 3 and 4 respectively. These values are only relevant if the notes are being used to define numbers. Otherwise, the value of the note is mainly irrelevant. Other notes may be placed into the code, either as nulls or to make the tune sound better, but they will be ignored when the code is executed.
=== Staff and ledger lines ===
The bottom line on the staff (the five lines that the notes are placed on) represents the note E above middle C. The clef at the start is the treble clef. Musical notes uses two ledger lines, one below the staff (middle C) and one above it. It therefore follows that there are 13 pitches in musical notes, shown in the table below:
Pitch 	Position
Middle C	Bottom ledger line
D 	Between bottom ledger line and staff
E 	Bottom of staff
F 	Staff
G 	Staff
A 	Staff
B 	Middle of Staff
C 	Staff
D 	Staff
E 	Staff
F 	Top of staff
G 	Between top ledger line and staff
A 	Top ledger line
=== Line functions ===
The top five positions, D, E, F, G and A, represent numbers in base 5. The lowest line (D) represents units, the next line up (E) represents fives, the next line 25s, and so on. The note on each line represents how many of that position there are. An empty line means zero. The number shown by these five lines is represented by an X when defining the functions of the other lines.
The other lines are function lines, which correspond roughly to the function lines in brainfuck. An empty line means do not perform function, and a line with a note on means perform function. The exact value of the note usually doesn't matter, so long as it is one of the ones that is actually part of the code (see above), so the value of the note is only important as part of the tune. The exception is when you are inputting or outputting data.
Here is a list of what the function lines do, along with the corresponding instruction in brainfuck, so that you can see how they compare:
Middle C - move pointer forwards by X cells (>)
D - move pointer backwards by X cells (<)
E - increase cell value by X (+)
F - decrease cell value by X (-)
G - If the note is a semibreve or a minim, output the cell value as a number. If the note is a dotted minim or a crotchet, AND if the cell value is between zero and 255, output the character corresponding to the ASCII value. Else, do nothing. The value of X doesn't matter, so use it to improve the tune. (.)
A - set the cell value to zero, then ask for an input. If the note is a semibreve or a minim, ask for a numerical input, then input the number to the cell. If the note is a dotted minim or a crotchet, input the ASCII value corresponding to the first byte of input to the cell. The value of X doesn't matter, so use it to improve the tune. (,)
B - BEGIN LOOP. If the cell under the pointer has a value of zero, skip to the instruction after the next END LOOP instruction. Otherwise, continue. The value of X does not matter, so use it to improve the tune. Loops cannot be nested. ([)
C - END LOOP. Skip back to the most recent BEGIN LOOP instruction. The value of X does not matter, so use it to improve the tune. (])
=== Bars ===
Each bar is one instruction. Each bar can contain one active function line and one value of X. Bars begin and end with a single vertical line across the staff.
=== End of program ===
The end of the program is defined the same way as the end of a piece of music: by a double vertical line across the staff, with the second vertical line bolder than the first.
== See also ==
*Dimensions, another esolang by the same author.
*Quantum Dimensions, a quantum version of Dimensions, by the same author.
*RingCode, a Lord of the Rings based esolang, by the same author.
*IDTM, an esolang by the same author.
*KlingonCode, by the same author.
Category:LanguagesCategory:Brainfuck derivativesCategory:2014Category:UnimplementedCategory:Finite state automataCategory:Non-textual