VB icon

Record sound CD (track) to WAV file.

Email
Submitted on: 1/2/2015 10:51:00 AM
By: Damjan (from psc cd)  
Level: Not Given
User Rating: By 102 Users
Compatibility: VB 4.0 (32-bit), VB 5.0, VB 6.0
Views: 1533
 
     Record sound from CD (Track1, Track2...) to a WAV file.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Record sound CD (track) to WAV file.
' Description:Record sound from CD (Track1, Track2...) to a WAV file.
' By: Damjan (from psc cd)
'**************************************

'This control use MCI to control CD
Public Sub RecordWave(TrackNum As Integer, Filename As String)
' TrackNum: track to record
' Filename: file to save wave as
On Local Error Resume Next
Dim i As Long
Dim RS As String
Dim cb As Long
Dim t
RS = Space$(128)
i = mciSendString("stop cdaudio", RS, 128, cb)
i = mciSendString("close cdaudio", RS, 128, cb)
Kill Filename
RS = Space$(128)
i = mciSendString("status cdaudio position track " & TrackNum, RS, 128, cb)
i = mciSendString("open cdaudio", RS, 128, cb)
i = mciSendString("set cdaudio time format milliseconds", RS, 128, cb)
i = mciSendString("play cdaudio", RS, 128, cb)
i = mciSendString("open new type waveaudio alias capture", RS, 128, cb)
i = mciSendString("record capture", RS, 128, cb)
t# = Timer + 1: Do Until Timer > t#: DoEvents: Loop
i = mciSendString("save capture " & Filename, RS, 128, cb)
i = mciSendString("stop cdaudio", RS, 128, cb)
i = mciSendString("close cdaudio", RS, 128, cb)
End Sub


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.