Лабораторная работа: Audio recorder on visual basic

'Open a new WAV with MCI Command...

i = mciSendString ("open new type waveaudio alias capture", rtn, Len (rtn), 0)

If i <> 0 Then MsgBox ("Opening new wave failed!")

End Sub

Public Sub WaveSet ()

Dim rtn As String

Dim i As Long

Dim settings As String

Dim Alignment As Integer

rtn = Space$ (260)

Alignment = Channels * Resolution / 8

settings = "set capture alignment " & CStr (Alignment) & " bitspersample " & CStr (Resolution) & " samplespersec " & CStr (Rate) & " channels " & CStr (Channels) & " bytespersec " & CStr (Alignment * Rate)

'Samples Per Second that are supported:

'11025 low quality

'22050 medium quality

'44100 high quality (CD music quality)

'Bits per sample is 16 or 8

'Channels are 1 (mono) or 2 (stereo)

i = mciSendString ("seek capture to start", rtn, Len (rtn), 0) 'Always start at the beginning

If i <> 0 Then MsgBox ("Starting recording failed!")

'You can use at least the following combinations

' i = mciSendString ("set capture alignment 4 bitspersample 16 samplespersec 44100 channels 2 bytespersec 176400", rtn, Len (rtn), 0)

' i = mciSendString ("set capture alignment 2 bitspersample 16 samplespersec 44100 channels 1 bytespersec 88200", rtn, Len (rtn), 0)

' i = mciSendString ("set capture alignment 4 bitspersample 16 samplespersec 22050 channels 2 bytespersec 88200", rtn, Len (rtn), 0)

' i = mciSendString ("set capture alignment 2 bitspersample 16 samplespersec 22050 channels 1 bytespersec 44100", rtn, Len (rtn), 0)

' i = mciSendString ("set capture alignment 4 bitspersample 16 samplespersec 11025 channels 2 bytespersec 44100", rtn, Len (rtn), 0)

' i = mciSendString ("set capture alignment 2 bitspersample 16 samplespersec 11025 channels 1 bytespersec 22050", rtn, Len (rtn), 0)

' i = mciSendString ("set capture alignment 2 bitspersample 8 samplespersec 11025 channels 2 bytespersec 22050", rtn, Len (rtn), 0)

' i = mciSendString ("set capture alignment 1 bitspersample 8 samplespersec 11025 channels 1 bytespersec 11025", rtn, Len (rtn), 0)

К-во Просмотров: 630
Бесплатно скачать Лабораторная работа: Audio recorder on visual basic