Author Topic: Real-time audio effects on the speakers output  (Read 239 times)

Luka

  • Guest
Hello!

I wonder if it is possible to achieve the following scenario with BASS.net library.

I would like to add effects (equalizer, 3d sound) to speakers (everything that is playing on this output). Is there a way to achieve this in real-time?

I did some research with WASAPI, however I have not found any examples or documentation that would describe how to set-up such application.

With regards,
Luka


Ian @ un4seen

  • Administrator
  • Posts: 25288
Re: Real-time audio effects on the speakers output
« Reply #1 on: 22 May '23 - 12:58 »
I believe you would need to implement an APO (Audio Processing Object) for that. Here's Microsoft's documentation on that subject:

   https://learn.microsoft.com/en-us/windows-hardware/drivers/audio/implementing-audio-processing-objects

Luka

  • Guest
Re: Real-time audio effects on the speakers output
« Reply #2 on: 22 May '23 - 17:55 »
Thank you for the suggestion.

Is APO supported in the BASS library?

Ian @ un4seen

  • Administrator
  • Posts: 25288
Re: Real-time audio effects on the speakers output
« Reply #3 on: 23 May '23 - 13:43 »
No, I'm afraid not. You would need to implement the APO stuff yourself. Here's some example code from Microsoft:

   https://github.com/microsoft/Windows-driver-samples/tree/main/audio/sysvad/APO/SwapAPO

The APOProcess function in the swapaposfx.cpp file could be modified to use BASS by replacing its ProcessSwap call with a BASS_ChannelGetData call:

Code: [Select]
BASS_ChannelGetData(fxdummy, pf32InputFrames, ppInputConnections[0]->u32ValidFrameCount * m_u32SamplesPerFrame * sizeof(float));

Where fxdummy is a "dummy" stream created with BASS_StreamCreate:

Code: [Select]
fxdummy = BASS_StreamCreate(rate, chans, BASS_SAMPLE_FLOAT | BASS_STREAM_DECODE, STREAMPROC_DUMMY, 0);

The fxdummy handle would also be used in BASS_ChannelSetFX calls, eg. to set an equalizer on it. But perhaps there are existing APOs available that you can use instead of implementing your own? For example, there's an "Equalizer APO" that seems to do at least part of what you want.