Solved

Recording a WAV file

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JSON Response and request in VB6 application 11 1,028
Microsoft Access combo box help 2 57
clicking a shape in a frame array vb6 3 54
vbModal 12 73
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

737 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