Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/amy_fixedpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
#define S_FRAC_OF_S(s, b) ((s) * (1 << (b)) - floorf((s) * (1 << (b))))

#define MUL0_SS(a, b) ((a) * (b))
#define MUL1_SS(a, b) ((a) * (b))
#define MUL4_SS(a, b) ((a) * (b))
#define MUL5A_SS(a, b) ((a) * (b))
#define MUL6A_SS(a, b) ((a) * (b))
Expand Down Expand Up @@ -319,6 +320,9 @@ static inline SAMPLE SMULR7(SAMPLE a, SAMPLE b) {
// Multiply two SAMPLE values when the result will always be [-1.0, 1.0).
#define MUL0_SS(a, b) FXMUL_TEMPLATE(a, b, 8, 7, S_FRAC_BITS) // 8+7 = 15, so additional 8 bits shift right on output to make 23 req'd total.

// Multiply two SAMPLE values when the result will always be [-2.0, 2.0).
#define MUL1_SS(a, b) FXMUL_TEMPLATE(a, b, 9, 7, S_FRAC_BITS) // 9+7 = 16, so result is >>1, leaving 1 bit integer part.

// Multiply two SAMPLE values when the result will always be [-16.0, 16.0).
#define MUL4_SS(a, b) FXMUL_TEMPLATE(a, b, 10, 9, S_FRAC_BITS) // 10+9 = 19, so result is >>4, leaving 4 bits integer part.

Expand Down
2 changes: 1 addition & 1 deletion src/oscillators.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const LUT *choose_from_lutset(float period, const LUT *lutset) {
INTERP_PART

#define INTERP_LINEAR \
sample = b + MUL0_SS(c - b, frac);
sample = b + MUL1_SS(c - b, frac); /* c - b reaches 2.0 across a full-scale edge */

// Miller's optimization -
// https://github.com/pure-data/pure-data/blob/db777311d808bb3ba728b94ab067f8d333b7d0c2/src/d_array.c#L831C1-L833C76
Expand Down
Binary file modified tests/ref/TestNotchFilter.wav
Binary file not shown.
Binary file modified tests/ref/TestOverload.wav
Binary file not shown.
Loading