Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to get voice data

How to get voice data

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pakFari
    wrote on last edited by
    #1

    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.

    K R 2 Replies Last reply
    0
    • P pakFari

      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.

      K Offline
      K Offline
      kakan
      wrote on last edited by
      #2

      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[^]

      P 1 Reply Last reply
      0
      • P pakFari

        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.

        R Offline
        R Offline
        Remco Hoogenboezem
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • K kakan

          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[^]

          P Offline
          P Offline
          pakFari
          wrote on last edited by
          #4

          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,

          K 1 Reply Last reply
          0
          • P pakFari

            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,

            K Offline
            K Offline
            kakan
            wrote on last edited by
            #5

            Good morning. I'm sorry, I haven't used this functions myself. So I can't tell you weather it's possible to get the contents of the stored sound or not. But good luck anyway. kakan

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups