Record sound: Difference between revisions
Content deleted Content added
m →{{header|OCaml}}: translation of C |
No edit summary |
||
Line 46: | Line 46: | ||
<lang guiss>Start,Programs,Accessories,Sound Recorder,Button:Record</lang> |
<lang guiss>Start,Programs,Accessories,Sound Recorder,Button:Record</lang> |
||
=={{header|Liberty BASIC}}== |
|||
LB can easily send a MCI string to the OS, or extra routines eg SOX, so a minimal solution could be |
|||
<lang lb> |
|||
run "sndrec32.exe" |
|||
</lang> |
|||
A more direct way is.. |
|||
<lang lb> |
|||
print "Starting 5 sec. recording..." |
|||
r$ =mciSendString$( "open new type waveaudio alias capture") |
|||
r$ =mciSendString$( "set capture time format ms bitspersample 16") |
|||
r$ =mciSendString$( "set capture channels 1 samplespersec 8000") |
|||
r$ =mciSendString$( "set capture alignment 1 bytespersec 8000") |
|||
r$ =mciSendString$( "record capture") |
|||
timer 5000, [on] |
|||
wait |
|||
[on] |
|||
timer 0 |
|||
print " .... now stopping the recording." |
|||
r$ =mciSendString$( "stop capture") |
|||
r$ =mciSendString$( "save capture " +chr$( 34) +"sample.wav" +chr$( 34)) |
|||
r$ =mciSendString$( "close capture") |
|||
print "Done recording." |
|||
r$=mciSendString$( "open " +q$ +"sample.wav" +q$ +" type waveaudio alias sfx") |
|||
r$=mciSendString$( "play sfx wait") |
|||
r$=mciSendString$( "close sfx") |
|||
print "Done playing back." |
|||
end |
|||
function mciSendString$( s$) |
|||
print s$ |
|||
buffer$ =space$( 1024) +chr$( 0) |
|||
calldll #winmm, "mciSendStringA", s$ as ptr, buffer$ as ptr, 1028 as long, 0 as long, r as long |
|||
buffer$ =left$( buffer$, instr( buffer$, chr$( 0)) -1) |
|||
if r >0 then |
|||
mciSendString$ ="error" |
|||
print "returned "; mciSendString$ |
|||
else |
|||
mciSendString$ =""'buffer$ |
|||
print "OK" |
|||
end if |
|||
end function |
|||
</lang> |
|||
=={{header|OCaml}}== |
=={{header|OCaml}}== |