Solved

Recording a WAV file

Posted on 2003-11-16
4
480 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month6 days, 19 hours left to enroll

622 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