Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Record a WAV file

Total Hit ( 3740)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


You can use MCI functions if you want to record a WAV file. The main MCI function is mciSendString, that sends command strings to the system and execute them.

Click here to copy the following block
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, lpstrReturnString receives return information (if needed), uReturnLength is the number of characters in lpstrReturnString, and hwndCallback is used for system notifications. Remember that every command string described in this tip must be sent to the system as follows:

Click here to copy the following block
CommandString = "your MCI command here"
RetVal = mciSendString(CommandString, vbNullString, 0, 0&)

The first thing to do when working with WAV files is open the WAV device with this statement:

Click here to copy the following block
CommandString = "Open new type waveaudio alias RecWavFile"

where "RecWavFile" is an alias, that is an arbitrary name that you'll use in the next command strings to refer to a particular MCI memory buffer (and that you later save to disk). Then you can start, pause or resume and stop recording with one of the following statements:

Click here to copy the following block
' start recording
CommandString = "Record RecWavFile"
' pause recording
CommandString = "Pause RecWavFile "
' resume recording
CommandString = "Resume RecWavFile "
' stop recording
CommandString = "Stop RecWavFile"

You can also set the time format in milliseconds:

Click here to copy the following block
CommandString = "Set RecWavFile time format milliseconds"

and you can record for a number of milliseconds and then terminate:

Click here to copy the following block
' record for only 2 seconds
CommandString = "Record RecWavFile to 2000 wait"

When you have completed your recording homework, you must save the WAV file to file, which you do with

Click here to copy the following block
CommandString = "Save RecWavFile " & FileName

Finally, always remember to close the device with Close command:

Click here to copy the following block
CommandString = "Close RecWavFile"


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.