Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SFX
#5
Here's an example where I create a plain sound and the same sound but with some over- and subtones. Sounds like some sort of electric piano Big Grin  But maybe SFX could get another parameter dealing with these things.

Code:
include "sfx.n7"

#mem32000000
sfx = SFX()

set window "Test", 640, 480

duration = 0.75
freq = 523*0.5
vol = [0.75, 0.2, 0.2, 0.2, 0]
main = sfx.SineWaveData(duration, freq, vol)[0]
plainSnd = createsound(main, main, sfx.GetSampleRate())
hiFreq = freq
loFreq = freq
for i = 1 to 4
    hiFreq = hiFreq*2
    loFreq = loFreq/2
    for j = 0 to sizeof(vol) - 1  vol[j] = vol[j]*0.2
    high = sfx.SineWaveData(duration, hiFreq, vol)
    low = sfx.SineWaveData(duration, loFreq, vol)
    for j = 0 to sizeof(main) - 1
        main[j] = main[j] + high[0][j]
        main[j] = main[j] + low[0][j]
    next
next
newSnd = createsound(main, main, sfx.GetSampleRate())
wln "press 1 to play the plain sound"
wln "press 2 to play the new sound"
while not keydown(KEY_ESCAPE, true)
    if keydown(KEY_1, true)  play sound plainSnd
    if keydown(KEY_2, true)  play sound newSnd
    fwait 60
wend
Reply


Messages In This Thread
SFX - by johnno56 - 02-19-2024, 07:02 PM
RE: SFX - by Marcus - 02-20-2024, 04:44 PM
RE: SFX - by Marcus - 02-20-2024, 05:58 PM
RE: SFX - by johnno56 - 02-20-2024, 06:52 PM
RE: SFX - by 1micha.elok - 02-21-2024, 06:38 AM
RE: SFX - by Marcus - 02-21-2024, 04:07 PM
RE: SFX - by 1micha.elok - 02-22-2024, 05:04 AM
RE: SFX - by Marcus - 02-21-2024, 06:37 AM
RE: SFX - by johnno56 - 02-21-2024, 11:37 AM

Forum Jump:


Users browsing this thread: 3 Guest(s)