SFX



sfx( #, [channel], [offset], [length] )
# the SFX number of the sound you want to play (#0-63)
channel (optional) a number specifying which of the 4 channels (#0-3) to play on.
offset (optional) a number of notes (#0-31) into a sound for when to start playing the sound.
length (optional) a number of notes (#0-31) into a sound for when to stop playing the sound.


Examples:
sfx( 1 )

- play all of SFX #1, on an unoccupied channel

sfx( 3, 0 )

- play all of SFX #3, on channel #0

sfx( 4, 2, 6 )

- play part of SFX #4, in channel #2, starting 6 notes in

sfx( 4, 2, 6, 20 )

- play part of SFX #4, in channel #2, starting 6 notes in, ending at note 20



Extra Options using Negative Numbers:

SFX #
-1 Stop the current sound on this channel.
-2 Stop looping the current sound on this channel, but let it finish.

Channel #
-1 (default) Play the sound on a channel that is not in use.
-2 Stop the sound from playing on any channel.

Examples:
sfx( -1 , 3 )

- stop playing any sounds on channel #3

sfx( -2 , 3 )

- stop looping any sounds on channel #3

sfx( -1 )

- stop playing all sounds on all channels

sfx( -2 )

- stop looping all sounds on all channels but allow them to finish


Images in this Guide by NerdyTeachers is licensed under CC BY-SA 4.0

2580

20 Oct 2023

Font