Author Topic: Delphi/Bass/VST - can anyone help me with this? [SOLVED - Thanks Falcosoft]  (Read 200 times)


  • Posts: 8
Hey everyone. I have been trying to figure this out for months now and can find no samples. Is there anyone who can correct my code - I am not sure how BASS does it's thing and how the parts fit together.

I am trying to load an instrument VST and then play a note though that VST using MIDI data. What I have so far is:

  Stream : HStream;
  vstHandle : dword;
  VstPlugInfo: BASS_VST_INFO;

procedure TForm1.FormCreate(Sender: TObject);
   If (HIWORD(BASS_GetVersion) <> BASSVERSION) then begin
      MessageBox(0,'An incorrect version of BASS.DLL was loaded', nil, MB_ICONERROR);
   If NOT BASS_Init(-1, 44100, 0, Handle, nil) then ShowMessage('Error initializing audio!');
   Stream := BASS_StreamCreate(44100, 1, 0, STREAMPROC_PUSH, nil);
   vstHandle := LoadLibrary(pchar('C:\Program Files (x86)\VST\KORG\WAVESTATION.dll'));
   BASS_ChannelPlay(Stream, False);
   BASS_VST_ProcessEvent(vstHandle, 0, 145, MAKEWORD(60, 100));
   BASS_VST_ProcessEvent(vstHandle, 0, 145, MAKEWORD(60, 0));


I see the vstHandle returns a large number and is not 0 - apparently thats a good thing. But there's no sound and no GUI opens up for the VST. I don't need to see it visually - I just need to play some notes.

Can any of you geniuses see what I am doing wrong? (Probably a lot!!!). Ive wasted a HUGE amount of time on this thinking I would eventually work it out. So I thought I would ask for help since I obviously have no clue whatsoever. Maybe I am missing a file but it compiles perfectly without throwing a wobbly though checking for errors after calling the DLL gives a "not found" error. Im not sure if it's the VST thats not found, a BASS dependency or my brain. ha ha

EDIT: The files in the project folder include bass.dll, bass.pas, bass_vst.dll, bass_vst.pas and I have also tried putting the VST DLL in the same folder.
« Last Edit: 27 Sep '22 - 09:57 by zr6ryo »


  • Posts: 123
Re: Delphi/Bass/VST - can anyone help me with this?
« Reply #1 on: 16 Sep '22 - 15:26 »
In order to use Bass_VST library with a VST instrument plugin you have to use
vstHandle := BASS_VST_ChannelCreate(OutputFreq, NumChannels, PChar(VstiFile), flags) call instead of BASS_StreamCreate and  LoadLibrary. If you use a newer unicode Delphi version make sure that flags parameter includes the BASS_UNICODE flag. So in your case:

vstHandle := BASS_VST_ChannelCreate(OutputFreq, NumChannels, PChar('C:\Program Files (x86)\VST\KORG\WAVESTATION.dll'), BASS_UNICODE);
BASS_ChannelPlay(vstHandle, False);

Also be aware that a compiled 32-bit exe/32-bit bass_VST.dll can only load 32-bit VSTi plugins and 64-bit exe/64-bit bass_VST.dll can only load 64-bit VSTi plugins. 
« Last Edit: 16 Sep '22 - 15:37 by Falcosoft »


  • Posts: 8
Re: Delphi/Bass/VST - can anyone help me with this?
« Reply #2 on: 16 Sep '22 - 17:08 »
Hi Falcosoft. Thank you for the reply and pointing out my glaring mistake. They say if you focus too closely on the problem, the answer can elude you. I am going to try your code changes right now and will let you know how it goes. Your assistance is greatly appreciated. PS: In all the articles and samples I have seen in the last month, your name came up repeatedly. Your reputation precedes you.


  • Posts: 8
Re: Delphi/Bass/VST - can anyone help me with this?
« Reply #3 on: 16 Sep '22 - 17:31 »
Falcosoft - you genius! This worked perfectly - everything is loading and I am hearing sound. Thank you very much for your help.