sfx(id,note,channel)
id [0..63] == -1 by default to stop playing sfx on the channel, so if you call sfx() it means stop playing on 0 channel
note [0..95] we have 8 octaves each has 12 notes
channel [0..3] 0,1-square 2-triangle 3-noise
-- simple note playing demo when a button is pressed -- sfx(0,44) takes affect only first time, you have to call 'sfx(-1) sfx(0,44)' to reload sfx t=0 x=104 y=24 function TIC() cls(15) spr(1+(t%20)/10,x,y,1,4) print("Press any arrow key!",64,64,0) t=t+1 if btn(0) then sfx(0,44) elseif btn(1) then sfx(0,45) elseif btn(2) then sfx(0,46) elseif btn(3) then sfx(0,47) else sfx(-1) end end
Also, you can wait until sfx is playing
t=0 x=104 y=24 d=0 function play(note) sfx(-1) sfx(0,note) -- wait 30 ticks to start playing new note d=30 end function TIC() if d>0 then d=d-1 end cls(15) spr(1+(t%20)/10,x,y,1,4) print("Press any arrow key!",64,64,0) t=t+1 if d==0 then if btn(0) then play(44) elseif btn(1) then play(45) elseif btn(2) then play(46) elseif btn(3) then play(47) end end end
So, I'm going to make a sfx demo with the next version then.
Thanks