Page 1 of 1
Posted: Sat Oct 26, 2002 10:09 am
by BackupUser
Restored from previous forum. Originally posted by Chevron.
How would I go about recording an input from a microphone? Any examples or pointers greatly appreiated.
Thanks
Posted: Sat Oct 26, 2002 10:12 am
by BackupUser
Restored from previous forum. Originally posted by PB.
> How would I go about recording an input from a microphone?
viewtopic.php?t=1288
PB - Registered PureBasic Coder
Posted: Sat Oct 26, 2002 10:14 am
by BackupUser
Restored from previous forum. Originally posted by Chevron.
Thats great PB, thanks for pointing me there, I did try a search, I must be blind.
Posted: Sat Oct 26, 2002 10:22 am
by BackupUser
Restored from previous forum. Originally posted by PB.
> thanks for pointing me there, I did try a search, I must be blind.
Hehehe, no problem.
Note the reply I just made to that tip about the
Space() command...
PB - Registered PureBasic Coder
Posted: Sat Oct 26, 2002 10:54 am
by BackupUser
Restored from previous forum. Originally posted by Chevron.
Is there anyway I can set the sample rate with this example?
Posted: Sat Oct 26, 2002 11:02 am
by BackupUser
Restored from previous forum. Originally posted by PB.
> Is there anyway I can set the sample rate with this example?
Yes -- see my reply to the above post again; I just updated it with
a link to a site about it.
PB - Registered PureBasic Coder
Posted: Sat Oct 26, 2002 11:36 am
by BackupUser
Restored from previous forum. Originally posted by Chevron.
Thanks PB, more Info there than I could possible need, doesn't seem to let you set bit rate to 8000hz though, which is what I wanted, I'll have to look at converting the file from 11,025hz to 8000hz in another manner.
Posted: Sat Oct 26, 2002 12:04 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
> doesn't seem to let you set bit rate to 8000hz though
From
http://tinyurl.com/281v I worked out that you need to specify the
"bytespersec" setting to 8000 in addition to the "samplespersec" setting.
So here's a working example (tested successfully):
Code: Select all
Procedure RecordWave(Filename.s,RecordTime)
RS.s = Space(128)
DeleteFile(filename)
i = mciSendString_("open new type waveaudio alias capture", RS, 128, 0)
i = mciSendString_("set capture samplespersec 8000 bytespersec 8000", 0, 0, 0)
i = mciSendString_("record capture", RS, 128, 0)
Delay(RecordTime)
i = mciSendString_("save capture " + filename, RS, 128, 0)
EndProcedure
;
MessageRequester("Info","Capture Audio to c:\test.wav",0)
RecordWave("C:\test.wav",2000)
MessageRequester("Info","Done!",0)
PB - Registered PureBasic Coder
Posted: Sat Oct 26, 2002 5:05 pm
by BackupUser
Restored from previous forum. Originally posted by Paul.
Check out the Code Snippet from February on the Resources Site... it will show you how to properly record WAV files using MCI commands at any sample/bit rate.
(search for WAV in Code Snippet section)
----------
Visit the PB Resources Site at
http://www.reelmediaproductions.com/pb