Recent

Author Topic: [SOLVED] Bass.dll equalizer unit  (Read 848 times)

Pe3s

  • Hero Member
  • *****
  • Posts: 641
[SOLVED] Bass.dll equalizer unit
« on: January 23, 2026, 10:45:56 am »
Hello, I wrote an equalizer module, but it doesn't work. I don't know what I wrote wrong. Could you please help me find the error?
« Last Edit: January 23, 2026, 09:29:19 pm by Pe3s »

LeP

  • Full Member
  • ***
  • Posts: 124
Re: Bass.dll equalizer unit
« Reply #1 on: January 23, 2026, 10:52:29 am »
Can you provide more info ? What means "doesn't work", what are the issues ?

Pe3s

  • Hero Member
  • *****
  • Posts: 641
Re: Bass.dll equalizer unit
« Reply #2 on: January 23, 2026, 11:05:45 am »
The sound does not change, as if the equalizer were not working.

Boleeman

  • Hero Member
  • *****
  • Posts: 1106
Re: Bass.dll equalizer unit
« Reply #3 on: January 23, 2026, 02:46:39 pm »
This plays in Windows10 64Bit.
Not sure about equalizer function, but after I load the wav and press play  I get sound.

In project inspector you were missing the required units. I fixed that for you.

Need to have the Bass.dll in the folder where the exe is.

Enjoy
« Last Edit: January 23, 2026, 02:54:18 pm by Boleeman »

Pe3s

  • Hero Member
  • *****
  • Posts: 641
Re: Bass.dll equalizer unit
« Reply #4 on: January 23, 2026, 03:45:42 pm »
It used to play sound, but now the equalizer does not work and there is no change in sound.

Josh

  • Hero Member
  • *****
  • Posts: 1454
Re: Bass.dll equalizer unit
« Reply #5 on: January 23, 2026, 07:45:41 pm »
few years sinced i used bass
i remember its best to put
Code: Pascal  [Select][+][-]
  1. BASS_FX_GetVersion();
after you set
Code: Pascal  [Select][+][-]
  1. if not BASS_Init(-1, 44100, 0, Handle, nil) then
  2.     ShowMessage('BASS init error: ' + IntToStr(BASS_ErrorGetCode));
it forces it to load bass_fx.dll, so make sure its there.

also in
Code: Pascal  [Select][+][-]
  1. EQ_Attach
add following to see if its silently failing.
Code: Pascal  [Select][+][-]
  1. for i := 0 to EQ_BANDS-1 do
  2. begin
  3.   fxEQ[i] := BASS_ChannelSetFX(Channel, BASS_FX_BFX_PEAKEQ, 0);
  4.   if fxEQ[i] = 0 then ShowMessage('Cant set FX EQ : '+IntToStr(BASS_ErrorGetCode));
  5.   .....
« Last Edit: January 23, 2026, 07:53:49 pm by Josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Pe3s

  • Hero Member
  • *****
  • Posts: 641
Re: Bass.dll equalizer unit
« Reply #6 on: January 23, 2026, 07:54:19 pm »
All bass files are available.
Bass.dll version 2.4
Bass_fx.dll version 2.4.12.1
latest available for download

cdbc

  • Hero Member
  • *****
  • Posts: 2603
    • http://www.cdbc.dk
Re: Bass.dll equalizer unit
« Reply #7 on: January 23, 2026, 08:10:47 pm »
Hi
After a quick search on google (how to get Bass equalizer working in free pascal and lazarus?), I got this:
Quote
To implement a bass equalizer in Free Pascal using the Lazarus IDE, you must use the BASS core library along with the BASS_FX add-on module.
1. Requirements and Setup
Download Libraries: Obtain both bass.dll and bass_fx.dll (Windows) or their respective .so (Linux) files from Un4seen Developments.
API Units: Add bass.pas and bass_fx.pas to your project folder and include them in your uses clause.
Binary Matching: Ensure you use 32-bit DLLs if compiling for 32-bit, or 64-bit DLLs for 64-bit builds; mixing them will cause errors.
2. Implementation Steps
The most common method for a multi-band equalizer is using the BASS_FX_BFX_PEAKEQ effect.
Step A: Initialize the Equalizer
You must first set the effect on your active stream and define the center frequency for the "bass" band (typically around 80Hz to 125Hz).
pascal
var
  fxHandle: HFX;
  eq: BASS_BFX_PEAKEQ;
