Home > Uncategorized > Mcisendstring in .NET for recording audio

Mcisendstring in .NET for recording audio

Just found out how to record and playback audio. Really easy.
 

Private Declare Function mciSendString Lib "Winmm.dll" Alias "mciSendStringA" _

(

ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _

ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

 

Public Sub recordToWave(ByVal filename As String)

mciSendString("open new type waveaudio alias capture", vbNullString, 0, 0)

mciSendString("record capture", vbNullString, 0, 0)

blnIsRecording =

True

While blnIsRecording

Application.DoEvents()

End While

mciSendString("save capture " + filename, vbNullString, 0, 0)

mciSendString("close capture", vbNullString, 0, 0)

End Sub

Public Sub playWave(ByVal filename As String)

mciSendString("Play waveaudio!" + filename, vbNullString, 0, 0)

End Sub

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: