Tekman
09-06-2003, 09:12 PM
Hello everybody, I am writing a program to help my kids with spelling. In the program I record a wav file for each letter of the alphabet. The program records, saves, and plays the wave files fine except for one minor inconvinence.....The wave files range in length from about .9 seconds to 1.6 seconds. I would like to make them more consistant if possible. Here is the relevent code (I hope)
Thanks for any help
Private Sub RecordLetter_Click()
Call recordsound
Call waitaround
Call playsound
Call waitaround
cmdAccept.Caption = "Accept " & wavname(Counter)
cmdReject.Caption = "Reject " & wavname(Counter)
cmdAccept.Enabled = True
cmdReject.Enabled = True
cmdRecordLetter.Enabled = False
End Sub
Sub recordsound()
i = mciSendString("open new type waveaudio alias capture", 0&, 0, 0) 'get ready
i = mciSendString("seek capture to start", 0&, 0, 0) 'Start at the beginning
i = mciSendString("set capture samplespersec 32000", 0&, 0, 0) 'quality
i = mciSendString("set capture bitspersample 8", 0&, 0, 0) '8 bit sound
i = mciSendString("set capture channels 1", 0&, 0, 0) 'mono
i = mciSendString("record capture", 0&, 0, 0) 'Start recording
End Sub
Sub waitaround()
Dim starttime As Long
starttime = Timer
progressbar1.Value = 0
Do While Timer < starttime + 1.5
If progressbar1.Value < 2000 Then
progressbar1.Value = progressbar1.Value + 1
End If
Loop
End Sub
Sub playsound()
i = mciSendString("play capture from 0", 0&, 0, 0)
End Sub
If any more code is needed, let me know
Lee
Thanks for any help
Private Sub RecordLetter_Click()
Call recordsound
Call waitaround
Call playsound
Call waitaround
cmdAccept.Caption = "Accept " & wavname(Counter)
cmdReject.Caption = "Reject " & wavname(Counter)
cmdAccept.Enabled = True
cmdReject.Enabled = True
cmdRecordLetter.Enabled = False
End Sub
Sub recordsound()
i = mciSendString("open new type waveaudio alias capture", 0&, 0, 0) 'get ready
i = mciSendString("seek capture to start", 0&, 0, 0) 'Start at the beginning
i = mciSendString("set capture samplespersec 32000", 0&, 0, 0) 'quality
i = mciSendString("set capture bitspersample 8", 0&, 0, 0) '8 bit sound
i = mciSendString("set capture channels 1", 0&, 0, 0) 'mono
i = mciSendString("record capture", 0&, 0, 0) 'Start recording
End Sub
Sub waitaround()
Dim starttime As Long
starttime = Timer
progressbar1.Value = 0
Do While Timer < starttime + 1.5
If progressbar1.Value < 2000 Then
progressbar1.Value = progressbar1.Value + 1
End If
Loop
End Sub
Sub playsound()
i = mciSendString("play capture from 0", 0&, 0, 0)
End Sub
If any more code is needed, let me know
Lee