Solved

Recording a WAV file

Posted on 2003-11-16
4
474 Views
Last Modified: 2013-12-25
Experts,
I've tried the following code on 2 PCs and I'm getting the same negative results. The code is supposed to record the output from the soundcard to a WAV file (regardless of what audio the soundcard is playing - could be a CD, another WAV, mic etc). I think the code itself is fine - it is definitely recording a WAV file, and the resulting WAV file is playable by any media player, but in every case the WAV file contains no audio content - nothing, zippo, nadda - dead silence. Is there something I need to configure in Windows? Both PCs are running Windows 2000 -one's a laptop and the other a desktop with a Soundblaster Live!
Thanks muchly,
DocNash

Option Explicit

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

Const Path$ = "c:\Test.wav"

Dim RS$, CB&

Private Sub Command1_Click()
  If Dir$(Path, vbNormal) <> "" Then Kill Path
  RS = Space$(128)
     
  Call mciSendString("open new type waveaudio alias capture", _
                     RS, 128, CB)
  Call mciSendString("record capture", RS, 128, CB)
 
  Command1.Enabled = False
  Command2.Enabled = True
 End Sub
 
Private Sub Command2_Click()
  RS = Space$(128)
  Call mciSendString("stop capture", RS, 128, CB)
  Call mciSendString("save capture " & Path, RS, 128, CB)
  Call mciSendString("close capture", RS, 128, CB)
 
  Command1.Enabled = True
  Command2.Enabled = False
 End Sub
0
Comment
Question by:DoctorNash
4 Comments
 
LVL 11

Accepted Solution

by:
bmatumbura earned 50 total points
ID: 9763464
Download this wraper class for MCI. i think this'll solve you problem.

http://www.thevbzone.com/cMCI_Adv.cls

For more information on this class visit: http://www.thevbzone.com/s_cls_modules.htm
It's simple to use and can record and play back other types of media too.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now