Well how can I monitor my microphone level- I have made a project that records sound and I want to add a progressbar that will tell me the level of volume that is being inputed. Here is my sound recorder code.
My Code:
Public Class Form1 Private Declare Function mciSendString 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 Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Button1.Enabled = False Button2.Enabled = True mciSendString("open new Type waveaudio Alias recsound", "", 0, 0) mciSendString("record recsound", "", 0, 0) Label1.Text = "Recording..." Label1.Visible = True End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Button1.Enabled = True Button2.Enabled = False Button3.Enabled = True mciSendString("save recsound c:\recsound.wav", "", 0, 0) mciSendString("close recsound", "", 0, 0) MsgBox("File Created: C:\recsound.wav") Label1.Text = "Stopped..." Label1.Visible = False My.Computer.Audio.Stop() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Label1.Text = "Playing..." Label1.Visible = True My.Computer.Audio.Play("c:\recsound.wav", AudioPlayMode.Background) End Sub End Class
The label is a status label- button1=record button, button2=stop button, button3=playback button
THANKS!




Reply With Quote
