Click here to Skip to main content
15,920,896 members
Articles / Programming Languages / C++/CLI
Article

recording and play using Waveform audio interface

Rate me:
Please Sign up or sign in to vote.
2.25/5 (18 votes)
10 Jun 20051 min read 101.1K   4.3K   37   24
This article allow you to recording and replay.

Introduction

At first time,this is update.This project introduces how to use waveInopen and waveOutopen to recording and play the waveform audio.This is MFC application using VC++.The purpose is to help to understand waveform audio function,so that i don't build completely a program recording.

What will you find in my demo:

1. I use C to write some function:

    DoRecord(): to begin record.

    DoRecord_end(): to end record

    DoPlay(): to play the recording voice.

2. In function DoRecord():

    I show you how to use WaveInOpen with CALLBACK_FUNCTION waveInproc. I also show you how to use waveInPrepareHeader,waveInAddBuffer and waveInStart to begin recording your voice.Specially, i introduce how to use waveInproc.

3. In fucntion DoPlay():

    I show you how to use WaveOutOpen,waveOutPrepareHeader,waveOutWrite.

Demo:

  1) Click Record to begin recording your voice.

  2) Click Record_end when you finish your recording.

  3) Click Play to hear your voice.

Future: 

  I will add some function to allow to save your recording to a file wav. And some other function to allow to choose the format of wave audio.

  I will show some other technique to use CALLBACK like CALLBACK_EVENT,CALLBACK_WINDOW or CALLBACK_THREAD to process the voice recording.

  I will add some other function socket or rtp so you can transfer your recording or to voice chat with other.

 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Vietnam Vietnam
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionCrashed on Windows7 Pin
usb_usb24-Apr-12 20:03
usb_usb24-Apr-12 20:03 
GeneralBuffer length Pin
mohitagandotra7-Dec-10 4:03
mohitagandotra7-Dec-10 4:03 
GeneralMy vote of 4 Pin
deexian20-Oct-10 6:02
deexian20-Oct-10 6:02 
Generalvery nice Pin
Seshaal19-Apr-09 16:25
Seshaal19-Apr-09 16:25 
QuestionCan i Play the Audio Directly. Pin
Eakalavya10-Apr-08 21:50
Eakalavya10-Apr-08 21:50 
GeneralIssue with 8000 sample per second Pin
Eakalavya2-Apr-08 6:57
Eakalavya2-Apr-08 6:57 
QuestionSave problem Pin
keggy8531-Jul-07 6:14
keggy8531-Jul-07 6:14 
Questionface problem to run Pin
amit chatter23-Feb-07 18:11
amit chatter23-Feb-07 18:11 
Generalrecord voice on a website Pin
Janang29-Jan-07 15:59
Janang29-Jan-07 15:59 
GeneralAudio saving Pin
Newbee0724-Jan-07 3:46
Newbee0724-Jan-07 3:46 
GeneralRe: Audio saving Pin
Gustavo_Cruz18-May-07 7:29
Gustavo_Cruz18-May-07 7:29 
GeneralRe: Audio saving Pin
burgales25-Jun-07 14:47
burgales25-Jun-07 14:47 
GeneralRe: Audio saving Pin
general_era18-May-08 22:09
general_era18-May-08 22:09 
Generalhi ! i saw ur code it was excellent !!! Pin
Shailesh Namjoshi17-Jan-07 22:08
Shailesh Namjoshi17-Jan-07 22:08 
GeneralExcellent Code Pin
pgien27-Aug-06 11:57
pgien27-Aug-06 11:57 
Generalrecording and sending .WAV FILE Pin
REU22-Sep-05 5:36
REU22-Sep-05 5:36 
HI DUDE

HEY THE ARTICLE AND THE EXAMPLE IS VERY GOOD
BUT I NEED 2 THINGS THAT ALREADY SOMEBODY DID ASK TO YOU

HOW CAN I WRITE THE .WAV FILE

YOU SAID THAT I CAN USE FOPEN, FWRITE, FCLOSE
I REALLY DONT KNOIW HOW TO USE THAT, CAN YOU HELP ME.
AND ALSO YOU SAID THAT THE CALLBACK FUNCTIONS REPEATS EVERY TIME THE BUFFER IS FULL, IF I WRITE THE FILE EACH TIME THE BUFFER IS FULL, I WILL HAVE MY .WAV FILE. LIKE A LOT OF FILES
HOW CAN I WRITE JUST 1 FILE,

DO YOU HAVE THE CODE FOR THAT, CAN YOU WRITE THE FUNCTION AND EXPLAIN TO ME HOW TO USE IT ????

MY OTHER QUESTION IS THAT I MUST TO SEND THE .WAV FILE THROUGH A SOCKET
SO I GAVE SOCKETS SUPPORT FOR THE APP , BUT I DONT KNOW HOW TO SEND ???
USING THE SEND FUNCTION CAN YOU EXPLAIN TO ME ???

DO YOU THINK THAT IS BETTER TO WRITE THE WAV FILE AND THEN WHEN I FINISH THAT , THEN TO SEND ALL THE FILE THROUGH THE SOCKET, OR WHAT DO YOU THINK IF I TAKE THE DATA I HAVE CAPTURE AND I SEND THAT STREAM THROUGH THE SOCKET , THEN IN THE OTHER SIDE, IN THE CLIENT I TAKE THAT STREAM AND I WRITE THE .WAV FILE,
COULD YOU HELP ME TO DO THAT.

ITS REALLY URGENT TO ME TO DO THAT CAUSE I NEED TO IMPLEMENT THAT IN ONE PROJECT IM DOING TO FINISH THIS SEMESTER IN THE UNIVERSITY, SO PLEASE MY BROTHER TRY TO HELP ME,

GOD BLESS YA

REUBEN GUTIERREZ


MY EMAIL ADDRESS IS

rubencia@yahoo.com

thanx again

REU
Generalsaving n sending a .wav file Pin
Nilegna29-Jul-05 0:27
Nilegna29-Jul-05 0:27 
GeneralRe: saving n sending a .wav file Pin
Anonymous29-Jul-05 4:12
Anonymous29-Jul-05 4:12 
GeneralRe: saving n sending a .wav file Pin
hobin092023-Mar-06 18:46
hobin092023-Mar-06 18:46 
GeneralNot work on PocketPC Pin
beichuang21-Jun-05 4:53
beichuang21-Jun-05 4:53 
GeneralRe: Not work on PocketPC Pin
nghiath21-Jun-05 10:45
nghiath21-Jun-05 10:45 
GeneralRe: Not work on PocketPC Pin
beichuang23-Jun-05 0:11
beichuang23-Jun-05 0:11 
GeneralRe: Not work on PocketPC Pin
cherrychia15-Jun-06 20:37
cherrychia15-Jun-06 20:37 
GeneralRe: Not work on PocketPC Pin
zhumanli19-Jun-07 11:57
zhumanli19-Jun-07 11:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.