Shortcuts:
NOTE()
1. This is the note() command. It is used to make melodies. For those familiar with music notation the symbols might seem familiar. With Capital letters from A to G, we represent all musical notes, although we sometimes put a # or a b to alter them slightly.
Right off the bat, we introduce the .slow() command. This makes a pattern
go slower, as the name implies. You divide the patterns tempo by the number you put in.
.slow(2) halves the tempo, .slow(3) divides the tempo
by 3.
There is an opposite is the .fast() command. The way it works is that it
multiplies the tempo by the number you put in.
.fast(2) doubles, and .fast(3) triples the tempo.
This is supposed to look like a piano. Try pressing a key, and you will hear a musical note.
You can use this to figure out melodies.
You need to turn on the sound by pressing the Start Audio button. You can now klick the keys on the piano to hear a note.
If you check the box named Keyboard Playing, you are also able to play the computer
keys *like a piano*.
[ Put browser in fullscreen mode to view piano ]
2. Notice on the piano above, the note C repeats. The pianos keys repeats both to the left and right. To distinguish which note we mean we add a number to the name. The default, when you do not add a number to C, Strudel assumes it is the C3 note. To play a lower note, choose a lower number, and an higher for a higher note. In the example below, we use a B2, which is lower than the regular B (B3).
There is also a new symbol in the pattern below. The tilde '~' is a super-useful symbol that represents the musical rest. When it occurs in the pattern, there is a step of silence.
3. As you saw from the previous example, the length of the program can get quite long when you keep on writing on the same line. Fortunately the people who made Strudel has thought of this. Below, you see three lines, and some commands on the following lines. This is called "chaining", and you can chain some commands together even over several lines. The link that chains them together is symbolized by a dot.
We can make the pianoroll change color with the .color() command. Write the name of a color within " " in the .color() command and the color of the notes changes. Try changing it from "magenta" to some other color of your choice.
4. The very last command for this chapter, which we will explore more in the next, is the stack() command. It makes it possible to play more than one pattern at once. You can layer them on top of each other and make more complex beats. You can think of stack() as the bread of a sandwich that you want to fill with stuff that tastes good together.
The example below uses a stack, which contains two note() and one sound() pattern. The '//' in front of some of the lines marks a comment, telling the
program that the code after them, on the same line, are not to be played. Notice how
the window turn the text gray to tell us which code is not active.
Try removing the '//' one line at a time to activate the code and make each part sound.
Vocabulary
Commands:
- note() - the command we use to program melodies.
- stack() - lets you put several note( ) and sound( ) commands together
to make more complex patterns - .slow() - makes the pattern go slower. [ .slow(2) = half the speed ]
- .fast() - makes the pattern go faster. [ .fast(2) = double the speed ]
- .color() - colors the pianoroll
Syntax:
- ~ - the musical rest, inserts a step of silence.
- // - the comment symbol, makes Strudel skip the code on that line
- ("A4 B3 C2") - note names and octave numbers