Login
Back to forumReply to this topicGo to last reply

Posted By

Buck
on 2025-03-29
07:28:32
 Sound / Music

What's a good resource on generating and playing sound effects? I'm struggling to find a good tutorial
Posted By

Luca
on 2025-03-29
09:11:43
 Re: Sound / Music

Do you mean as seen from a melodic side, or by tech stuff?
Posted By

Buck
on 2025-03-29
09:56:07
 Re: Sound / Music

Tech stuff. How can I design sound effects and play them back. More than just single tones. Is each sound effectively the same as music?
Posted By

Luca
on 2025-03-29
11:16:43
 Re: Sound / Music

Oh well yes, that's like music: any sfx has its own little table of values, which get called every X times per frame and read by a tiny driver code which assigns the useful values to the right addresses ($FF0E/0F/10/11/12).
In BASIC, it would be something like:
100 VOL8
110 READ A,B:IF B=-1 THEN END
120 SOUND2,A,B:GOTO 110
130 DATA 700,1,800,1,900,1,950,1,965,1,967,1
140 DATA 960,2,878,2,700,3,440,3,200,4,,-1


Alternative sfx player can be envelope-based: the player considers a specified formula which uses a starting value only, or e.g. a starting value and a coefficient.
In BASIC, it would be something like:
100 VOL8:TT=0
110 INPUT "STARTING VALUE (0-1023)";VA
120 INPUT "COEFFICIENT (0-63)";CO
130 SOUND1,(VA*CO/(256-VA))AND255*4,1
140 SOUND2,ABS(VA-TT*CO),1
150 TT=TT+1:IF TT=21 THEN STOP
160 GOTO 130


Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2025. Support Plus/4 World on Patreon