Play: Difference between revisions

From Wiki of ZZT
Jump to navigation Jump to search
(basic summary)
 
No edit summary
Line 1: Line 1:
''[This article is a stub. You can help by filling it out.]''
''[This article is a stub. You can help by filling it out.]''


The '''#play''' command in [[ZZT-OOP]] allows [[object|objects]] and [[scroll|scrolls]] to play music and sound effects.
The '''#play [sound]''' command in [[ZZT-OOP]] allows [[object|objects]] and [[scroll|scrolls]] to play music and sound effects. (Note a scroll using '''#play''' does not suppress the default scroll sound effect.)


The general syntax is that parameters come before the notes and drums they modify.
== Sound Format ==


The octave and length parameters are reset each line. The default note length is 1 (32nd note), and the default octave is 3 (ranges from 1 to 6 inclusively).
The general syntax is that parameters come before the notes and drums they modify. The octave and length parameters are reset each line. The default note length is 1 (32nd note), and the default octave is 3 (ranges from 1 to 6 inclusively).


{| class="wikitable"
{| class="wikitable"
Line 32: Line 32:
| - || Down octave || N/A
| - || Down octave || N/A
|}
|}
In order to work, the triplet and time-and-a-half modifiers need to be placed somewhere after the length parameters they are modifying (eg ''w3'' or ''h.''). Also, these parameters can stack on each other (eg w3. produces a 15-tick-long note length).
The triplet and time-and-a-half parameters use integer floor division. If the result of the division is 0 (with either ''t3'' or ''s3''), then the length value will underflow and ZZT will play a 256-tick-long notes (~25 seconds each).


Notes and Rests:
Notes and Rests:
Line 65: Line 69:
|}
|}


All other character are silently ignored (like comments).
All other characters are silently ignored (like comments).


== See Also ==
== See Also ==

Revision as of 05:31, 12 February 2021

[This article is a stub. You can help by filling it out.]

The #play [sound] command in ZZT-OOP allows objects and scrolls to play music and sound effects. (Note a scroll using #play does not suppress the default scroll sound effect.)

Sound Format

The general syntax is that parameters come before the notes and drums they modify. The octave and length parameters are reset each line. The default note length is 1 (32nd note), and the default octave is 3 (ranges from 1 to 6 inclusively).

Parameters
Symbol Denotes Length in Ticks
t 32nd Note 1
s Sixteenth Note 2
i Eighth Note 4
q Quarter Note 8
h Half Note 16
w Whole Note 32
3 Triplet (n/3)
. Time-and-a-half (n*3)/2
+ Up octave N/A
- Down octave N/A

In order to work, the triplet and time-and-a-half modifiers need to be placed somewhere after the length parameters they are modifying (eg w3 or h.). Also, these parameters can stack on each other (eg w3. produces a 15-tick-long note length).

The triplet and time-and-a-half parameters use integer floor division. If the result of the division is 0 (with either t3 or s3), then the length value will underflow and ZZT will play a 256-tick-long notes (~25 seconds each).

Notes and Rests:

  • X - Rest
  • CDEFGAB - Piano notes, can be followed by:
    • # - Sharp
    • ! - Flat
Drums
Symbol "Sound"
0 Tick
1 Tweet
2 Cowbell
3 N/A -- Denotes Triplet
4 Hi snare
5 Hi woodblock
6 Low snare
7 Low tom
8 Low woodblock
9 Bass drum

All other characters are silently ignored (like comments).

See Also

  • Sound effects - ZZT's built-in sound effects, expressed in #play statements.
  • Duration Table - A programmatically generated list of possible note durations in ZZT-OOP