' How to record a wav file
' Thanks to Dave Navarro for this code:

DECLARE FUNCTION mciSendString LIB "WINMM.DLL" ALIAS "mciSendStringA" _
                 (StrCommand AS STRING, ReturnString AS LONG, _
                  ReturnLength AS LONG, hwndCallBack AS LONG) AS INTEGER

    mciSendString "open new Type waveaudio Alias capture", 0, 0, 0
    mciSendString "set capture bitspersample 8", 0, 0, 0
    mciSendString "set capture samplespersec 11025", 0, 0, 0
    mciSendString "set capture channels 1", 0, 0, 0
    mciSendString "record capture", 0, 0, 0
    PRINT "Press any key to stop recording..."

    DO
    LOOP UNTIL LEN(INKEY$)

    'bitspersample can be:
    '8
    '16
    '
    'samplespersec can be:
    '11025
    '22050
    '44100
    '
    'channels can be:
    ' 1 = mono
    ' 2 = stereo

    mciSendString "stop capture", 0, 0, 0
    mciSendString "save capture NewWave.wav", 0, 0, 0
    mciSendString "close capture", 0, 0, 0
