From Test-Scratch-Wiki
- This eng is about the block. For more information on the value this block reports, see Tempo (value).
Tempo | |
Category | Sound |
Type | Reporter |
Introduced in | 1.2 |
The Tempo block is a Sound block and a Reporter block. The block holds the Scratch project's tempo. This block can be displayed as a Stage monitor.
Example Uses
As this block holds how long drums and notes will be played, it is useful in music projects where they must sense how long an instrument will be playing.
Some common uses for the Tempo block:
- Speed controls on projects that play music made with the Sound blocks
when gf clicked forever if <mouse down?> then point towards [mouse-pointer v] set tempo to (((direction) mod (181)) + (20)) bpm set [universal tempo v] to (tempo) end
- Loops that must stop once the tempo is at a certain amount
repeat until <(tempo) = [20]> change tempo by (-1) end
- Sensing how fast something is being played
when gf clicked forever say (tempo) point in direction (tempo)
- Synchronizing with notes with adjustable tempo
when gf clicked ask [Tempo?] and wait set tempo to (answer) bpm play note (60) for (1) beats play note (62) for (1) beats play note (63) for (1) beats when gf clicked wait until <not <(answer) = []>> say [C] for ((60) / (tempo)) secs say [D] for ((60) / (tempo)) secs say [E!] for ((60) / (tempo)) secs