SoundFont Preset generator interpretation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

SoundFont Preset generator interpretation

Garth Hjelte
How does FS interpret SoundFont Preset generators, specifically the VolEnv and ModEnv?

In the SoundFont spec, it seems - and at times explicitly states - that the Preset values are ADDED to the Instrument Values, and are interpreted as Units specified in the spec. From page 45 (2.01 sepc):

"Generators at the Preset Level are instead considered “relative” and additive to all the default or instrument level generators within the Preset Zone. For example, a value of 2400 timecents for the attackVolEnv generator in a preset zone containing an instrument with two zones, one with the default attackVolEnv and one with an absolute attackVolEnv generator value of 1200 timecents would cause the default zone to actually have a value of -9600 timecents or 4 msec, and the other to have a value of 3600 timecents or 8 seconds attack time."

However, in both the Vienna and Viena editors, it doesn't work that way. Instead, for example, a attackVolEnv in the Preset (PGEN) serves as a MULTIPLIER and does not represent the Unit (in this case TimeCents).

As an example, there is a SoundFont called CHORIUM and when opened in Viena, you see the Preset's Global Zone has a value of 30 in attackVolEnv, and the Instrument zones mostly don't have a value listed, so you get 30ms as the audible value, since 30 x 1ms (the default value) = 30ms. I looked inside the Chorium file and sure enough, the value is 0x1739, decimal 5945, and when processed through the TimeCents formula, comes out to 30.999 (that is, 31).

In Viena (which is NOT the spec but it should follow the spec) the listing doesn't say "sec" but "X", and certainly in the above example the attack time is NOT 31sec when I play it back. So for some reason Viena (and Vienna) interprets the Preset values as MULTIPLIERS and aren't even in the Units the spec defines, which is TimeCents (absolute time values).

So, my questions are - how does FS do it, why does it do it (in view of the spec violation), and also why is this so against the spec? Is the spec "wrong"? How can a spec be "wrong"?

Garth Hjelte
Sampler User



_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: SoundFont Preset generator interpretation

Ceresa Jean-Jacques

Hello Garth,

 

>How does FS interpret SoundFont Preset generators, specifically the VolEnv and ModEnv?

 

>In the SoundFont spec, it seems - and at times explicitly states - that the Preset values are ADDED to the Instrument Values, and are interpreted as Units specified in the spec. From page 45 (2.01 sepc).

 

I could confirm that fluidsynth does what SF 2.01 page 45 states using unit specified in the spec (8.1.3 page 37, 38). Generator values at preset level are added to instrument generator values. This is true for all generators (except for the invalid generators at preset level you read p 45).

 

Because this is often a source of confusion, may be one should consider also the rules of precedence of generators in respectives zones at preset level and instrument level (page 50, 51):

- One Preset could be composed of more than one zones (one optional global preset zone + one or more local preset zone(s) (with one Instrument per local preset zone)).

- One Instrument could be composed of more than one zones (one optional global instrument zone + one or more local instrument zone(s) (with one Sample per local instrument zone)).

- A generator in a local preset zone that is identical to a generator in a global preset zone supersedes or replaces that generator in the global preset zone. That generator then has its effects

  added to the destination-summing node of all zones in the given instrument.

- A generator in a local instrument zone that is identical to a default generator or to a generator in a global instrument zone supersedes or replaces that generator. This an absolute replacement

We could consider a global zone (Preset/Instrument) being a convenient way to specify generators common to all respectives zones. Then these global generators could be superseded individually by an identical generator in the respective local zone(Preset/Instrument) if needed. Of course this simplify the task of the designer. I could confirm that fluidsynth does what page 50, 51 state.

 

Unfortunately, I could not confirm what both Vienna and Viena editors are doing. I hope that any other user(s) will help. Did you tried Polyphone reading and displaying what was edited in Vien(n)a ?

jjc.

 


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: SoundFont Preset generator interpretation

Garth Hjelte
At 09:09 PM 6/21/2020, you wrote:

>>In the SoundFont spec, it seems - and at times explicitly states - that the Preset values are ADDED to the Instrument Values, and are interpreted as Units specified in the spec. From page 45 (2.01 sepc).

>I could confirm that fluidsynth does what SF 2.01 page 45 states using unit specified in the spec (8.1.3 page 37, 38). Generator values at preset level are added to instrument generator values. This is true for all generators (except for the invalid generators at preset level you read p 45).

Thank you.

>Unfortunately, I could not confirm what both Vienna and Viena editors are doing. I hope that any other user(s) will help. Did you tried Polyphone reading and displaying what was edited in Vien(n)a ?

I'll check over this week. I should say before I check that Vienna and Viena and Polyphone BETTER abide by the spec. However, again the mystery, is that not only does Viena violate it, but Vienna violates it as well. This is a real problem because Creative/Emu as authors of Vienna themselves violated their own spec, and that is also probably why Viena does it the way they do. (And interestingly Viena EXACTLY copies the violation.)

I predict Polyphone copied the Vienna/Viena lead. So this could be de facto spec violation, where you can be as right as you want but still lose the war.

I've attempted to contact Viena's author to get an explanation.

This is an important issue as tons of SoundFonts have these generators at the Preset Level and not at the Instrument Level. The programmers obviously didn't not want to edit every Instrument Zone, whether it is Global or not. They just took the easy way out.

Garth Hjelte
Sampler User


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: SoundFont Preset generator interpretation

Garth Hjelte
In reply to this post by Garth Hjelte
At 09:09 PM 6/21/2020, you wrote:

