Forums

Output level for a polyphonic software synthesizer

Started by Olivier August 23, 2003
Hello,

I'm currently writing a software music synthesizer in C++.

My main problem is to have a good output level when a single note is played
(one voice), but with a maximum polyphony that can become higher than 16:
- If i increase the level of all voices, that's OK for one note, but when i
play all notes, it saturates.
- If i make an average by dividing the max amplitude by the number of voices
(or another "estimated" number), so the level is very low when there is only
one voice played.
- i tried to make a "compresor" by using an atan() function on the output,
but it saturates.
- Another constraint is that the level of a voice must not change when
another voice is played, to avoid discontinuities.

When i hear some well known software synthesizers, i realise that they
solved this problem. Does someone can help me?

Thanks in advance,
Olivier



In article 3f472e90$0$26410$626a54ce@news.free.fr, Olivier at
olivier@nospam.for.me wrote on 08/23/2003 05:06:

> Hello, > > I'm currently writing a software music synthesizer in C++. > > My main problem is to have a good output level when a single note is played > (one voice), but with a maximum polyphony that can become higher than 16: > - If i increase the level of all voices, that's OK for one note, but when i > play all notes, it saturates. > - If i make an average by dividing the max amplitude by the number of voices > (or another "estimated" number), so the level is very low when there is only > one voice played. > - i tried to make a "compresor" by using an atan() function on the output, > but it saturates. > - Another constraint is that the level of a voice must not change when > another voice is played, to avoid discontinuities. > > When i hear some well known software synthesizers, i realise that they > solved this problem. Does someone can help me?
i didn't realize that commercial synths "solved" the problem. i would expect that when a single note is played, the output is much less than when a chord is played. perhaps they put a level compressor on the output, but i wouldn't have expected that. in any case, just try winding down the level of the output of a single note so that when you play 10 or more of them simultaneously it still does not clip. and if you don't like the disparity of loudness when more notes are played, consider level compression. r b-j
Thanks for your help.
So i think that my problem is in fact to have a good level compressor on the
output, that doesn't saturate when many notes are played simultaneously. I'm
going to find something better than an atan() function (better for a
distorsion or an overdrive that a compression of the output).

Olivier

"robert bristow-johnson" <rbj@surfglobal.net> a &#2013265929;crit dans le message de
news: BB6CFBFC.3251%rbj@surfglobal.net...
> In article 3f472e90$0$26410$626a54ce@news.free.fr, Olivier at > olivier@nospam.for.me wrote on 08/23/2003 05:06: > > > Hello, > > > > I'm currently writing a software music synthesizer in C++. > > > > My main problem is to have a good output level when a single note is
played
> > (one voice), but with a maximum polyphony that can become higher than
16:
> > - If i increase the level of all voices, that's OK for one note, but
when i
> > play all notes, it saturates. > > - If i make an average by dividing the max amplitude by the number of
voices
> > (or another "estimated" number), so the level is very low when there is
only
> > one voice played. > > - i tried to make a "compresor" by using an atan() function on the
output,
> > but it saturates. > > - Another constraint is that the level of a voice must not change when > > another voice is played, to avoid discontinuities. > > > > When i hear some well known software synthesizers, i realise that they > > solved this problem. Does someone can help me? > > i didn't realize that commercial synths "solved" the problem. i would > expect that when a single note is played, the output is much less than
when
> a chord is played. perhaps they put a level compressor on the output, but
i
> wouldn't have expected that. in any case, just try winding down the level > of the output of a single note so that when you play 10 or more of them > simultaneously it still does not clip. and if you don't like the
disparity
> of loudness when more notes are played, consider level compression. > > r b-j >
   This is a few days old, hope you're still reading...

In comp.dsp, "Olivier" <olivier@nospam.for.me> wrote:

>Thanks for your help. >So i think that my problem is in fact to have a good level compressor on the >output, that doesn't saturate when many notes are played simultaneously. I'm >going to find something better than an atan() function (better for a >distorsion or an overdrive that a compression of the output).
If you feel you must have compression on the output, at least let the user turn it off. Also, you can't just run each sample through a function, whether atan() or anything else, to 'compress' the output. You need to calculate an average of the (absolute value of the) level over many samples, and use that to control a variable gain routine. Do a Usenet and web search on compression (ignoring hits on data compression, physical compression, etc) and learn more about it. There are many parameters used in compression and they all change the sound. To your original observation, yes, without compression, when you play many notes, it is louder than just one note. To get this, you need to scale output levels so that it stays within the A/D's range with all notes playing at full volume. This does make one note not be as loud when played by itself, but that's okay. Most "real" musical instruments, such as piano and pipe organ, work exactly this way. That's part of the dynamics of these instruments - one option the musician has of making it louder is to play more notes. If a musician (or more likely sound engineer) really wants less change in loudness when different numbers of notes are playing, he will probably run the output through an external (and perhaps expensive studio) compressor.
>Olivier