Dim i As Integer 'Used for the return values
'First we must tell the API we want to open a new capture using wave audio:
i = mciSendString("open new type waveaudio alias capture", 0&, 0, 0)
'Then you set the bits per sample (8 or 16)
'16 bits per sample is better quality, but larger file
i = mciSendString("set capture bitspersample 16", 0&, 0, 0)
'Next the Samples per Second can be set using the samplespersec command.
'11025=low quality
'22050=medium quality
'44100=high quality
i = mciSendString("set capture samplespersec 11025", 0&, 0, 0)
'Specify wether you want mono (1) or stereo (2):
i = mciSendString("set capture channels 2", 0&, 0, 0)
'Start recording:
i = mciSendString("record capture", 0&, 0, 0)
'It will continue recording untill you pause or stop it:
i = mciSendString("pause capture", 0&, 0, 0)
'When paused it can be resumed:
i = mciSendString("resume capture", 0&, 0, 0)
'Or you can stop it in order to save it afterwards:
i = mciSendString("stop capture", 0&, 0, 0)
'Finally, you can save the file:
i = mciSendString("save capture c:\NewWave.wav", 0&, 0, 0)