Fixed adjustPreset in player, to work around two pathological cases i…#9
Open
SAKryukov wants to merge 1 commit intosurikov:masterfrom
SAKryukov:master
Open
Fixed adjustPreset in player, to work around two pathological cases i…#9SAKryukov wants to merge 1 commit intosurikov:masterfrom SAKryukov:master
SAKryukov wants to merge 1 commit intosurikov:masterfrom
SAKryukov:master
Conversation
…n instrument .js files (presets):
1) some files have zones with zone.keyRangeLow > zone.keyRangeHigh; they are not used anyway and can be removed; this is a big performance improved, as, in some files, they reduce number of zones by order of magnitude
2) ALL files have zones with 1-semiton gaps, such as 0..29, 29..36, and so on. This is methodically totally wrong, but works with integer number of semitones. Microtones can be fractional; if, for example, the pitch values is 29.1, the zone will never be found, and its fallback is a zone at index 0. It produces intolerably bad quality of sound.
The fix is in just one function, just few line; it does not change sounds with integer number of semitones:
this.adjustPreset = function (audioContext, preset) {
const fixedZones = [];
for (let zone of preset.zones) {
if (zone.keyRangeLow > zone.keyRangeHigh) continue; // pathological case, not used anyway
fixedZones.push(zone);
this.adjustZone(audioContext, zone);
} //loop preset.zones
preset.zones = fixedZones;
// removing 1-semitone gaps between zones; important for microtones:
for (let index = 1; index < preset.zones.length; ++index)
preset.zones[index].keyRangeLow = preset.zones[index - 1].keyRangeHigh;
};
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed adjustPreset in player, to work around two pathological cases in instrument .js files (presets)::
The fix is in just one function, just few line; it does not change sounds with integer number of semitones:
It fully fixes issue 8 in non-obtrusive comprehensive way.