Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Recording a WAV file

Posted on 2003-11-16
4
Medium Priority
?
482 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 11

Accepted Solution

by:
bmatumbura earned 200 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

688 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