I wrote a program (in Visual Basic) that can record sound. I want to record this in real time and play this louder (or transfer it to another "client computer", and play there). How can I retrieve audio data in real time?
Thanks for the answer!
Bob
What I have tried:
My first attempt was taking the audio data every second. This is incorrect, due to it causing stutters.
Dim path As String, number As Integer = 1, timer As Boolean = False, i As Integer = 0
Private Declare Function record Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer
Private Sub RecordGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RecordGo.Click
record("open new Type waveaudio Alias recsound", "", 0, 0)
record("record recsound", "", 0, 0)
Timer1.Enabled = True
timer = False
End Sub
Private Sub Stop_and_Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Stop_and_Save.Click
record("save recsound " & path, "", 0, 0)
record("close recsound", "", 0, 0)
Timer1.Enabled = False
End Sub
Private Sub Play_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Play.Click
i = 1
timer = True
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If timer = False Then
record("save recsound " & path & number & ".wav", "", 0, 0)
record("close recsound", "", 0, 0)
record("open new Type waveaudio Alias recsound", "", 0, 0)
record("record recsound", "", 0, 0)
number = number + 1
Else
My.Computer.Audio.Play(path & i & ".wav", AudioPlayMode.Background)
i = i + 1
If i > number - 1 Then
Timer1.Enabled = False
End If
End If
End Sub