Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: Gain control strategies for poly synths

  1. #1

    Gain control strategies for poly synths

    I am working on a 32-voice synth project and want to come up with a way to keep levels up while avoiding clipping. Each mixer is 4-to-1, so we have to have tiers of mixers at 32 voices. You could set the first tier to 1/32, the next to 1/8, and the last to 1/2, but that's waaaaay too quiet unless you plan on holding down 32 keys at one time.

    I've hand-ordered my connections so some simple math can figure out which voice is on which 1st tier mixer group, as well as 2nd tier. Maybe start out with gain set to '1.0' on each input, and as you go above one voice start lowering the gain? I can see this working for simple on/off sounds but not when there's an envelope and especially not with long release times.

    If the audio blocks were 32 or 64 bits, we could push the problem out to the end of the processing chain and do some sort of gentle 'AGC' type thing.

    Any ideas?

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,166
    Try setting the gain of all the mixer inputs at every stage to 0.25

    Pete

  3. #3
    Quote Originally Posted by el_supremo View Post
    Try setting the gain of all the mixer inputs at every stage to 0.25

    Pete
    Yeah that seems OK for now. I'll post an update if I figure out a better way.

  4. #4
    There's only one good way for polysynths - a 32 bit DAC and run the signals at about 24 bits which still gives a good signal to noise ratio. Yes I realise 32 bit DACs aren't really 32 bits because of their noise floor, but it is the extended dynamic range we are after in this case. My polysynth has over 4000 sinewave oscillators (not using a Teensy) adding into a 64 bit integer total and I can always find some way of having large numbers of them going.

  5. #5
    I was looking for a toneprint for one of my TC Electronic pedals and saw the specs: 48-bit in, 32-bit out. Might be 64 or 128 bits internally. Makes sense as you don't want to require guitar players to diddle a gain control or watch an overload LED all the time.

  6. #6
    I think most things are at least 64 bit integer internally nowadays - ARM 64 bit processors are so cheap that using anything else is silly. Some use 80 bit floating point, most notably PC based apps.

  7. #7
    As a follow-up, the most gain I could safely get away with is 0.25 on the first two levels of mixers, and then 0.5 on the final two. I have an amp right before the i2s output set to 2.5. I have 32-voices so if you set the release long enough and hit the keys hard enough, you can make it clip if I try to get more loudness from it. I can get OK levels by engaging the 4 db boost on my mixer channel and adding another 5 db or gain on the fader.

    Is there a fork where audio_block_t is int32_t? 32-bits is 'enough' headroom for most things, and if you keep waveforms/oscillators to 16-bits you can sum up to 256 before clipping a 24-bit DAC.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •