Sound Recorder

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
2 posts Page 1 of 1
Contributors
User avatar
mika
Just Registered
Just Registered
Posts: 6
Joined: Tue Aug 09, 2011 11:52 am

Sound Recorder
mika
This Is easy to create program that records sound from your microphone.
Ok, im showing you how to create that.
So, create new project and add this compoments.
3 Button(Button1,Button2,Button3)
Button1 Text - Record
Button2 Text - Stop
Button3 Text - Play

1 SaveFiledialog(savefiledialog1)
SaveFileDialog Filter - Windows Media Files (*.wmv)|*.wmv

1 Label(label1)
Label Text - Status

Like This
Image
___________________________________________________________
And add This Codes
Code: Select all
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

        SaveFileDialog1.ShowDialog()
        mciSendString("close recsound", "", 0, 0)
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Try
            Label1.Text = "Playing..."
            Label1.Visible = True
            My.Computer.Audio.Play(SaveFileDialog1.FileName, AudioPlayMode.Background)
        Catch ex As Exception
            ex.Message.ToString()

        End Try
        
    End Sub

    Private Sub SaveFileDialog1_FileOk(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk

        mciSendString("save recsound " & SaveFileDialog1.FileName, "", 0, 0)

        MsgBox("File Created:  " & SaveFileDialog1.FileName)
        Label1.Text = "Stopped..."
        Label1.Visible = False
        My.Computer.Audio.Stop()
    End Sub
End Class


So you see its really easy. nerner;
You do not have the required permissions to view the files attached to this post.
Image
Image
Image
Image
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

Re: Sound Recorder
GoodGuy17
Not to put you down, but I have posted this before.

viewtopic.php?f=38&t=5003
2 posts Page 1 of 1
Return to “Tutorials”