Documentation
Language Documentation
Operations
Units:
Beats
Seconds
Statements:
Say
Play
Rest
Repeat
Random Number
Random Note
SetCC
Set Midi Channel
Assign Variable
Is
From
Functions
Operations:
-
Subtraction
Subtract value on right from value on left
10 - 1
+
Addition
Sum values together
1 + 1
*
Multiplication
Multiply values together
100 * 10
/
Division
Divide value on left by value on right
100 / 10
( )
Brackets
Place an operation in brackets to be completed first.
These can be used one after another, with the order of operations as follows: Brackets, Division and Multiplication, Addition and Subtraction, or BDMS for short.
Units
Beats
The length of a beat is set by host DAW bpm, the s at the end is optional (beat or beats)
Seconds
Seconds unit. The at the end is optional (second or seconds)
Notes
Notes can be written in either:
-
Standard pitch notation, a letter between A and G, followed by an optional # for flat or b for sharp and octave number.
Examples: A4, G#5, Cb7, c8, C2
-
Midi number, between 0 and 127.
Statements
Say
Tell Scorch to say something in the console below the text editor. Scorch can say numbers, variables, notes, words.
Say “hello” Say 1 Say variable1
Play
Play note _ for _ beat
Play will play a given note for a given duration. If no duration is given, it will play that note for 1 beat.
Play note C4 for 1 beat Play note 44 for 1 second
Play note Cb5
Repeat
Repeat _ times
Repeats the following block of code a given number of times. The number of times can be a number or a variable defined earlier.
Repeat 4 times
Block
Say “hello”
End block
Variable var1 is 30
Repeat var1 times
Block
Say “30 times”
End block
Rest
Rest for 1 beat
A rest for a given amount of time. Scorch will not read the next line of code until the time of rest has passed.
Play note C4 for 1 beat
Rest for 1
Random Number
Random Number between _ and _
A random number between 2 given values. If no values are given, produces a random number between 0 and 1.
Random number between 2 and 6
Random number
Random Note
Random Note between _ and _
A random note between 2 given notes. If no notes given, produces a random note between minimum and maximum possible.
Random note between c4 and c7
Random note
Set CC
Set CC _ to _
Set a given midi continuous control value to a given value between 0 and 127.
Set CC 13 to 100
Set CC 2 to random number between 0 and 127
Set midi channel
Set midi channel to _
Set the midi output channel to given value.
Set midi channel to 2
Assign Variable
Variable _ is _
Create a variable with a given name and given value. The name must be a word, and cannot be any other keyword, like a statement or a note. Be careful not to name multiple variables the same name or they will overwrite each other.
Variable var1 is 2
Variable var2 is var1 - 100
Variable var3 is “words, and a few of them!”
Repeat var2 times
Block
Say var3
Say var1
End block
Is
Is _ less than/more than/equal to _ ?
Is allows the comparison of two values, and if found to be correct, Scorch will read the block which follows, otherwise it will skip the block. The comparisons can be written out or can be the symbolic equivalents: <, >, =, !=.
Is 2 more than 1?
block
Say “yes”
End block
Is random number equal to 1
Block
Say “ yes”
End block
Variable var1 is 200 Is var1 < 2
Block
Say “it really shouldn’t be no”
End block
Or is?
Or is _ less than/more than/equal to _ ?
When an is statement is false, and does not execute the code block below it, Scorch will move to the next statement. Having Or is _ less than/more than/equal to _ ? Below an is statement will only be read by scorch if the is before it is false. You can chain as many of these together as you like, and the first to come true will be the only one that Scorch executes.
Otherwise
0therwise can be used after an is statement or an is statement followed by or is statements. If all the is/or is statements are false, Scorch will always execute the block below otherwise. If one of the is/or is statements before is correct, the otherwise will be ignored by Scorch.
Is 3 less than 2?
Block
Say “no it’s not!”
End block
Or is 4 more than 5?
Block
Say “nope!”
End block
Otherwise
Block
Say ”last 2 were false. So this will be said!”
End block
Lists
Lists are just a collection of values, which can be manipulated and changed. For example, this can be useful for storing a collection of notes or numbers. Create a list by typing a sequence of numbers. For example:
1 2 3 4 C4 B2 Db5
The lists we created above are valid lists, and can be used in other statements, for example to play a chord:
Play note c4 c5 Eb5 for 1 beat
Use lists in the same way as you would any other value, like creating a variable with a list as a value:
Variable mylist is 0 1 2 3 4 5
To interact with the values in a list, there are 4 main statements:
Add value _value_ to position _position_ of _list_
Swap value _value_ to position _position_ of _list_
Remove value from position _position_ of _list_
Get value from position _position_ of _list_
_value_: the value to add or swap to the list.
_position_: the position within the list to alter.
_list_: the list to interact with.
Important: Lists are a collection of values, and Scorch will treat them as such. They can be used in place of a value, even in statements used to interact with lists! This will become more clear later on.
Add value to list:
Add value _value_ to add_ to position _position_ of _list_
Add a value to the list at a given position.
Add value _value_ to end of _list_
Add a value to the end of the list.
Add value _value_ to start of _list_
Add a value to the start of the list.
Remove value from list:
Remove value _value_ from _position_ of _list_
Remove a value from a given position in a list
Remove value _value_ from start of _list_
Remove a value from the start of a list
Remove value _value_ from end of _list_
Remove a value from the end of a list
Swap values of list:
Swap value _value_ to position _position_ of _list_
Swap a new value for an existing value at a given position in a list.
Swap value _value_ to end of _list_
Swap a new value for the last value of a given list.
Swap value _value_ to start of _list_
Swap a value for the first value of a given list.
Get values from a list
Get value from position _position_ of _list_
Get the value at a given position in a list
Get value from end of _list_
Get a value at the end of a list
Get value from start of _list_
Get the value at the start of a list
List examples:
create a list and store it, then play then add a value at the end of the list
Variable my_list is 0 1 2 3 4
Say “original list:”
Say my_list
Add value 2 to end of my_list
Say “altered list:”
Say my_list
Create a list of notes and velocities and store them, then use a certain value of these lists
Variable my_notes is c4 c5 d2 e3
Variable my_velocities is 0.1 1 0.6
Play (get first value from my_notes) for 1 beat with velocity (get first value from my_velocities)
Create some lists and store them, then interact with the lists and use their values.
Variable my_notes is c4 c5 c2 c6
Variable my_velocities is 0.2 1 0.3 0.4
Repeat 8 times Block From 0 to 3
Block
Play (get value from position count of my_notes) with velocity (get value from position count of my_velocities) for 1 beat
End block
Swap value (random note between c4 and c5) to position (random number between 0 and 3) of my_notes
Swap value (random number) to position (random number between 0 and 3) of my_velocities
End block
From
From _ to _ in steps of _
From to repeats the following block of code from first value to second value, increasing in steps of third value, and the current number is accessible in the block of code using the variable “count”. If no steps are given, the step size is 1.
From 0 to 100 in steps of 1
Block
Say count
Rest for 0.1 seconds
End block
From 100 to 105 in steps of 0.25
Block
Say count
Rest for 0.1 seconds
End block
From 0 to 10
Block
Say “from count”
Say count
Repeat count times
Block Say “repeat”
Play note c4 for 0.1 seconds
End block
End block
Functions
A function must be created, then called. The process is as follows:
Function _ _
Create a function.
The function needs to have a name, which must be a word, and can take variables after the name. These variables are then able to be used in the function itself, and the values of those variables can be different each time the function is called.
Call _ _
Call a function with the following variable values.
When you call a function that has variables, you need to give it correct values in the same order. Check out examples to see what is meant by that.
Function func1
Block
Say “function 1”
End block
Function func2 var1 var2 var3
Block
Say var1
Play note var2 for 1 beat
Rest for var3 beats
End block
Call func1
Call func2 “function2” C4 2