-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closing Issue/67 #76
Closing Issue/67 #76
Changes from 5 commits
dba25a9
1da0b24
9d4e132
417a367
aeb80f0
b9d2d87
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,7 +91,7 @@ namespace Jamoma { | |
@param x1 Sample value at prior integer index | ||
@param x2 Sample value at next integer index | ||
@param x3 Unused sample value | ||
@param delta Fractional location between x1 (delta=0) and x1 (delta=1) | ||
@param delta Fractional location between x1 (delta=0) and x2 (delta=1) | ||
@return The interpolated value | ||
*/ | ||
template<class T> | ||
|
@@ -108,6 +108,41 @@ namespace Jamoma { | |
return x1 + delta * (x2-x1); | ||
} | ||
}; | ||
|
||
/** Allpass interpolation | ||
Testing shows this algorithm will become less accurate the more points it computes between two known samples. | ||
Also, because it uses an internal history, the reset() function should be used when switching between non-continuous segments of sampled audio data. | ||
@param x0 Unused sample value | ||
@param x1 Sample value at prior integer index | ||
@param x2 Sample value at next integer index | ||
@param x3 Unused sample value | ||
@param delta Fractional location between x1 (delta=0) and x2 (delta=1) @n | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment about x0 and x1 |
||
Be aware that delta=1.0 may not return the exact value at x2 given the nature of this algorithm. | ||
@return The interpolated value | ||
*/ | ||
template<class T> | ||
class Allpass : Base { | ||
public: | ||
static const int delay = 1; | ||
T last_out = T(0.0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it is a private member then it should be mCamelCase (you noted that you saw this at the last moment). It should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that should be private so |
||
|
||
constexpr T operator()(T x1, T x2, double delta) noexcept { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment about x0 and x1 |
||
T out = x1 + delta * (x2-last_out); | ||
last_out = out; | ||
return out; | ||
} | ||
|
||
constexpr T operator()(T x0, T x1, T x2, T x3, double delta) noexcept { | ||
// NW: ideally we would call the operator above to remain DRY, but I could not get syntax right | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you try something like |
||
T out = x1 + delta * (x2-last_out); | ||
last_out = out; | ||
return out; | ||
} | ||
|
||
void reset() { | ||
last_out = T(0.0); | ||
} | ||
}; | ||
|
||
|
||
/** Cosine interpolation | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be consistent with other places in our code, should it be x0 (current input) and x1 (previous input) ?