Vorticon, on Thu Oct 13, 2011 1:20 PM, said:
I'm looking for an XB sound routine that generates the sound of a cannon. I am terrible at this sort of stuff, so if anyone here has something along these lines, would you mind sharing it?
The best way to craft sounds is to think about what they're made up of. A cannon is an explosive "whuf" sound, followed by a high-pitched whine of the cannon ball, going from high to low as it approaches the target.
The explosion can be done just using the noise generator:
100 FOR I=0 TO 30 STEP 5
110 CALL SOUND(-200,-7,I)
120 NEXT I
The high-pitched whine is a little more difficult, as BASIC will tend to stutter a bit... try this:
130 FOR I=1 TO 10
140 CALL SOUND(-500,2000-(I^3),0)
150 NEXT I
The trick here is to start at a very high sound, but descend at an exponential rate, but still only have around 10-20 sound changes to make it fairly fast. Or you can just forgo the whine sound and stick with the explosion too, maybe add a reverb effect to it instead.
Vorticon, on Thu Oct 13, 2011 1:20 PM, said:
I also need one with sounds of swords clashing, but if I recall correctly, 99'er magazine had a sound article that included this very particular sound pattern. I'll see if I can locate it.
Yes, I've read the same article, but it's easy to recreate here. What you need is to use the multiple voices at high pitches, each slightly different, and have it fade over time:
100 FOR I=0 TO 30 STEP 6
110 CALL SOUND(-100,3000,I,2000,I,1000,I)
120 NEXT I
The fun of sound effects is playing around until you find the right ones!
Adamantyr
Edited by adamantyr, Thu Oct 13, 2011 2:23 PM.