Author Topic: Automatic Gain Control with BASS_DX8_COMPRESSOR or BASS_BFX_COMPRESSOR2?  (Read 563 times)

-lukas-

  • Posts: 23
Hello,

Looking for Automatic Gain Control during voice recording. I found BASS_DX8_COMPRESSOR and BASS_BFX_COMPRESSOR2. It is not clear to me what the differences between them. Which option is best suited for my use? Or is for Automatic Gain Control better some other function?

BASS_BFX_COMPRESSOR2 link to docs: http://bass.radio42.com/help/html/96c2cfed-1f91-8af7-b2d1-d0bb380f914e.htm
BASS_DX8_COMPRESSOR link to docs: http://bass.radio42.com/help/html/7781ab8f-4ae3-639d-0d86-89e2a144c866.htm

Thanks!
« Last Edit: 24 Mar '16 - 12:55 by -lukas- »

Ian @ un4seen

  • Administrator
  • Posts: 20436
The BASS_DX8_COMPRESSOR is a compressor effect provided by DirectX, while BASS_BFX_COMPRESSOR2 is a compressor effect provided by the BASS_FX add-on. They basically do the same thing, but the DirectX compressor effect doesn't work properly with floating-point data (eg. when using BASS_SAMPLE_FLOAT), so I would generally recommend using the BASS_FX one instead. For automatic gain control, you could also take a look at the BASS_FX_BFX_DAMP effect.

-lukas-

  • Posts: 23
Ian, thank you for your response! :) Thanks for the tip on DAMP! I see that for Automatic Gain Control would suffice just DAMP. I understand that correctly?

(Perhaps it would help me a broader description of all effects and examples of what can be used. This is somewhere on the web a wider description?)

-lukas-

  • Posts: 23
I have this code:
Code: [Select]
            RecInit = Bass.BASS_RecordInit(-1)

            strm = Bass.BASS_RecordStart(_Samplerate, _Channels, BASSFlag.BASS_RECORD_PAUSE, myrec, IntPtr.Zero)

            Dim AGC As New AddOn.Fx.BASS_BFX_DAMP
            AGC.Preset_Medium()
            Dim fxACGhandle As Integer = Bass.BASS_ChannelSetFX(strm, BASSFXType.BASS_FX_BFX_DAMP, 1)

            Bass.BASS_ChannelPlay(strm, False)
...but fxACGhandle is always 0. It's okay?

At signal AGC has no effect - I did not see any changes. When I set fGain should be to 10, so change should be significant ... Or not?

Please What can I do to AGC work?
« Last Edit: 25 Mar '16 - 08:38 by -lukas- »

Ian @ un4seen

  • Administrator
  • Posts: 20436
A 0 return value from BASS_ChannelSetFX means the call failed. You can use BASS_ErrorGetCode to get an error code and look that up in the function's documentation to find out why it failed. In this case, I suspect it's probably BASS_ERROR_ILLTYPE, which means the effect type is unrecognised. If so, you need to ensure that the BASS_FX library is loaded before using any effects from it. You can do that by calling a BASS_FX function, eg. BASS_FX_GetVersion in your initialization code.

The "DAMP" effect is based on the code in the following post, so you can check that if you would like to know more about what the parameters do:

   www.un4seen.com/forum/?topic=927.msg4919#msg4919

-lukas-

  • Posts: 23
Thanks Ian! :) It's working! 8)

I added initialization as follows:
Code: [Select]
AddOn.Fx.BassFx.LoadMe()
If anyone needed to know what are default presets of BASS_BFX_DAMP, here is:
Quote
Preset_Hard: Quiet: 0,04; Gain: 2; Delay: 0,2; Rate: 0,02; Target: 0,98
Preset_Medium: Quiet: 0,03; Gain: 1; Delay: 0,35; Rate: 0,01; Target: 0,94
Preset_Soft: Quiet: 0,02; Gain: 1; Delay: 0,5; Rate: 0,01; Target: 0,92