Code: Select all
Function mciSendString(t$)
in=MakeMEMBlock(Len(t)+1)
For i=1 To Len(t)
PokeByte in,i-1,Asc(Mid(t,i,1))
Next i
PokeByte in,Len(t),0
CallDLL "winmm","mciSendStringA",in
DeleteMEMBlock in
End Function
Function StartRecord()
mciSendString("open new type waveaudio alias capture")
mciSendString("set capture time format ms")
mciSendString("set capture channels 2 bitspersample 16 alignment 4 samplespersec 44100 bytespersec 16000")
mciSendString("record capture")
End Function
Function StopRecord()
mciSendString("stop capture")
End Function
Function SaveRecord(file As String)
mciSendString("save capture " + file)
mciSendString("close capture")
End Function
Print "Paina enteriä aloittaaksesi nauhoituksen"
k = WaitKey()
If k<>cbKeyReturn Then End
Print "Nauhoitus käynnissä"
Print "Paina mitä tahansa näppäintä lopettaaksesi nauhoituksen"
StartRecord()
WaitKey
StopRecord()
Wait 100
SaveRecord("test.wav")
Print "Nauhoitus on tallennettu."
PlaySound "test.wav"
WaitKey