Record easy a wavefile. Windows Code only

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Record easy a wavefile. Windows Code only

Post by BackupUser »

Code updated for 5.20+

Restored from previous forum. Originally posted by Rings.

Record easy a wavefile.Windows Code only.

Code: Select all

Procedure RecordWave(Filename.s, RecordTime)
  RS.s = Space(128)
  DeleteFile(filename)
  
  i = mciSendString_("open new type waveaudio alias capture", RS, 128, cb)
  i = mciSendString_("record capture", RS, 128, cb) 
  
  Delay(RecordTime)
  
  i = mciSendString_("save capture " + filename, RS, 128, cb)
EndProcedure

MessageRequester("Info","Capture Audio to c:\test.wav",0)
RecordWave("C:\test.wav", 2000)
MessageRequester("Info", "Ready...", 0)
 
Its a long way to the top if you wanna .....CodeGuru
:wink:
Last edited by fsw on Thu Aug 22, 2013 6:08 pm, edited 2 times in total.
Reason: Code updated for 5.20+
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

Note to anyone using the above tip: You can leave out the vSpace()
procedure totally and replace all vSpace() references with PureBasic's
own Space() command instead.

Also, if you want to change the sample rate (etc), see this web page:

http://www.geocities.com/smigman.geo/mci/wav.html


PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Paul.

There is actually a code snippet on the Resources Site (back from February) that shows how to do this along with sample rate settings, etc. :wink:


----------
Visit the PB Resources Site at http://www.reelmediaproductions.com/pb
Post Reply