Determine direction without playing audio RRS feed

  • Question

  • Hi,

    I'm currently trying to determine to direction of an audio source with the Kinect Microphone Array in C++. The Echo-Cancellation-Demo works fine, however, one needs to play some audio at least at the beginning of the detection loop. Is there any way to work around that? I don't need the echo cancellation, so I already tried to use "Microphone array" instead of "Microphone array with AEC", but that didn't work.

    The IMediaObject interface provices, as I have seen, a ProcessInput method, but the remarks from MSDN say one needs to set the buffer with a call to ProcessOutput first. However, that's exactly what I want to circumvent. I took a look into the other audio samples and this forum, but I guess I don't understand the basics yet.

    So any help you can give me is really appreciated!


    Saturday, November 19, 2011 7:17 PM


  • You do need to make a call to ProcessOutput, but this does not result in audio playing.  ProcessOutput is your way to get at the results of the DMO's processing.  The first call must be made before the DMO can start processing data, as it configures the buffer to which the DMO will write.

    e.g. your audio loop might look like this, assuming that you've QI'd for INuiAudioBeam into pNuiAduiSource, and the DMO is help at pDMO

    ULONG cbProduced;
    CStaticMediaBuffer captureBuffer;
     DWORD dwStatus = 0;
     DMO_OUTPUT_DATA_BUFFER outputBuffer = {0};
     outputBuffer.puffer = &captureBuffer;
    HRESULT hr = S_OK;
         outputBuffer.dwStatus = 0;
         hr = pDMO->ProcessOutput(0,1, &outputBuffer, &dwStatus);
        if (FAILED(hr))
        if (hr == S_FALSE)
             cbProduced = 0;
             captureBuffer.GetBufferAndLength(&pProduced, &cbProduced);
        if (cbProduced == 0)
        double beamAngle, sourceAngle, sourceConfidence;
        // Obtain beam angle from INuiAudiBeam 
         pNuiAudioSource->GetPosition(&sourceAngle, &sourceConfidence);
         // Do whatever else you want with the audio signal before looping 
       } while (outputBuffer.dwStatus & DMO_OUTPUT_DATA_BUFFERF_INCOMPLETE);

    Monday, March 26, 2012 6:07 PM