>>In the SoundFont spec, it seems - and at times explicitly states - that the Preset values are ADDED to the Instrument Values, and are interpreted as Units specified in the spec. From page 45 (2.01 sepc).

>I could confirm that fluidsynth does what SF 2.01 page 45 states using unit specified in the spec (8.1.3 page 37, 38). Generator values at preset level are added to instrument generator values. This is true for all generators (except for the invalid generators at preset level you read p 45).

I got a response from the Viena author; the mistake I was making was that I was doing this:

CalcToTimeVal(PresetZoneVal) + CalcToTimeVal(InstrumentZoneVal) = FinalResult

Which is wrong, it should be:

CalcToTimeVal(PresetZoneVal + InstrumentZoneVal) = FinalResult

Since CalcToTimeVal() is a fairly complex equation pow(2, TimeCentVal / 1200), the two equations DEFINTIELY don't give the same results!

Thanks for your time.


Garth Hjelte
Sampler User


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: SoundFont Preset generator interpretation

fluid-dev mailing list
> I got a response from the Viena author; the mistake I was making was that I was doing this:
>
> CalcToTimeVal(PresetZoneVal) + CalcToTimeVal(InstrumentZoneVal) = FinalResult

Oh, Déjà-vu! Same topic, yesterday, two years ago:

https://lists.nongnu.org/archive/html/fluid-dev/2018-06/msg00051.html

Very exciting :)

Tom



_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: SoundFont Preset generator interpretation

Garth Hjelte
At 12:39 PM 6/22/2020, you wrote:

>> I got a response from the Viena author; the mistake I was making was that I was doing this:
>>
>> CalcToTimeVal(PresetZoneVal) + CalcToTimeVal(InstrumentZoneVal) = FinalResult
>
>Oh, Déjà-vu! Same topic, yesterday, two years ago:
>https://lists.nongnu.org/archive/html/fluid-dev/2018-06/msg00051.html
>Very exciting :)

Wow. Just wow. This totally shows that my 100% stupidity is made up by 100% luck. =)

(I also printed my check number 6666 today.)

I knew I asked this before. And, it's the summer solstice too - so, definitely solar related. Watch out, my question will be repeated based on Halley's Comet. See you in 76 years. =)

Just to nail my body into the coffin, part of my confusion was some slight-of-math-hand stuff. Viena shows in the Preset Level a number as a Factor, since it doesn't necessarily show actual internal values (nor should it).

So in my case, Viena shows the integer 31 for the internal value 5495, and it's not supposed to mean 31sec but "a factor of 31". So you can MULTIPLY this with any Instrument Zone value-in-seconds and you'll get your final-value-in-seconds. Coincidentally (and this is the slight-of-hand), if you add the internal timecents values and then CalcTimeVal(), you get the same result.

It confused me because it's two ways of doing the same thing, and I was mixing the two approaches improperly.

Garth Hjelte
Sampler User


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: SoundFont Preset generator interpretation

Garth Hjelte
In reply to this post by Ceresa Jean-Jacques
At 09:09 PM 6/21/2020, you wrote:

>Because this is often a source of confusion, may be one should consider also the rules of precedence of generators in respectives zones at preset level and instrument level (page 50, 51):

Jean-Jacques, thanks for this - can you confirm this possible situation?

So ALL LEVELS are additive, for example, say there is a attackVolEnv generator in FOUR places, with the following values:

Preset Global Zone:      -11000
Preset Inst Zone:           500
[That Inst] Global Zone:    600
[That Inst] Each Zone:      700

That means for one "sample reference" (an instrument local zone) it sums all 4 values to -9200 timecents, correct?

Garth Hjelte
Sampler User


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: SoundFont Preset generator interpretation

Ceresa Jean-Jacques

Hi,

 

>can you confirm this possible situation? So ALL LEVELS are additive

No, global isn't additive to local. Only Preset level is additive to Instrument level.

 

Preset level:

Preset Global Zone:      -11000
Preset Inst Zone:           500

-----------------------------------

Instrument level:
[That Inst] Global Zone:    600
[That Inst] Each Zone:      700

 

1)Local Preset Zone (500) replaces Global Preset Zone (-11000) so the result is 500 at Preset level (This result will be added to the result at Instrument level)

2)Local Instrument Zone (700) replace Global Instrument zone (600) so the result is 700 at Instrument level. The final result = (Preset level + Instrument level) = (500 + 700)

 

Think like that:

1)at each level, Local replace Global, then

2)add Preset Level to Instrument Level.

The goal of Preset level zone(s) is to allow the building of a variant preset (P2) of an existing Preset (P1) using only simple additive logic. Both preset P2 and P1 using the same Instrument.

jjc

 


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: SoundFont Preset generator interpretation

Garth Hjelte
At 03:37 AM 6/24/2020, you wrote:

>1) at each level, Local replace Global, then
>2) add Preset Level to Instrument Level.

OK, thanks, as the spec says:

"A generator in a local preset zone that is identical to a generator in a global preset zone supersedes or replaces that generator in the global preset zone. That generator then has its effects added to the destination-summing node of all zones in the given instrument."

Sometimes the spec, while well written, is way too wordy and I get a bit dizzy. Thanks for your assistance and your time.

Garth Hjelte
Sampler User


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: SoundFont Preset generator interpretation

Ceresa Jean-Jacques

Hi,

>Sometimes the spec, while well written, is way too wordy and I get a bit dizzy.

That is true.

 

A final note to say that the logic of precedence between same generators in global/local works the same concerning same modulators in global/local zone.

jjc

 


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev