Command 0x2F: Tremolo
Sets a tremolo that varies the volume in a triangle wave.
Syntax
0x2F, byte length, byte rate, sbyte depth, byte delay
Parameters
| Parameter | Type | Description |
|---|---|---|
| length | byte | Turnaround interval (number of steps) |
| rate | byte | Time per step |
| depth | sbyte | Volume change per step (sign is ignored) |
| delay | byte | Time from key-on until tremolo starts |
Description
Enables tremolo (effect enable flag bit2) and saves the channel’s current left and right volume as the base volume ($0314+x, $0324+x). The setting applies to all subsequent notes until cancelled with command 0x30.
The tremolo works as follows.
- At key-on, restore the channel’s volume to the base volume, make depth positive, and initialize the number of steps until turnaround to length ÷ 2.
- Wait until the delay time has elapsed.
- Every rate, add depth to the left and right volume and write them to the DSP (1 step).
- When the number of steps until turnaround reaches 0, invert the sign of depth and reset the step count to length.
Effect times are counted in timer periods independent of tempo (about 7.5ms by default; changeable with command 0x2A). For details, see Sequence data structure.
This command takes no time to process; the following event is read within the same tick.
Note
- The volume addition is done in 8 bits with no range check. Set it so that volume + depth × length ÷ 2 does not exceed 127. If it does, the sign of the volume flips.
- While tremolo is enabled, the volume is restored to the base volume at every key-on, so volumes set with commands 0x02 and 0x28 are not reflected. To change the volume, set the tremolo again.
- Specify 2 or more for length.