begin
  // Set the peaking equalizer effect on the stream (myStream)
  fxHandle := BASS_ChannelSetFX(myStream, BASS_FX_BFX_PEAKEQ, 0);

  // Initialize parameters for the bass band
  eq.lBand := 0;             // Band index (0-indexed)
  eq.fCenter := 100;         // Center frequency (100 Hz for bass)
  eq.fBandwidth := 18;       // Bandwidth in semitones
  eq.fGain := 0;             // Initial gain (0 dB)
  eq.lChannel := BASS_BFX_CHANALL;

  BASS_FXSetParameters(fxHandle, @eq);
end;
Careful with this code.

Step B: Adjusting Bass Gain
To change the bass level (e.g., via a TTrackBar), update the fGain parameter. Range is typically -15dB to +15dB.
pascal
procedure TForm1.TrackBarBassChange(Sender: TObject);
var
  eq: BASS_BFX_PEAKEQ;
begin
  // Retrieve current parameters
  BASS_FXGetParameters(fxHandle, @eq);
 
  // Set new gain from trackbar (e.g., trackbar range -15 to 15)
  eq.fGain := TrackBarBass.Position;
 
  // Apply updated parameters
  BASS_FXSetParameters(fxHandle, @eq);
end;
Careful with this code.

3. Alternative: Using DX8 Effects
If you do not want to use the BASS_FX add-on, Windows users can use the built-in DirectX 8 effect BASS_FX_DX8_PARAMEQ.
Advantage: Does not require bass_fx.dll.
Disadvantage: Only works on Windows and is less flexible than the BASS_FX peaking equalizer.
Summary Checklist
Task    Description
BASS_Init   Call BASS_Init(-1, 44100, 0, Handle, nil) on form create.
BASS_FX_GetVersion   Verify BASS_FX is loaded by calling this during startup.
Stream Handle   Ensure the stream is created (e.g., BASS_StreamCreateFile) before setting FX.
DLL Location   Place DLLs in the same folder as your executable.
Does that help you...?
Regards Benny
« Last Edit: January 23, 2026, 08:14:35 pm by cdbc »
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Pe3s

  • Hero Member
  • *****
  • Posts: 641
Re: Bass.dll equalizer unit
« Reply #8 on: January 23, 2026, 09:29:00 pm »
Thank you for your help and the interesting discussion. Best regards.

Problem solved after adding code
Code: Pascal  [Select][+][-]
  1.  // check the correct BASS was loaded
  2. if HiWord(BASS_GetVersion) <> BASSVERSION then
  3. begin
  4.   Application.MessageBox('An incorrect version of BASS.DLL was loaded (2.4 is required)', 'Incorrect BASS.DLL', MB_ICONERROR or MB_OK);
  5.   Application.Terminate;
  6.   Exit;
  7. end;
  8.  
  9. // check the correct BASS_FX was loaded
  10. if HiWord(BASS_FX_GetVersion()) <> BASSVERSION then
  11. begin
  12.   Application.MessageBox('An incorrect version of BASS_FX.DLL was loaded (2.4 is required)', 'Incorrect BASS_FX.DLL', MB_ICONERROR or MB_OK);
  13.   Application.Terminate;
  14.   Exit;
  15. end;                                              
  16.  

d2010

  • Sr. Member
  • ****
  • Posts: 251
Re: Bass.dll equalizer unit
« Reply #9 on: January 24, 2026, 10:36:25 am »
All bass files are available.
Bass.dll version 2.4
Bass_fx.dll version 2.4.12.1
latest available for download
How to fix this error? I open your Project
Win8.1-32x86.
Lazarus.x32.

Pe3s

  • Hero Member
  • *****
  • Posts: 641
Re: [SOLVED] Bass.dll equalizer unit
« Reply #10 on: January 27, 2026, 07:39:29 am »
You are probably using a 32-bit or Lazarus 32-bit system. The project was created for a 64-bit system.

d2010

  • Sr. Member
  • ****
  • Posts: 251
Re: [SOLVED] Bass.dll equalizer unit
« Reply #11 on: January 27, 2026, 12:41:34 pm »
You are probably using a 32-bit or Lazarus 32-bit system. The project was created for a 64-bit system.
I found many issue. Here fix1 of my bugs. I replace bass.dll.
Here is fix fix1.
 

 

TinyPortal © 2005-2018