MCI - record sound
Posted: Tue Apr 19, 2005 2:06 am
Are there MCI commands to record from "Wave" or "Stereo Mix" from the sound card?
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
Global buffer$
buffer$=Space(256)
Procedure MCI(command.s)
result=mciSendString_(command,@buffer$,256,0)
ProcedureReturn result
EndProcedure
;---------------------------------------------------------------------
clip.s="C:\Test.wav" ;file to save to disk
Alignment=4
bits=16 ;16bit wave file
channels=2 ;1=mono 2=stero
samples=44100 ;44.1kHz sample rate
reclength=5 ;length of audio to record (this example records 5 seconds)
InitGadget(2)
If OpenWindow(0,10,10,200,100,#PB_Window_SystemMenu,"Record Audio")=0:End:EndIf
If CreateGadgetList(WindowID())=0:End:EndIf
TextGadget(0,10,10,100,20,"")
MCI("open new type waveaudio alias recsound")
MCI("set recsound time format ms")
MCI("set recsound alignment "+Str(Alignment)+" bitspersample "+Str(bits)+" samplespersec "+Str(samples)+" channels "+Str(channels)+" bytespersec "+Str(samples*Alignment) )
MCI("record recsound")
While elapsed < reclength*1000
MCI("status recsound position")
elapsed=Val(buffer$)
SetGadgetText(0,"Recorded: "+Str(elapsed/1000)+" secs.")
Delay(20)
Wend
MCI("save recsound "+clip)
MCI("close recsound")
End
Thanks Paul!Paul wrote:I put this together back in February 2002 (found on PureProject.net website)...
Doesn't seem to work. I can barely hear the recorded wav. Tried to turn up the input and output levels but still barely able to hear it.goomoo wrote:1.Double click on the Speaker on TaskBar, this will brings Volume Control window.
2.Choose menu Options>Properties
3.Select the Record radio button. Check the Stero Mix and uncheck Microphone item.
4.Now when you use MCI command to record sounds, you are recording from the soundboard.
Code: Select all
clip.s="C:\Documents And Settings\Owner\Desktop\Test.wav"
Code: Select all
clip.s=Chr(34)+"C:\Documents and Settings\Owner\Desktop\Test.wav"+Chr(34)
Thanks alot Paul!Paul wrote:If you are using long path names with spaces, try:Code: Select all
clip.s=Chr(34)+"C:\Documents and Settings\Owner\Desktop\Test.wav"+Chr(34)