How to get voice data
-
hi,when we speek in Microphone (during chatting)some binary data is stored in the RAM.can any one tell me the way through which i can access those bytes. i will be very thankful to u.
You can use DirectShow. From MSDN: An application can use Microsoft® DirectShow® to capture audio data from microphones, tape players, and other devices, through the inputs on the sound card. Typical scenarios include: Recording a voiceover narration for later dubbing over a video stream. Converting legacy analog audio content to digital format. Capturing voice or music for transmission over a network. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directshow/htm/audiocapture.asp[^]
-
hi,when we speek in Microphone (during chatting)some binary data is stored in the RAM.can any one tell me the way through which i can access those bytes. i will be very thankful to u.
Hello pakFari, You can use the standard windows functions to do this: MMRESULT waveInOpen ( LPHWAVEIN phwi, UINT uDeviceID, LPWAVEFORMATEX pwfx, DWORD dwCallback, DWORD dwCallbackInstance, DWORD fdwOpen ); MMRESULT waveInPrepareHeader ( HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh ); MMRESULT waveInAddBuffer ( HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh ); MMRESULT waveInStart ( HWAVEIN hwi ); MMRESULT waveInUnprepareHeader ( HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh ); MMRESULT waveInClose ( HWAVEIN hwi ); Details on these functions can be found in de Win32 Developer's References. I wrote a little example program to demonstrate these functions. This example records 60 seconds of low quality audio from the wave audio input device. I use a simple event callback mechanisme to signal the thread when recording is done. There are more elegant way's of doing this. But i think it is up to you to discover how... HANDLE hEvent; HWAVEIN hWaveIn; WAVEFORMATEX WaveFormat= { 1, //wFormatTag 1, //nChannels 8000, //nSamplesPerSec 8000, //nAvgBytesPerSec 1, //nBlockAlign 8, //wBitsPerSample 0 //cbSize }; WAVEHDR WaveHeader; hEvent=CreateEvent(NULL,TRUE,FALSE,NULL); if(hEvent==NULL) { //Handle error return; } //Open wave audio input device if(waveInOpen(&hWaveIn,WAVE_MAPPER,&WaveFormat,(DWORD)hEvent,0,CALLBACK_EVENT)!=MMSYSERR_NOERROR) { //Handle Error return; } WaveHeader.lpData=new BYTE[60*WaveFormat.nAvgBytesPerSec]; WaveHeader.dwBufferLength=60*WaveFormat.nAvgBytesPerSec; WaveHeader.dwFlags=0; //Prepare a wave header for waveform-audio input if(waveInPrepareHeader(hWaveIn,&WaveHeader,sizeof(WAVEHDR))!=MMSYSERR_NOERROR) { //Handle Error return; } //Send a input buffer to the given waveform-audio input device if(waveInAddBuffer(hWaveIn,&WaveHeader,sizeof(WAVEHDR))!=MMSYSERR_NOERROR) { //Handle Error return; } if(waveInStart(hWaveIn)!=MMSYSERR_NOERROR) { //Handle Error return; } ResetEvent(hEvent); WaitForSingleObject(hEvent,INFINI
-
You can use DirectShow. From MSDN: An application can use Microsoft® DirectShow® to capture audio data from microphones, tape players, and other devices, through the inputs on the sound card. Typical scenarios include: Recording a voiceover narration for later dubbing over a video stream. Converting legacy analog audio content to digital format. Capturing voice or music for transmission over a network. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directshow/htm/audiocapture.asp[^]
thankx a lot, i am really thankful to u,actually i am working on voicechat project,for this i have a logic;that input from mic that is temparary stored in Ram, read those bytes and at the same time send to other client,this idea is okay,plz guide me in this way.again thankx,
-
thankx a lot, i am really thankful to u,actually i am working on voicechat project,for this i have a logic;that input from mic that is temparary stored in Ram, read those bytes and at the same time send to other client,this idea is okay,plz guide me in this way.again thankx,