to complete my previous reply,this is another APIs to play sounds:
MessageBeep API :https://msdn.microsoft.com/en-us/library/windows/desktop/ms680356(v=vs.85).aspx
Plays a waveform sound. The waveform sound for each sound type is identified by an entry in the registry.it used by the sounds sent by messagebox function.
declare integer MessageBeep in user32 integer
messagebeep(16)
beep APi:https://msdn.microsoft.com/en-us/library/windows/desktop/ms679277(v=vs.85).aspx
Beep Api generates simple tones on the PC speaker. The function is synchronous. it performs an alertable wait and does not return control to its caller until the sound finishes.
it uses 2 parameters :the frequency (37 through 32,767 ) and duration (milliseconds)
declare integer Beep in kernel32 integer,integer
Beep( 1000, 500 )
with this in principe can play any music composition !
declare integer Beep in kernel32 integer,integer
For i = 0 To 4000 Step 50
Beep( i, 20)
inke(0.1)
endfor
for fun, this a beginer composition sample ;
declare integer Beep in kernel32 integer,integer
create cursor ycurs( tone i,duration i)
text to m.myvar noshow
659, 120
0 ,120
622, 120
0 ,120
659, 120
0 ,120
622, 120
0 ,120
659, 120
0 ,120
494, 120
0 ,120
587, 120
0 ,120
523, 120
0 ,120
440, 120
0 ,140
262, 120
0 ,120
330, 120
0 ,120
440, 120
0 ,120
494, 120
0 ,140
330, 120
0 ,120
415, 120
0 ,120
494, 120
0 ,120
523, 120
0 ,140
330, 120
0 ,120
659, 120
0 ,120
622, 120
0 ,120
659, 120
0 ,120
622, 120
0 ,120
659, 120
0 ,120
494, 120
0 ,120
587, 120
0 ,120
523, 120
0 ,120
440, 120
0 ,140
262, 120
0 ,120
330, 120
0 ,120
440, 120
0 ,120
494, 120
0 ,140
330, 120
0 ,120
523, 120
0 ,120
494, 120
0 ,140
440, 120
endtext
local x1,x2
for i=1 to memlines(m.myvar)
x1=int(val(getwordnum(mline(m.myvar,i),1,',')))
x2=int(val(getwordnum(mline(m.myvar,i),2,',')))
insert into ycurs values(x1,x2)
endfor
scan
beep(tone,duration)
endscan
*update
in principe SAPI.SpVoice is shipped with windows OS.you can use this code for any sound file (or even for a litteral text)
local objVoice,objFile
try
objVoice = CreateObject("SAPI.SpVoice")
objFile = CreateObject("SAPI.SpFileStream.1")
objFile.Open (getfile("wav"))
objVoice.Speakstream(objFile)
objFile=null
objVoice=null
catch
endtry