Record From Microphone to Wave File
|Submitted on: 11/25/2003 4:13:23 AM |
User Rating: Unrated
Compatibility:Delphi 7, Delphi 6, Delphi 5, Delphi 4
Users have accessed this code 1086 times.
|(About the author)|
| I wrote this in Delphi 6. This Code Records from your Microphone and Saves it to the Hard drive as a .wav file. Just add mmSystem to the Uses and insert the code.|
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
Terms of Agreement:
By using this code, you agree to the following terms...
1) You may use
this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
! Name: Record From Microphone to Wave F
! Description:I wrote this in Delphi 6.
! This Code Records from your Microphone a
! nd Saves it to the Hard drive as a .wav
! file. Just add mmSystem to the Uses and
! insert the code.
! By: Una-Rat
!This code is copyrighted and has ! limited warranties.Please see http://w
! wCode.asp?txtCodeId=1281&lngWId;=7 !for details. !**************************************
1. Add mmSystem To the Uses.
2. Add 3 buttons to your Form.
3. Button 1 is for Record.
4. Button 2 is for Stopping the Recording.
5. Button 3 is for Saving the Recorded wav.
I'v found very few sources on recording from a mic
and all of these sources look almost identical. So
this is my version and I'm sure it will look the
same as any of you making your own version's of
the code. So use it how you want and if your version
is better than mine, I'd like to have a copy of it.
procedure TForm1.Button1Click(Sender: TObject);
mciSendString('OPEN NEW TYPE WAVEAUDIO ALIAS MicSound', nil, 0, Handle);
// MicSound is what the WaveAudio is asigned to.
// It is used in all the mciSendString so if you
// rename it to a diffrent name then you need to
// make sure you change it on all of them.
// If you dont know what I just said..
// hell I dont think I know what i just said
// then leave it the way it is, it will work ether way.
// The Following is pritty much self explanatory but I put
// the Notes out for those who dont follow.
mciSendString('SET MicSound TIME FORMAT MS ' +// set the time format
'BITSPERSAMPLE 8 ' +// 8 Bit
'CHANNELS 1 ' + // MONO
'SAMPLESPERSEC 8000 ' + // 8 KHz
'BYTESPERSEC 8000', // 8000 Bytes/s
nil, 0, Handle);
mciSendString('RECORD MicSound', nil, 0, Handle);
// Stop Record
procedure TForm1.Button2Click(Sender: TObject);
mciSendString('STOP MicSound', nil, 0, Handle);
// Save Wave File
procedure TForm1.Button3Click(Sender: TObject);
mciSendString(PChar('SAVE MicSound ' + 'C:\FileName.wav'), nil, 0, Handle);
mciSendString('CLOSE MicSound', nil, 0, Handle);
If you like the code then please vote.
And if anyone finds a source for changing Wav to Mp3,
Please let me know, I could realy use it.
Other 2 submission(s) by this author
|Report Bad Submission|
See Voting Log |
|Other User Comments|
|12/1/2003 1:09:37 AM:K. O. Thaha Hussain|
That code is great! It is working
Thaha Hussain, Systems
|12/1/2003 1:28:49 AM:Una-Rat|
Thanks for posting, I like the feedback
but I need some votes also :D
| Add Your Feedback! |
|Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name. |
NOTICE: The author of this code has been kind enough to share it with you. If you have a criticism, please state it politely or it will be deleted.
For feedback not related to this particular code, please click here.