../
kernel
functions
add
all
apply_delta
assert
atan2
btn
btnp
camera
cd
char
chooser
circ
circfill
clip
cls
color
cos
count
cp
create_delta
create_gui
create_process
cursor
date
del
deli
env
error
exit
fetch
fetch_metadata
fget
fillp
foreach
fset
fstat
fullpath
get_clipboard
get_display
get_draw_target
get_spr
include
input
key
keyp
line
ls
map
max
memcpy
memmap
memset
menuitem
mget
mkdir
mouse
mouselock
mset
music
mv
note
on_event
open
oval
ovalfill
peek
peek2
peek4
peek8
peektext
pget
pid
pod
poke
poke2
poke4
poke8
printh
pset
pwd
readtext
rect
rectfill
rm
rrect
rrectfill
scoresub
send_message
set_clipboard
set_draw_target
set_spr
sfx
sin
socket
split
spr
sspr
stat
stop
store
store_metadata
sub
time
tokenoid
type
unmap
unpod
userdata
vec
vid
window
sfx(n, [channel], [offset], [length], [mix_volume])
Overview
Plays sound effect at index n (0-64) in channel [channel] (0-15) for length notes.
The volume of the sound effect is [mix_volume].
Arguments
n: integer
The sound effect index to play.
If this is negative, it calls a special sfx command; these are as follows.
-1
Stops playing any sfx on that channel.
The existing channel state is not altered; stopping an sfx that uses an instrument with a long echo will not cut the echo short.
-2
Stops playing any sfx on that channel, and also clears the channel state state: echos are cut short and the channel is immediately silent.
-3
Release any looping sfx on that channel
-4
Set the mix volume.
The channel mix volume is not reset until sfx() is called on that channel, so music channel mix volumes persist between calls to music().
[channel]: integer
The designated channel to play the sound effect in; defaults to a free channel when -1 or nil in one half of the audio channels.
[offset]: number
The offset to play the sfx at; if this is negative, you can delay playback.
[length]: number
The length of the notes to play.
When the sfx is looping, length still means the number of (possibly repeated) notes to play.
[mix_volume]: number
When [mix_volume] is given, the channel is mixed at that value (0x40 means 1.0).
Otherwise, the value at 0x553a is used (0x40 by default).
In addition to the per-channel mix volume, all channels are subject to a per-process global volume specified at 0x5538 (default: 0x40 == 1.0).