Creating sound effects using bass.dll Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Posts: 10
Joined: 05 Apr 2020, 15:39

Creating sound effects using bass.dll

05 Apr 2020, 15:58

I have been working on a soundboard using AHK and bass.dll, everything is working just fine, everything except sound effects like echo/flanger...
I tried searching google and this forum, but did not find how to make it work.

Official bass documentation states (http /doc/#bass/BASS_DX8_FLANGER.html and

Code: Select all


and parameters,

Code: Select all

typedef struct {
    float fWetDryMix;
    float fDepth;
    float fFeedback;
    float fFrequency;
    DWORD lWaveform;
    float fDelay;
    DWORD lPhase;
But what do i do with that?
I have tried

Code: Select all

DllCall("BASS\BASS_FX_DX8_FLANGER", UInt,hMedia, "float", 20, "float", 10, "float", 0, "float", 7, "DWORD", 0, "float", 4, "DWORD", BASS_DX8_PHASE_180)
But it seems to not do anything.

Working code:

Code: Select all

BASS_DLLCALL	     := DllCall("LoadLibrary","str",ALLUSERSPROFILE "\Data\bass.dll") ; load Bass.dll
BASS_Init			 := DllCall(ALLUSERSPROFILE . "\Data\bass.dll\BASS_Init",Int,-1,UInt,44100,Int,0,UInt,0,UInt,0) ;initialise Bass
BASS_start	         := DllCall(ALLUSERSPROFILE . "\Data\bass.dll\BASS_Start", int) ;Start Bass
hMedia               := DllCall(ALLUSERSPROFILE "\Data\bass.dll\BASS_StreamCreateFile", Int, 0, Astr, sound_name, Uint, 0, Uint, 0, Uint, 0, Uint, 44100) ; Create Stream or Buff in Memory 
BASS_ChannelPlay     := DllCall(ALLUSERSPROFILE . "\Data\bass.dll\BASS_ChannelPlay", UInt,hMedia, Int,1) ;Starts playback
Posts: 4092
Joined: 11 Jan 2017, 17:59

Re: Creating sound effects using bass.dll  Topic is solved

05 Apr 2020, 19:01

assuming x64:
  1. u obtain an effect handle

    Code: Select all

    hEffect := DllCall("bass.dll/BASS_ChannelSetFX", "UInt", hMedia, "UInt", BASS_FX_DX8_FLANGER, "Int", 0, "Ptr")
  2. u declare and define ur struct(BASS_DX8_FLANGER), ie calculate its size(accounting for possible padding bits as well, though there arent any in this particular case)

    Code: Select all

    VarSetCapacity(flanger, 28)
  3. u now populate the struct with data

    Code: Select all

    NumPut(20, flanger, 0, "Float") ; fWetDryMix
    NumPut(10, flanger, 4, "Float") ; fDepth
    NumPut(0, flanger, 8, "Float") ; fFeedback
    NumPut(7, flanger, 12, "Float") ; fFrequency
    NumPut(0, flanger, 16, "UInt") ; lWaveform
    NumPut(4, flanger, 20, "Float") ; fDelay
    BASS_DX8_PHASE_180 := 4
    NumPut(BASS_DX8_PHASE_180, flanger, 24, "UInt") ; lPhase
  4. u apply the parameters

    Code: Select all

    DllCall("bass.dll/BASS_FXSetParameters", "Ptr", hEffect, "Ptr", &flanger)

Return to “Ask For Help”

Who is online

Users browsing this forum: alancantor, Bing [Bot], boiler, djuga, Freshman, JackbobEvolved, martin536, pythonker and 37 guests