Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sound Recording using VB

Status
Not open for further replies.

xenomage

Programmer
Jun 27, 2001
98
SG
Hi all,

does anybody has any idea how to write a program that records sound. Any suggestion/help is greatly appreciated. Thanks.

xeno
 
Authored by VB2TheMax Team

You can use the mciSendString API to record wav files.

Declare Function mciSendString Lib "Winmm" Alias "mciSendStringA" (ByVal lpstrCommand as String, ByVal lpstrReturnString as String, ByVal uReturnLength as Long, ByVal hwndCallback as Long) as Long

the first argument is the command string, the second receives return information if needed, uReturnLength is the lenght of lpstrReturnString and the last argument is used for system notifications.

commands:
CommandString="Open new type waveaudio alias RecWavFile"
' used to open the waveaudio RecWavFile

CommandString="Record RecWavFile"
'starts recording

CommandString="Pause RecWavFile"
'pauses recording

CommandString="Resume RecWavFile"
'resumes recording

CommandString="Stop RecWavFile"
'stops recording

'to set time in milliseconds
CommandString="Set RecWavFile time format milliseconds"

'to record for a few seconds then stop, type
CommandString="Record RecWavFile to 2000 wait" '2 seconds

'to save file
CommandString="Save RecWavFile " & FileName

'remember to close device
CommandString="Close RecWavFile"

all commands should be sent as follows.
retval=mciSendString(CommandString, vbNullString,0,0&)


Hope this is helpful,

ts2032
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top