Author Topic: How to do a simple bass cut?  (Read 482 times)

martin71

  • Posts: 34
How to do a simple bass cut?
« on: 7 Apr '18 - 21:11 »
I don't understand how to filter the bass from a channel. I have seen an equalizer example in Visual Basic but I'm using PureBasic and I don't know how to convert this. Can someone help?

martin71

  • Posts: 34
Re: How to do a simple bass cut?
« Reply #1 on: 8 Apr '18 - 19:47 »
I figured it out how to convert this  ;D

martin71

  • Posts: 34
Re: How to do a simple bass cut?
« Reply #2 on: 12 Apr '18 - 12:52 »
I know now how to apply the BASS_DX8_PARAMEQ parameters in Purebasic. But I still don't know what the best parameters are for filtering out the bass (beats).  Can anyone help, or can this only be done with the BASS_FX add-on?

Ian @ un4seen

  • Administrator
  • Posts: 21133
Re: How to do a simple bass cut?
« Reply #3 on: 12 Apr '18 - 17:26 »
For a bass cut effect, you would probably want to use a high-pass filter. BASS doesn't provide such an effect itself, but the BASS_FX add-on does via its BASS_FX_BFX_BQF option. For example, you could do something like this:

Code: [Select]
DWORD fx = BASS_ChannelSetFX(stream, BASS_FX_BFX_BQF, 0); // add a filter to a stream
BASS_BFX_BQF param;
param.lFilter = BASS_BFX_BQF_HIGHPASS; // high-pass filter
param.fCenter = 100; // 100 Hz cutoff frequency
param.fBandwidth = 0;
param.fQ = 0.7;
param.lChannel = BASS_BFX_CHANALL;
BASS_FXSetParameters(fx, &param); // apply the filter parameters

That's in C/C++ rather than Purebasic, but hopefully it isn't too hard to translate (it will be much the same in any language).

martin71

  • Posts: 34
Re: How to do a simple bass cut?
« Reply #4 on: 12 Apr '18 - 21:16 »
Thanks a lot Ian!

martin71

  • Posts: 34
Re: How to do a simple bass cut?
« Reply #5 on: 21 May '18 - 14:13 »
Hello Ian,

I translated your code to PureBasic but I don't hear any difference in the sound, even when I change the values of param. BASS don't return any errors, so I wonder if you hear an effect when you try your own C example. If yes, then probably somethings wrong in my bass_fx.pbi file. But the strange thing is that other sound effects do work.

Code: [Select]
XIncludeFile "bass.pbi"
XIncludeFile "bass_fx.pbi"
 
OpenWindow(0, #PB_Ignore, #PB_Ignore, 610, 220, "Test")
BASS_Init(-1, 44100, 0, 0, #Null)

Filename.s = "test.wav"
chan = BASS_StreamCreateFile(0, @Filename, 0, 0, #BASS_UNICODE)

Dim param.BASS_BFX_BQF(0)
param(0)\lFilter = #BASS_BFX_BQF_HIGHPASS
param(0)\fCenter = 100
param(0)\fQ = 0.7
param(0)\lChannel = #BASS_BFX_CHANALL

fx = BASS_ChannelSetFX(chan, #BASS_FX_BFX_BQF, 0)
BASS_FXSetParameters(fx, @param(0))
BASS_ChannelPlay(chan, 0)

MessageRequester("test","click ok button to quit")

BASS_StreamFree(chan)
BASS_Free()

Best regards,

Martin
« Last Edit: 21 May '18 - 14:25 by martin71 »

Ian @ un4seen

  • Administrator
  • Posts: 21133
Re: How to do a simple bass cut?
« Reply #6 on: 21 May '18 - 17:17 »
Are you sure the BASS_ChannelSetFX call is successful, ie. "fx" is not 0? The reason I ask is that it doesn't look like the BASS_FX add-on is loaded in the code above, ie. no BASS_FX function calls. If that's fine, does the TEST.WAV file have a strong signal below 100 Hz? You could try raising the "fCenter" value and see if you hear a difference then. To confirm whether the effect is being applied at all, you could also try changing BASS_BFX_BQF_HIGHPASS to BASS_BFX_BQF_LOWPASS, which should make a very audible difference. Make sure "fBandwidth" is set to 0 too.

martin71

  • Posts: 34
Re: How to do a simple bass cut?
« Reply #7 on: 21 May '18 - 19:07 »
Oh stupid me! The variable fx was zero indeed, because I didn't call BASS_GetVersion(). I changed this and now it's working and I am very happy :D

Thanks for your quick help Ian!