AecSDKDemo filters mp3 but not sockets

PeadarO 11 Reputation points
2021-05-04T10:11:05.917+00:00

I am having an issue with AecSDKDemo

I can play an mp3 and record my voice at the same time and it filters out the music perfectly

However if I receive a voice through a socket and play it, it fails to filter out the voice.

I am using exactly the same code to play the mp3 as I am using to play the received voice.

iSystemMode is set to SINGLE_CHANNEL_AEC and I have tried setting it to zero too.

I seem to have tried every value in all of the input fields

I'd be very grateful if someone could throw any light on this and I'll certainly make the solution public here.
Thank you in advance.
Peadar

Windows development | Windows API - Win32
{count} votes

2 answers

Sort by: Most helpful
  1. PeadarO 11 Reputation points
    2021-05-16T08:51:49.337+00:00

    Hello Microsoft,

    This is not an answer but I can possibly make the issue clearer now.
    
    I've run extensive tests on the AecSDKDemo and I can definitely say that it doesn't work in its current form but that there is not much wrong with it and I believe it could be fixed.
    

    I connected two computers with UDP sockets in a VC++ program and spoke into a microphone on the first one. My voice went through the AecSDKDemo system and then through the LAME encoder and then I sent it to the other computer through the sockets where I can decompress and play it. That works fine.

    However when I have another thread running on the second computer with the AecSDKDemo running there too, I turn the speakers and microphone off (on the second computer) and put the output onto a PCM file on the second computer. The PCM file should have no sound at all in it but I can clearly hear the voice that has come over from the first computer, the voice that should have been filtered out.

    I see that the AecSDKDemo almost works because I can play music on a computer and record my voice on it at the same time and it filters the music out very well and stores my voice. However if the music/voice is coming in on a socket from another computer then the AecSDKDemo doesn't filter THAT out. It seems that it is filtering out something that is played on disk but not what it receives on a socket.

    I'd be very grateful if anyone could sort this out and I'll certainly make the solution public here.

    If I can be of any assistance or if you need any other information or code just let me know.

    Peadar, Ireland 16.05.2021

    0 comments No comments

  2. PeadarO 11 Reputation points
    2021-05-18T09:48:58.547+00:00

    Attention of Eddy Escardo-Raffo

    Eddy, I'd like to ask you a question please as you have answered similar questions before.

    AecSDKDemo doesn't actually work but it is very close to working.
    If I play music from an mp3 file on a computer and record my voice on it at the same time it works perfectly.
    I create a pcm or mp3 and I can hear my voice and the music has been perfectly filtered out.

    However if that same computer is receiving the music from another computer via a socket and playing it
    then AecSDKDemo fails to filter that music out and when I listen to my voice in the pcm or mp3
    that I have created, I can hear the music that was meant to be filtered out.

    I ran the code that you posted and cSpeakers is equal to 1.
    That means that iSpkDevIdx can only be equal to zero.

    I have tried iSpkDevIdx with all values between -2 and +2 and there is no change.
    I believe that I have tried all the possible values for all the variables in the program.

    msdn social gave me the contact details for Paul Knopf in Florida who wrote the software
    but he doesn't deal with direct contacts.

    I also tried these lines of code which you posted but the don't compile

    include <functiondiscoverykeys_devpkey.h>

    hr = GetMicArrayDeviceIndex(&iMicDevIdx);
    CHECK_RET(hr, "Failed to find microphone array device. Make sure microphone array is properly installed.");

    The program definitely can't be used at all if this issue isn't sorted out since it has been written to filter live voice
    in a mutual voice exchange layout. When used live it has major echo problems.

    Any help greatly appreciated and I'll certainly make any solution public.

    Peadar

    PS This is the code that I ran. You posted it in 2011.

    IMMDeviceEnumerator* pEnumerator = NULL;
    IMMDeviceCollection* pSpeakers = NULL;
    UINT cSpeakers = 0;

    CHECKHR(CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), (void**)&pEnumerator));
    CHECKHR(pEnumerator->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, &pSpeakers));
    CHECKHR(pSpeakers->GetCount(&cSpeakers));

    _tprintf(_T("Choose a speaker device:\n"));
    for (UINT iSpeaker = 0; iSpeaker < cSpeakers; iSpeaker++)
    {
    IMMDevice* pSpeaker;
    IPropertyStore* pSpeakerStore;

    CHECKHR(pSpeakers->Item(iSpeaker, &pSpeaker));
    CHECKHR(pSpeaker->OpenPropertyStore(STGM_READ, &pSpeakerStore));
    PROPVARIANT pvSpeakerName;
    CHECKHR(pSpeakerStore->GetValue(PKEY_DeviceInterface_FriendlyName,&pvSpeakerName));
    
    _tprintf(_T("%i - %s\n"), iSpeaker, pvSpeakerName.pwszVal);
    

    }
    int chosenSpeaker = _getch() - '0';
    if ((chosenSpeaker >= 0) && (chosenSpeaker < cSpeakers))
    {
    iSpkDevIdx = chosenSpeaker;
    }

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.