Plugin in c++ - load a given set of audio files, loop it and modify it with FMOD DSP effects

Hi everyone,
for my university thesis, I’m trying to script a plugin in c++ with FMOD API CORE that generates a specific type of sound starting from a predefined set of audio files (something like AudioWind).
I was hoping to bundle the audio files with the plugin, load it in FMOD and loop it, while giving the user the ability to modify them in real time through the GUI (knobs should modify parameters in already implemented FMOD DSP effects that affects the loop).
I know how to load any audio file as data with a data parameter, but I’m not sure how to give the user a set amount of audio files to choose from. More importantly, I’m currently not sure how to access the audio files once they are loaded, as I can’t seem to access the corresponding System object and use it for the functions createSound and playSound. I tried to create my System object, but if i try to use it in a class method or in a function, the plugin is no longer seen by FMOD Studio.

Unfortunately I couldn’t find the answer in the examples or the documentation. Any idea of where I’m going wrong?

Thanks for you help


You may be misunderstanding the interaction between an FMOD System and an FMOD DSP, so to clarify: are you trying to create a custom DSP using FMOD’s DSP/Plugin API, which you will then insert into FMOD’s DSP chain, or are you trying to use an FMOD system in your plugin to generate an audio output?

You say that you’re loading audio files with the data parameter, but that you’re also trying to access the System object to play sounds - an FMOD DSP/Plugin is placed in an FMOD System’s internal DSP chain which it uses to generates an audio signal. Playing a sound with an FMOD System, in effect, creates a number of DSPs in the System’s DSP chain to handle sound playback.

Hi Louis, thanks a lot for you answer, and sorry for the late reply.

Initially I was trying to create a custom DSP using FMOD’s DSP/Plugin API, but now I’m delevoping a stand alone application that use FMOD Core. I realized that I needed to practice to better understand how the library works.

Just to better understand the idea behind it, after having loaded an audio file as data source, I could retrieve from SetParameterData callback the array containing the waveform, store it in a variable and use it in the read or process callback?

Yes, the general process with your idea, if you were to create a custom DSP, would be to provide your audio data via the set parameter callback wherein you’d store it as a variable, acting on it in the read/process callback, and then placing the altered data in the output buffer. When your DSP is added to an FMOD system’s DSP chain, the data placed in the output buffer propagates through in the DSP chain, eventually being output by the system.

If you haven’t taken a look already, I would recommend reading over our white papers on DSP Architecture and Usage and the DSP Plugin API. The Core API examples included with your FMOD Studio API install would also be useful in helping to familiarize yourself with FMOD. Of specific interest to you would be:

  • fmod_gain.cpp, fmod_noise.cpp, and fmod_distance_filter.cpp all provide examples of how to create custom DSPs
  • dsp_custom.cpp shows how to create a simple custom DSP and add it to the DSP chain
  • generate_tone.cpp shows how to play a DSP that generates an output with System::playDSP instead of manually connecting it to the DSP chain
  • effects.cpp shows how to add FMOD’s effect DSPs to the chain, which may be useful if you want to leverage them to affect the output of your custom DSP

The FMOD Profiler, also included with the Studio API install (./bin/FMOD Profiler.exe) can be helpful in visualizing changes that you make to the DSP chain.