Trying to build an per harmonic partial ADSR envelope...

Michael O'Hagan
Michael O'Hagan Member Posts: 100 Helper
edited October 22 in Building With Reaktor

I've been working on an additive synth for quite some time and one of the major hurdles is creating a per harmonic envelope generator.

How would you go about creatind a per harmonic envelope with up to 512 harmonic envelope layers where each harmonic fades in and out according to it's own adsr modulator?

Does anyone have any ideas about how to achieve this?

Thanks.

P.S.

There is an ADSR envelope in the partials framework, but it works in a way that is not compatible with my structure and it's formatting leaves me a bit confused as to how it's working so studying it hasn't been much help.

Comments

  • ANDREW221231
    ANDREW221231 Member Posts: 347 Pro

    if you look at the most recent files i posted to this thread it is setup to have different decay times for different partials, think it wouldn't be too difficult to adapt for what you're describing here

  • Michael O'Hagan
    Michael O'Hagan Member Posts: 100 Helper

    I don't think that's going to work, I'm trying to create this end result.

    I want to be able to create complex ADSR patterns in this sequencer style editor where the top is attack, the second down is decay, the third is sustain and the bottom is release.

    I need a serialized ADSR envelope where it processes each harmonic individually according to it's own envelope time settings.

    I've been experimenting with the partials framework ADSR module but it doesn't seem to process harmonics individually the way that it says it does.

  • ANDREW221231
    ANDREW221231 Member Posts: 347 Pro

    i can not for the life of me fathom how that picture relates to values for partials over time lol

    but separate envelopes per partial is totally possible

    if you're doing it per partial, that may mean you need that many separate envelopes. that's a lot of dang envelopes. if that's what you're trying to do, maybe you could clock the envelopes at event rate to save on cycles?

  • Chet Singer
    Chet Singer Member Posts: 73 Advisor

    If you're using a Sine Bank, and I wouldn't use anything else, they can be clocked at a maximum event rate of 1 kHz.

    So, I'd do that, using an iterator, and have a core cell that contains a single ADSR envelope with 512-element arrays containing all the relevant values: the attack times, the decay times, the current values, etc.

    I would store the envelope times/sustains in the Table Framework.

    Every 1ms the iterator will send a Start event, 512 Index events, and an End event.

    And the Sine Bank will smooth, using its internal ramp generators, the values from that 1 kHz sample rate to the audio sample rate.

    The complicated part is the ADSR envelope itself. But I think it's quite possible.

    It just occurred to me that I once built such a thing. Instead of ADSR envelopes it has up to 600 rate/value envelopes for the amplitude (and also pitch) of each harmonic. The envelope data comes from Fourier analysis of clarinets and is stored in Table Framework modules.

    Are you interested? It works. It's not in the UL. Should I post it here?

  • Michael O'Hagan
    Michael O'Hagan Member Posts: 100 Helper

    Yeah, let me see it, I already built something very similar for this synth, but I'd like to see how your's is different.

    it's called the organicus engine, it scans through a sample and extracts harmonic amplitude data over time that can be used like a wavetable to modulate harmonic amplitudes to create organic fades and movements in synthetic sounds.

    I just wanted to build a manual 512 index adsr so that you could create custom harmonic fading patterns for pads and soundscapes and such.

    The thing that is leaving me scratching my head is that with an ADSR I need to have the envelope pick up where it left off from the previous iteration cycle.

    I trigger a note and it starts the attack, we'll say 1 second on index 0.

    It scans through the other 511 indexes starting the attack on all of them at different rates.

    Now we cycle back to index 0 and it has to pick up where it left off and I'm not sure how to achieve that.

  • Michael O'Hagan
    Michael O'Hagan Member Posts: 100 Helper

    The picture is a graph/seq style editor where the first column down is A,D,S,R for partial 1, and the second is for partial 2 and so on.

  • ANDREW221231
    ANDREW221231 Member Posts: 347 Pro
    edited June 13

    ah ok, i think i can see it now

    so what's the impediment to building it? seems pretty straightforward. you just need a whole boatload of envelopes, either unrolled monophonically or spread across a bunch of audio voices

    edit: listen to chet not me he's totally got the right idea lol

  • Chet Singer
    Chet Singer Member Posts: 73 Advisor

    Michael, the instrument was too large to attach here so I've messaged you a google drive link to it. Let me know if you have any problems downloading it.

    Upon loading it you can play it using the mod wheel as an expression control. It contains Fourier specifications for four clarinets.

    The table framework samples are not embedded. The Data subdirectory must be in the same location as the ensemble itself.

    Find the sine bank synthesizer at Beauchamp Clarinets Ens > Beauchamp Clarinets > Beauchamp Engine > Sine Bank Synthesizer. Inside you'll find the iterator, the Sine Bank itself, and the "Sine Bank Driver" core cell, which is where your ADSR envelope would go.

    The magic begins with the iterator, which generates the proper events, in sequence, for the driver to load the sine bank with values.

    The driver is complex because it's stepping through tabular Fourier data for pitch, amplitude, and initial phase. Your 512-harmonic ADSR envelope should be simpler. You're only building one, really, indexed by the core cell's Har (Harmonic) input. You might need 512-element arrays for storing the attack times, decay times, sustain levels, release times, current values, and current states.

    It's occurred to me that LazerBass is this same kind of synthesizer. It's a Sine Bank whose harmonic amplitudes are controlled by algorithms which simulate filters, among other things. It might be worth a look.

  • Studiowaves
    Studiowaves Member Posts: 634 Advisor

    maThe ADSR modules are event driven but do use some cpu. However you can underclock them which basically slows down fast rise and fall times which aren't always necessary. It's possible your best bet is to share envelope generators with your harmonics. Envelope generators produce levels but those levels can also run thru a square root or other math formula that can effectively alter the envelope. So basically you can use a single ADSR module and run the output to many of your individual harmonics. So as an example you might use 16 ADSR modules and each one can control 32 partials. By using mathematics after the envelope generator you can effectively change each of the 512 partials. So instead of using 512 ADSR modules you only use 16 and each one is followed by a formula. You can end up with 512 math routines but if they don't use much cpu it might work out. I would suggest using a single ADSR followed by the squaring module and listen to what it does. After that try to use the exponent module that raises a ADSR value to something different than a squaring circuit. There's an equivalent core module too. The mathematics may make it easy to sound design your partials. I would also use a master to adjust each individual ADSR at one time. This way you can get the basic envelope established pretty easily. Each envelope generator can still be adjusted independently but the ADSR of each one will still move with with master. I did this in FM12 which is currently in the UL if you want to see how a master can affect all 6 envelope generators. The exponent or raise to the power module shown can work magic in controlling the harmonics or partials. Combined with 16 envelope generators you might have something there that is easy to program and makes musical sense. Most natural instruments can be easily synthesized with FM synthesis if you have enough operators and associated envelope generators. It's not nearly as complicated as pure additive synthesis because FM works much like natural instruments do. But additive synthesis is the cream of the crop if done properly. But that is your main problem right there. It takes a lot of resources to do real time and most use precompiled lookup tables that hold the envelopes of the partials. As a side note, some mathematic formulas are actually faster than lookup tables that hold data in main memory. So basically, you've gotten into something that might be a frustrating mess if not approached properly. Good luck with it!

This discussion has been closed.
Back To Top