Repository navigation
oscillators: linear interpolation keeps a full-scale step in range - #1256
Merged
Merged
Conversation
INTERP_LINEAR multiplied c - b by frac with MUL0_SS, whose 32-bit product holds results in [-1.0, 1.0) and wraps beyond. Across a full-scale edge c - b reaches 2.0, so |c - b| x frac passes 1.0 and the sample lands 2.0 x the osc's amplitude off. The generated saw, triangle and sine tables never step that far (create_lutset keeps at least 8 samples per cycle of the top harmonic), but a 256-sample wavetable frame can: four of the five shipped wavetables have frames that do (111, PPG_WA00, SINE2SAW, VIRAL; the default duty's frames 31/32 are clean on all of them), and so can any loaded table with a hard edge. MUL1_SS, for products in [-2.0, 2.0), is the same multiply with one bit moved from the difference to the headroom, so it costs nothing per sample; the difference loses its last bit, at most half an LSB of the 16-bit table, scaled by frac. Host render, fixed point, 48 kHz, against the same render with the product in 64 bits: 111 frame 51 goes from -9 dB to -74 dB error, VIRAL frame 24 from -9 dB to -80 dB; a clean frame (SINE2SAW 31) differs by at most 1 LSB.
…RP_LINEAR change Both play LUT waves near full scale, where the bit MUL1_SS drops from the difference moves samples by 1 LSB: -69.5 and -68.5 dB against the old references, past the -70 dB threshold.
Collaborator
⛓️ tulipcc integration PR openedThis merge was pinned into tulipcc for full-system CI: shorepine/tulipcc#1421 Test it there and merge that PR to move tulipcc onto this AMY. |
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.
INTERP_LINEARwraps in fixed point when two neighbouring table samples differ by full scale or more.MUL0_SSholds products in [-1.0, 1.0), and across a full-scale edgec - breaches 2.0, so the sample lands 2.0 x the osc's amplitude off. This switches it to a newMUL1_SSfor products in [-2.0, 2.0): the same multiply with one bit moved from the difference to the headroom, so no per-sample cost, and at most half an LSB of the 16-bit table lost.Why it shows up now.
MUL0_SShas had this form since 0b95071 (2023-11), but until WAVETABLE (a1a8055, 2026-02) nothing fedrender_lutsuch steps:create_lutsetkeeps neighbouring steps under 0.77 of full scale. The default duty's frames 31/32 are clean on every shipped table, so it only shows when duty is set or swept toward the ends of the scan, on these frames, and on any loaded table with a hard edge:amy.send(osc=0, wave=amy.WAVETABLE, duty=51/63, note=48, vel=1)(table 111, frame 51) buzzes before this change.Verification. Host render (fixed point, 48 kHz) against the same render with the product in 64 bits: 111 frame 51 goes from -9 dB to -74 dB error, VIRAL frame 24 from -9 dB to -80 dB, and a clean frame differs by at most 1 LSB. That last bit may move the reference renders by 1 LSB; I haven't run the full test suite.