I just started creating my own plugin. I guess I have the includes and dll. linking for the fmod studio apu correctly setup. What I want to do now is create a granular synth on my own.
The general idea is to have a table which describes the sample in an audio file (num samples, sample length etc.). All the logic to calculate the correct samples is already done given an input parameter (spoiler alert, it is a GS for car engine sounds so the input parameter is the RPM value).
For this I need to directly set the samples that FMOD should play with additional pitching. Is that possible in FMOD and where should I start? I have a bit trouble reading just your docs and looking at the example plugins.
Edit.: Idea is to put the plugin like the AudioMotors plugin into the timeline and adjust the RPM parameter with curves. The audio file can be drag and dropped onto the plugin. It can be whatever FMOD supports. The arrays of data could pasted manually or saved in the header of the audio file.
A custom DSP plugin will allow you to accomplish what you want - If your DSP has zero input channels, it is treated as an instrument, and can be placed on a sheet in an event. If you specify that your DSP has a data parameter of type
DSP_PARAMETER_DATA_TYPE_USER, the default Studio UI component for a data parameter will allow you to browse for or drag and drop an audio file into the DSP effect. I’d recommend taking a look at the Plugin Reference documentation for more info, and the API examples in your FMOD Studio API install, specifically the “fmod_gain” and “fmod_noise” examples.
I’m a little unclear as to what you’re trying to do with regards to the table of sample info and additional pitching that you’ve described - would you mind elaborating on exactly what you mean?
thank you for your answer. So the idea is to have a 2d array with the audio file in it where you access the first layer with the rpm and the second layer contains the audio samples at this position (the grain). With some calculations these samples are pulled out and returned to be played by FMOD. As the array of grains won’t contain all possible rpm values the pulled out grains are pitched slightly to match the rpm. Say you have an input value of 5100 rpm but only grains at 5050 and 5200. then you pull out the grains at 5050 and pitch them a bit up. This calculation is also already done.
That makes sense, thanks for explaining in more detail.
As an aside, I’ve done a little more research into custom DSP UI components, specifically the ability to make use of default instrument UI components (i.e. playlist) when creating a custom DSP instrument, which would likely make adding samples to your DSP more convenient. However, after discussion with one of our programmers, we’ve come to the conclusion that this functionality isn’t exposed, so I’ve added it to our internal feature/improvement tracker.
That said, the default UI component for the user data parameter,
DataDrop, should be fine for your needs. If you’re not using too many individual samples, then you could just use an arbitrary amount of data parameters to assign samples - though obviously with too many samples this would cause some UI clutter. If you’re planning to have a single larger audio file with table data saved into the header, as you’ve stated that you could do, a single data parameter that you use for the whole file would be fine, as you could seek/chop the whole file as needed in your custom plugin