Thanks to jinzai in this tread
http://forum.thegamecreators.com/?m=forum_view&t=124099&b=20 I now can create wav files that can be readed by WMP.
load sound "c.wav", 1
load sound "g.wav", 2
merge_sounds(1,2,3,"newwave.wav")
play sound 3
wait key
end
function merge_sounds(sound1, sound2, new_number, filename$)
`volume: 100 = no change 50 = half volume 200 = 2 * volume
make memblock from sound sound1, sound1
make memblock from sound sound2, sound2
`find max length
length1 = (get memblock size(sound1)/2) - 28
length2 = (get memblock size(sound2)/2) - 28
length = length1
leftover = length2 - length1
leftsound = sound2
if length1 > length2
length = length2
leftover = length1 - length2
leftsound = sound1
endif
`create new memblock
make memblock new_number, ((length + leftover) * 2) + 32
`this part is a copy of someone else
offset = 0
write memblock dword new_number, offset, 1 rem wFormatTag = WAVE_FORMAT_PCM
inc offset, 4
write memblock dword new_number, offset, 1 rem nChannels = MONO
inc offset, 4
write memblock dword new_number, offset, 44100 rem nSamplesPerSec
inc offset, 4
write memblock dword new_number, offset, 88200 rem nAvgBytesPerSec
inc offset, 4
write memblock dword new_number, offset, 2 rem nBlockAlign = word
inc offset, 4
write memblock dword new_number, offset, 16 rem wBitsPerSample = 16
inc offset, 4
write memblock dword new_number, offset, 0 rem cbSize = 0
inc offset, 4
`end copy
s2 = (length + leftover) * 2
if file exist(filename$) then delete file filename$
open to write 1, filename$
write byte 1, asc("R")
write byte 1, asc("I")
write byte 1, asc("F")
write byte 1, asc("F")
write long 1, s2 + 42
write byte 1, asc("W")
write byte 1, asc("A")
write byte 1, asc("V")
write byte 1, asc("E")
write byte 1, asc("f")
write byte 1, asc("m")
write byte 1, asc("t")
write byte 1, asc(" ")
write long 1, 16
write word 1, 1
write word 1, 1
write long 1, 44100
write long 1, 88200
write word 1, 2
write word 1, 16
write byte 1, asc("d")
write byte 1, asc("a")
write byte 1, asc("t")
write byte 1, asc("a")
write long 1, s2
for b=0 to length
cont1 = memblock word(sound1,offset)
cont2 = memblock word(sound2,offset)
if cont1 = 0 then y1# = 0 `if zero, do nothing
if cont1 < 32767 then y1# = cont1 `if under max volume, do nothing
if cont1 > 32767 then y1# = cont1 - 65536 `if abowe max volume, calculate negative side
if cont2 = 0 then y2# = 0 `if zero, do nothing
if cont2 < 32767 then y2# = cont2 `if under max volume, do nothing
if cont2 > 32767 then y2# = cont2 - 65536 `if abowe max volume, calculate negative side
`calculate new volume
y# = (y1# + y2#) / 2
`calculate new memblock code
if y# < 0 then y# = 65535 + y#
if y# < 0 then y# = 0
if y# > 65535 then y# = 65535
`now write it to new sound
write memblock word new_number, offset, y#
inc offset, 2
write word 1, y#
next b
for b=0 to leftover
cont1 = memblock word(leftsound,offset)
y2# = 0
if cont1 = 0 then y1# = 0 `if zero, do nothing
if cont1 < 32767 then y1# = cont1 `if under max volume, do nothing
if cont1 > 32767 then y1# = cont1 - 65536 `if abowe max volume, calculate negative side
`calculate new memblock code
y# = (y1# + y2#) / 2
if y# < 0 then y# = 65535 + y#
if y# < 0 then y# = 0
if y# > 65535 then y# = 65535
`now write it to new sound
write memblock word new_number, offset, y#
inc offset, 2
write word 1, y#
next b
close file 1
delete memblock sound1
delete memblock sound2
make sound from memblock new_number, new_number
delete memblock new_number
endfunction
I am part of the problem and will always be.
About my Enligh. No I can not write it very well.