Sign in

Clipping occurs when using soundfonts...

Category: Help
  • 57 0
    Message from Michael on
    A while ago (actually a couple of years ) I discovered soundfonts from classical organs and harpsichords. I guess some people of you already are familiar with those ones: http://sonimusicae.free.fr/accueil-en.html  On the website you can download the soundfonts for free.

    I've used the classical organ soundfont to render a MIDI-file of Bach's Tocatta to a wave-file. After that I listened to it and I heard distortion which is a result of clipping. Clipping occurs when the maximum allowed amplitude is crossed.

    In this case it probably can be fixed easily by increasing the values by "Attenuation" in the instrument-section, so there will be more headroom. (Headroom is the difference between the maximum amplitude peak of the sample and the 0 dB value. When you normalise a sound with audio editing software the headroom is zero. When you edit a sound with a limiter which is set to -3 dB the headroom will be 3 dB.)
    https://i.ibb.co/kQRXvjz/Attenuation-d-B.png " />.

    I'm wondering. Does creating a quality sound library mean you have to tweak the invidivual samples with equalisers, low/high-pass filters, limiters, compressors, etc?
  • WF 9 0
    Message from Wanda Fish on
    What SW did you use to render it with?
    Please note that your (my) typical soundfont player plugin has a Gain parameter.

    By cranking up that gain knob too far, just about any soundfont
    will produce clipped results.
  • 70 0
    Message from Sylvia on
    I believe that the OP is using the Polyphone built in sound recorder, but I don't think that there's any sort of 'Gain' control on it.

    Maybe that could be a feature to consider for the next version of Polyphone?
  • 57 0
    Message from Michael on
    I've rendered the MIDI-file with Plogue SforZando and imported the soundfont with the aria-engine.

    Like I already mentioned in the OP the gain of the samples can be adjusted with [Attenuation (dB)].

    Suppose you have loaded a SF2-file with Polyphone, you play chords on your MIDI-connected keyboard and you'll hear distortion. That's probably a sign you have to adjust the Attenuation. You can check it by looking at the graphical display of the individual samples. If the samples are all normalised to its maximum (0 dB) than you have to adjust the attenuation. By entering a value of 6 you'll create headroom of 6 dB and the sample will be played with that specified decreased volume.

    I suggest an additional gain should not be appearant on a future version of Polyphone, because it can lead to confusion when tweaking the values in the instrument and preset sections.
  • Message from Michael on
    My question is actually as follows:

    Is it comparable with mixing the tracks of a song in your DAW? To create a good mix you have to adjust the gain of the individual tracks of course. You also have to adjust the EQ and dynamics with compressors and limiters, because otherwise the mix won't get balanced.

    When you play chords on your keyboard you often play several sound samples simultaneously. So when programming a soundfont do I have to be alert to specific frequencies related to the assigned root key (to prevent a muffled distorted sound when playing chords on the keyboard)?

    I hope I have explained well what I mean...
  • WF 9 0
    Message from Wanda Fish on
    I see. Your question really is:
    Should I design my soundfonts so that playing one note at velocity 127 does still provide some headroom? E.g. -6 dB or so?

    I would want to leave that to the more savvy.... but my educated guess would be nope, or -3 dB at most.
    My reasoning / some of the obvious facts are:
    • The Attenuation is knit into the soundfont (It's "internal" for that matter.
      And you don't want to "mess with soundfont internals" just because "of the Toccata")
    • Indeed, playing more than one note at a time will get a louder output level - playing lots of simultaneous notes can cause clipping, for sure.
    • Hence it makes sense to have an *external* gain parameter. The creator of a soundfont can't account for / tell how many notes a user will play simultaneously.
  • 57 0
    Message from Michael on
    Thank you for your reply!

    Though I don't quite understand what you mean with: "The Attenuation is knit into the soundfont"

    You can create headroom as well by adjusting the samples themselves, but then you make those changes permanent. The attenuation gives command the sample cannot be played louder than the specified value, but it doesn't change the sample itself. Or am I wrong.

    How does it actually work on keyboards and wavetable-synths? When I play lots of keys together I don't hear clipping. Is that because the audio engine works on a different way then with software sound libraries? Or is there some kind of soft limiter involved: the maximum volume from each invididual tone decreases when you play more than 5 keys simultaneously or something?

    Pfff maybe I should stop breaking my head about such things B)
  • ZI 190 0
    Message from ziyametedemircan on 2
    I can give you some sort of semi-theoretical(!) informations about this:

    if per voice at 127 velocity at 0db:

    realdB: with: same note, same frequency, same instrument, full volume:
    opt1: same instrument, different notes, full volume.
    opt2: different instruments, different volumes. ------+---+----+------+------++-----+------+-----+ | | | | || real| att. |att. | # | x | | (.6)|+(2/3)|| att.| opt*1|opt*2| of |fac|real| opt*1| opt*2|| in | in | in | voices|tor| dB | dB | dB || sf2 | sf2 |sf2 |*3 ------+---+----+------+------++-----+------+-----+ 1 | 0| 0 | n/a | n/a || n/a | n/a | n/a | 2 | 1| 6 | 3.6 | 2.4 || 15 | 9 | 6 | 4 | 2| 12 | 7.2 | 4.8 || 30 | 18 | 12 | 8 | 3| 18 | 10.8 | 7.2 || 45 | 27 | 18 | 16 | 4| 24 | 14.4 | 9.6 || 60 | 36 | 24 | 32 | 5| 30 | 18.0 | 12.0 || 75 | 45 | 30 | 64 | 6| 36 | 21.6 | 14.4 || 90 | 54 | 36 | 128 | 7| 42 | 25.2 | 16.8 || 105 | 63 | 42 | 256 | 8| 48 | 28.8 | 19.2 || 120 | 72 | 48 | 512 | 9| 54 | 32.4 | 21.6 || 135 | 81 | 54 | 1024 | 10| 60 | 36.0 | 24.0 || 150 | 90 | 60 | 2048 | 11| 66 | 39.6 | 26.4 || 165 | 99 | 66 | 4096 | 12| 72 | 43.2 | 28.8 || 180 | 108 | 72 | 8192 | 13| 78 | 46.8 | 31.2 || 195 | 117 | 78 | 16384 | 14| 84 | 50.4 | 33.6 || 210 | 126 | 84 | 32768 | 15| 90 | 54.0 | 36.0 || 225 | 135 | 90 | 65536 | 16| 96 | 57.6 | 38.4 || 240 | 144 | 96 | *4 ------+---+----+------+------++-----+------+-----+ opt*1 Also you use the formula *0.6 as not all voices will play simultaneously same note continuously at 0dB (127 velocity) volume. opt*2 and add the formula 2/3 for volume factor optimisation *3: same as "non optimised real dB value" (surprise!) *4: 144att. (and up) is useless=> total zero Example: for 64 voice polyphony: real 36dB * 0.6 = (opt.dB1) 21.6dB => 54att.(sf2 optimized*1) and 54*2/3= 36att.(sf2 optimized*2) // same as realdB
    This gives you an advanced-secure output for 1 to 64 voices.
    It is better to use these attenuation values in the global part of the preset level.
    According to the polyphony limit you set, this value must be the same for each preset:
    example: for 64 voices: patch1 : Attenuation 36, patch2 : Attenuation 36, ...and so on ..., patch128: attenuation 36..

    and now your sf2-audio-output is optimized for 64 voices. (note.: this operation is causes to an low output volume) Adjust the gain of your DAW for more volume. (increase amplification.)

    This is why the companies that produce syhthesizers, used limited-polyphony.
    because: they have to adjust the output gain correctly. For an audio-module/keyboard with 64 polyphony, this value will be ~ -21.6dB or ~ -14.4dB for attenuation.

    Attention: Almost all of the information here is based on my own experience and calculations. The actual information may be completely different from what is written here. If you follow the information here, I certainly would not take responsibility for bad results.. But I reserved the right to "thank you" for the good results you get.
  • WF 9 0
    Message from Wanda Fish on 1
    I think ziyametedemircan's table looks quite reasonable.
    Giving several presets, per number of polyphonic voices, seems a good solution to me.
    Btw and nevertheless- it still is a solution that relies on an external gain knob.

    You kind of lost me on the example where it says "attenuation 36" over and over, though....

    @Michael: Indeed, creating headroom by permanently adjusting the samples would
    be a (for a second I was going to say "crime") waste of resolution.
  • 57 0
    Message from Michael on
    Sorry for the huge delay to reply. But everybody thank you!

Sign in or register to take part in discussions.

Polyphone needs you!

Polyphone is free but there are costs associated with its website and development. A small donation will help a lot.

Donate
Learn the basics Try a tutorial
Scroll to
top