Anyone working on Analog Modeling Mono or Poly synths?

Seems most the topics here are about modular rack units.

I wondered if anyone works on coding up analog modeling synths using STM32F4 or other uC’s.

I’ve been dabbling around a pretty decent monosynth and want to try making it poly.
But it seems very hard to go from mono to poly… tracking the midi notes, keeping track of all the individual ADSRs for amp and filters and each of the osc’ s.

Any example code or methods for such a beast?

Maybe check the PreenFM source code? It’s not analog modeling but none of the problems you mention are related to this synthesis method anyway.

Also check the Ambika controller (motherboard) source code. Even if each voicecard has its own processor, it’s cleanly designed.

I’ll take a look at Preen for sure.
Matter of fact, the project I’m working on has a 4op FM voice, just has 0 adsr code for the Ops… It does for the final amp and even filter, just nothing to control the FM amps and osc pitches.
I’m sure Preen could help with that.

So am I in the wrong crowd?
No interest in these forums for the mono or polysynths??

I’m guessing I will need to do some kind of array of structs to keep track of poly voices.
Right now I use structs for the adsrs and Oscs

Only a handful of people here actually develop synths, so it’s not really a crowd. None of your problems are specific to hardware synths. These are programming issues. Maybe you could try KVR audio? Many plug-in developers there!

The way I always pictured it is you can wrap up your mono synth into a SynthVoice class that you can create n copies of as you please within your Synth class i.e. something like
vector<SynthVoice> voices;
Then you can have a note dispatcher in your synth that processes incoming notes through something like stmlib’s NoteStack (algorithms/note_stack.h) which can do something like
to control each individual voice. Make sense?


Thank you for the suggestion synthamasizer.

I am not familiar with this format in C or C++:

vector < SynthVoice > voices;

Is that like?:

struct Synthvoice {
uint8_t amp_adsr;
uint8_t fltr_adsr;

struct Synthvoice voices[slot];

A vector is a storage structure similar to an array. I think you can just as easily do

SynthVoice voices[8];

The way I’m building mine, the whole synth voice itself is an object which contains not only its parameters and state, but also the whole functionality. My synth class looks sort of like this:

class SynthVoice {
    Synth() { }

    void Init();
    void SetSrate(int rate);

    float GetSample();
    int GetSrate();

    void SetPitch(float f);
    void SetFilter(float f);
    void NoteOn();
    void NoteOff();

    unsigned int srate;

    MultimodeOsc oscillator;
    Filter24db filter;

    float TickOscillator();
    float TickFilter(float input);

    // controls
    bool gate;
    float pitch;
    float filterCoef;

    // internal states
    bool justTriggered;
    float oscillatorState;
    float filterState;
    float outputState;    

Then the sequencer or MIDI handler can call the functions NoteOn, NoteOff, SetPitch and so on. Filter, oscillator, etc. are their own classes, so I can easily swap them out as long as they all have the same functions to call. GetSample() advances the whole voice one time step and returns the resulting sample.


Thanks synthamasizer.

I will get back to this very soon… I looked over my current code and am trying to figure out how to re group everything to work like you are suggesting.

Today I got help elsewhere on this board with a MIDI Active Sense problem I was having… Bruno and Emilie helped me get it straightened out and now I can get back to this when I get a chance.

To be continued…

Out of curiosity, what do you have in terms of hardware?
I’ve just started building my own synth based on STM32F4, though I’m thinking more about a sample-based machine.

I’m currently coding a f407vgt6 mounted on one of those black micro python boards… very basic… small.
For a DAC I use a cloned PCM5102 that is already mounted to a board… I wanted at least 16bit resolution and have option for as high as 32bit if I care to.
I could have used the on board DAC, but it’s only 12bit.

MIDI is handled using a 6N138 attached to a UART port.

I thought of dabbling in Samples too by using some w25 spi eeproms…

i’m not really coding much myself but building a big poly synth based on the axoloti platform you might wanna look into, there’s definately solid poly voice handling implementation and a bunch of other stuff you might wanna study, some VA stuff too i am sure. also stm32 based.

I second the Axoloti !
Here’s a in-depth video about doing a poly VA, the step from mono to poly is quite easy as you embed the mono voice in a sub-patch and make it become poly.