davy7125 / polyphone

A soundfont editor for quickly designing musical instruments.
https://www.polyphone.io
GNU General Public License v3.0
344 stars 45 forks source link

local preset zone modulator override only working for modulator #1 #180

Closed mrbumpy409 closed 5 months ago

mrbumpy409 commented 10 months ago

For both instruments and presets, local zone modulators should override global zone modulators if they share the same source, destination, amount source and transform (see SoundFont 2.4 spec, section 9.5.1). Polyphone handles this correctly in instruments, but in presets, the override is only successful if it involves the first modulator listed in the preset global zone.

Here is a test SoundFont containing two presets that exhibit this bug. The instrument used by both presets cancels the default velocity-to-attenuation modulator, disabling velocity sensitivity. Both presets set the following modulators at the global zone and then cancel them at the local zone:

In preset 0 "test 1", the velocity→filter_cutoff modulator is listed first.
In preset 1 "test 2", the velocity→attenuation modulator is listed first.

Both presets should have the same result: no velocity-based dynamic response and no velocity-based filtering. However, in Polyphone, these are the results I get:

davy7125 commented 5 months ago

Preset 0 and 1 now behaves the same way: no difference if you reverse the order of modulators.

However, according to my understandings you can only cancel a default modulator at the instrument level. The modulator specified at the preset level and related to the filter_cutoff can be described by: multiply, with a value ranging from 1 to 1 (so no changes), the value of the filter cutoff at the instrument level

I'm closing this issue and you can reopen it if I'm wrong.

mrbumpy409 commented 5 months ago

Yes, you are correct about only being able to cancel default modulators at the instrument level. I will test out your fix. Thank you!

mrbumpy409 commented 5 months ago

So far in my testing, all my preset modulators are working as they should.