How to Create a 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.
7 posts
Page 1 of 1
Hello,
In this tutorial, we are going to learn how to create a sound recorder. Now, note this: this WILL NOT be a professional sound recording application, just a simple Record/Stop/Play recorder. Credits for me learning this: YouTube (forgot which video :? maybe someone else can find it)
Let's Go!
OK, start up Visual Basic. Title your program anything you want, but I will name mine "Sound Recorder".
Controls:
Object = Label, Name = Label1, Text = Ready..., Font = Default w/ Bold
Object = Button, Name = Button1, Text = Start
Object = Button, Name = Button2, Text = Stop
Object = Button, Name = Button3, Text = Play
Object = BackgroundWorker, Name = BackgroundWorker1
I organized my controls like in the picture below:

Code:
Go into the code, and add this right under Public Class Form1:
Go into the code for your Start button click event, and add this code:
I did not explain the code, because it is heavily commented. This should be good enough to learn this, as I commented it well, I think. Please +rep if you liked this!
~GoodGuy17
In this tutorial, we are going to learn how to create a sound recorder. Now, note this: this WILL NOT be a professional sound recording application, just a simple Record/Stop/Play recorder. Credits for me learning this: YouTube (forgot which video :? maybe someone else can find it)
Let's Go!
OK, start up Visual Basic. Title your program anything you want, but I will name mine "Sound Recorder".
Controls:
Object = Label, Name = Label1, Text = Ready..., Font = Default w/ Bold
Object = Button, Name = Button1, Text = Start
Object = Button, Name = Button2, Text = Stop
Object = Button, Name = Button3, Text = Play
Object = BackgroundWorker, Name = BackgroundWorker1
I organized my controls like in the picture below:

Code:
Go into the code, and add this right under Public Class Form1:
Code: Select all
This code is calling the DLL called winmm so we can use it.Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstyCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer
Go into the code for your Start button click event, and add this code:
Code: Select all
Go into the code for the Stop button click event, and add this code: 'Enable Stop button
Button2.Enabled = True
'Disable Play button
Button3.Enabled = False
'Disable Start button
Button1.Enabled = False
'Start recording
mciSendString("open new Type waveaudio Alias recsound", "", 0, 0)
mciSendString("record recsound", "", 0, 0)
'Show status
Label1.Text = "Recording..."
Code: Select all
Go into the code for the Play button click event, and add this code: 'Enable Start button
Button1.Enabled = True
'Enable Play button
Button3.Enabled = True
'Disable Stop button
Button2.Enabled = False
'Save recording
mciSendString("save recsound C:\record.wav", "", 0, 0)
mciSendString("close recsound", "", 0, 0)
'Show status
Label1.Text = "Finished"
Code: Select all
Go into the code for the BackgroundWorker dowork event, and add this code: 'Show status
Label1.Text = "Playing..."
'Disable Play button
Button3.Enabled = False
'Disable Stop button
Button2.Enabled = False
'Disable Start button
Button1.Enabled = False
'Play recording
Me.BackgroundWorker1.RunWorkerAsync()
Code: Select all
Go into the code for the BackgroundWorker runworkercompleted event, and add this code: 'Play audio
My.Computer.Audio.Play("C:\record.wav", AudioPlayMode.WaitToComplete)
'Enable Start button
Button1.Enabled = True
'Disable Stop button
Button2.Enabled = False
'Enable Play button
Button3.Enabled = True
'Threading.Thread.Sleep
Threading.Thread.Sleep(250)
Code: Select all
About: 'Show status
Me.Label1.Text = "Done"
I did not explain the code, because it is heavily commented. This should be good enough to learn this, as I commented it well, I think. Please +rep if you liked this!
~GoodGuy17

Finally someone posted here Reboh, but i have used this code a while but can i post the app here?
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

Yea, sure. No credits needed (like, text, not Code Credits).
Nice tutorial GoodGuy17! BTW did you actually use it in any of your apps?
+rep too
+rep too

Instead of LOL use this -
LSIBMHBIWFETALOL
Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
LSIBMHBIWFETALOL
Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
GoodGuy17 wrote:Yea, sure. No credits needed (like, text, not Code Credits).Ok thanks
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

CoderBoy1201 wrote:Nice tutorial GoodGuy17! BTW did you actually use it in any of your apps?No, not really, but I was wanting to make a voice editing program once, and I could never figure out how to auto-tune.
+rep too
7 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023