How to capture voice input?

Posted on 2000-03-03
Last Modified: 2010-04-10
I am writing a Visual C++ program that have to capture the time whenever there is a voice input towards the microphone. I have no idea how to work it out as I am a novice towards multimedia programming. Please help, it is very urgent.
Question by:LiWangOn
  • 3
  • 2

Expert Comment

ID: 2582552
1. MCIWnd Window Class

Recording with MCIWnd Controls

2. MCI

Recording with a Waveform-Audio Device

3. Waveform Audio

Example of Writing Waveform Data

Recording and Playing Waveform Audio

4. DirectSound

Tutorial 2: Capturing a Sound

Author Comment

ID: 2582631
Thx for the reply, but that's not what exactly I want to do. What I want to do is to know when there is a voice input towards the microphone so that I could ask the program to progress on other activity.

Expert Comment

ID: 2583271
->What I want to do is to know when there is a voice input towards the microphone so that I could ask the program to progress on other activity.
hmm...I think the answer is what you want.plz check it and You will find the answer there.
Anyway,good luck.
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.


Author Comment

ID: 2584241
I think I get your point. You mean I should analyze the data in the buffer while capturing the sound?

But I still confuse that how could I know which sample is having the "voice", and how to know the corresponding time of that sample?

(Actually I am writing a program to get respond time)

Author Comment

ID: 2584978
I want to get the time difference (in ms) between a word presented on the computer screen and the user's respond towards the microphone.

Accepted Solution

bkdc earned 50 total points
ID: 2682153
1. open the wave device with waveInOpen
with let's say callback function
2. create some buffers (one might be enough) of 1/2 (or other period) seconds.
3. get and store the system time - GetSysteTime (or use a timer) and then call waveInStart
4. when a buffer is recorded your callback function will be called (obvious that 1/2 sec elapsed)
5. any buffer will have some values in it differing from 0 (background noise).
If it's noise then it's usually in a narrow range (for example my sb./mic. generates noise between  -800 till -580
If the samples are not in this range then it's voice.
6. calculate the exact time when voice starts (using the sample index in the buffer and the sampling frequency)

7. of course you must have the time when the word was shown on the monitor

8. a simple substraction should give you the answer


Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now