-
Notifications
You must be signed in to change notification settings - Fork 322
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
Tools: Tune: dcblock: Create set of cut-off frequencies #8283
Tools: Tune: dcblock: Create set of cut-off frequencies #8283
Conversation
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.
Just needs more inline commentary to make it easier for users to modify and adapt.
7671375
to
1fac74c
Compare
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.
Overall, as a first drafting for changes to cut-off frequencies, it looks good to me, with only a few minor suggestions caught.
Thank you for making the necessary modifications.
tools/tune/dcblock/example_dcblock.m
Outdated
R = 0.5; | ||
R_step = 0.005; | ||
sign = 1; | ||
err_prev = inf; |
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.
The value assigned to err_prev
could be unnecessary.
tools/tune/dcblock/example_dcblock.m
Outdated
|
||
% Iteration 0 | ||
h = (1 - z^-1) / (1 - R * z^-1); | ||
a = abs(h); |
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.
The value assigned to a
could be unnecessary.
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.
Yep, remain from previous iteration code version, both can be deleted.
tools/tune/dcblock/example_dcblock.m
Outdated
|
||
% Sane result? | ||
if R < eps || R > 1 - eps | ||
error("Calculate of R iteration failed") |
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.
Perhaps there is a missing semicolon at the end.
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.
@singalsu issue or not?
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.
I think it's good to have the semicolon there, Matlab syntax does not require it, but possibly it could display unnecessary return status from error(). I'll do Sriram's suggested fixes, stay tuned.
@singalsu Mandatory tests need to pass, otherwise this seems ready to go. |
This patch modifies script example_dblock.m to create in addition to existing default coefficients blob with parameter R=0.98 a set of blobs those provide (-3 dB) cut-off frequencies 20, 30, 40, 50, 100, 200 Hz for 16 kHz and 48 kHz for various usages. Human understandable parameters for blobs helps to select the configuration for the needed dcblock usage. The parameter value R for given frequencies is calculated with iterative function dcblock_rval_calculate(). A closed form equation might be possible to derive from the transfer function. If such is found this function can be replaced with quicker equation -- or with more advanced faster converging iteration. The topology blob export functions are also modified to add comment line for exact build command. Signed-off-by: Seppo Ingalsuo <[email protected]>
1fac74c
to
6bc6574
Compare
@ShriramShastry Thanks for spotting the unnecessary code lines, those are fixed now! |
This patch modifies script example_dblock.m to create in addition to existing default coefficients blob with parameter R=0.98 a set of blobs those provide (-3 dB) cut-off frequencies 20, 30, 40, 50, 100, 200 Hz for 16 kHz and 48 kHz for various usages. Human understandable parameters for blobs helps to select the configuration for the needed dcblock usage.
The parameter value R for given frequencies is calculated with iterative function dcblock_rval_calculate(). A closed form equation might be possible to derive from the transfer function. If such is found this function can be replaced with quicker equation -- or with more advanced faster converging iteration.
The topology blob export functions are also modified to add comment line for exact build command.