2017-06-13 20:27:54 (edited by TJ.Breitenfeldt 2017-06-14 06:02:48)

my apppoligies , I originally posted this about NVDA, I meant jaws.

Hi, I have noticed this problem for a while, and I can't figure out why this is happening. When ever i have Jaws speak something using accessible_output2 in python while the pygame mixer is playing music in the background, jaws volume seems to fluctuate, going quiet, and gradually getting louder, and then softer again.

Does anyone know why this is happening and how to fix it?

TJ Breitenfeldt

2017-06-14 08:43:39

Hi,

this seems to be one case of audio ducking. As far as I know Windows supports stuff like this, which should enable the user to concentrate onto one bigger stream of audio and reduce the volume of other sounds to make listening to it easier. But don't ask me how you can change this. I can just tell you that it isn't any bug with you or your python code, you can't do anything about the speech volume via several external libraries, so AO2 can't do either. That's absolutely JAWS or Windows itself.

2017-06-14 21:07:00

So, it seems that NVDA is causing a similar problem, but NVDA just lowers the volume, rather than fluctuating it.

It seems strange to me because other games don't have this problem, i just started learning BGT and it does not have that problem.

TJ Breitenfeldt

2017-06-14 21:45:14

So, I did a Google search on disabling audio ducking on windows for an application, and this is what I found on a Microsoft site.

It is C++ code. I do not know C++ very well, so I do not understand exactly what this is doing, and I m not sure if this helps me at all, but perhaps someone can understand this and see if this can help with this problem.
I tried to compile it, but I am missing something because it is making a reference to a type
HRESULT
that I am guessing is not in the standard c++ library.


HRESULT DuckingOptOut(bool DuckingOptOutChecked)
{
    HRESULT hr = S_OK;

    IMMDeviceEnumerator* pDeviceEnumerator NULL;
    IMMDevice* pEndpoint = NULL;
    IAudioSessionManager2* pSessionManager2 = NULL;
    IAudioSessionControl* pSessionControl = NULL;
    IAudioSessionControl2* pSessionControl2 = NULL;


    //  Start with the default endpoint.

    hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), 
                          NULL, 
                          CLSCTX_INPROC_SERVER, 
                          IID_PPV_ARGS(&pDeviceEnumerator));
    
    if (SUCCEEDED(hr))
    {
        hr = pDeviceEnumerator>GetDefaultAudioEndpoint(eRender, eConsole, &pEndpoint);

        pDeviceEnumerator>Release();
        pDeviceEnumerator = NULL;
    }

    // Activate session manager.
    if (SUCCEEDED(hr))
    {
        hr = pEndpoint->Activate(__uuidof(IAudioSessionManager2), 
                                 CLSCTX_INPROC_SERVER,
                                 NULL, 
                                 reinterpret_cast<void **>(&pSessionManager2));
        pEndpoint->Release();
        pEndpoint = NULL;
    }
    if (SUCCEEDED(hr))
    {
        hr = pSessionManager2->GetAudioSessionControl(NULL, 0, &pSessionControl);
        
        pSessionManager2->Release();
        pSessionManager2 = NULL;
    }

    if (SUCCEEDED(hr))
    {
        hr = pSessionControl->QueryInterface(
                  __uuidof(IAudioSessionControl2),
                  (void**)&pSessionControl2);
                
        pSessionControl->Release();
        pSessionControl = NULL;
    }

    //  Sync the ducking state with the specified preference.

    if (SUCCEEDED(hr))
    {
        if (DuckingOptOutChecked)
        {
            hr = pSessionControl2->SetDuckingPreference(TRUE);
        }
        else
        {
            hr = pSessionControl2->SetDuckingPreference(FALSE);
        }
        pSessionControl2->Release();
        pSessionControl2 = NULL;
    }
    return hr;
}

Not sure if this helps at all. Hopefully someone has some idea.

TJ Breitenfeldt