Skip to content
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

Blowups and clipping in the stk::Sitar class #117

Closed
gogins opened this issue Oct 4, 2021 · 2 comments
Closed

Blowups and clipping in the stk::Sitar class #117

gogins opened this issue Oct 4, 2021 · 2 comments

Comments

@gogins
Copy link

gogins commented Oct 4, 2021

See the Csound plugins issue csound/plugins#4 for more information.

The following patch fixes the Csound issue:
mkg@xenakis:~/stk$ git diff
diff --git a/src/Sitar.cpp b/src/Sitar.cpp
index 2d3364e..11c493e 100644
--- a/src/Sitar.cpp
+++ b/src/Sitar.cpp
@@ -61,7 +61,7 @@ void Sitar :: setFrequency( StkFloat frequency )
#endif

targetDelay_ = (Stk::sampleRate() / frequency);

  • delay_ = targetDelay_ * (1.0 + (0.05 * noise_.tick()));
  • delay_ = targetDelay_;
    delayLine_.setDelay( delay_ );
    loopGain_ = 0.995 + (frequency * 0.0000005);
    if ( loopGain_ > 0.9995 ) loopGain_ = 0.9995;
    mkg@xenakis:~/stk$
@umlaeute
Copy link

umlaeute commented Oct 4, 2021

thanks for debugging this.
afaics, the incriminating line just adds a little jitter to the delay, e.g. to either prevent phase cancelling or/and make the sounds more lively.
in csound/plugins#4 (comment) (gone by now) you indicated that the delay was actually set to 0, which i wouldn't have expected (unless noise_.tick() emits -20).
probably a better solution would be:

delay_ = targetDelay_ * (1.0 + (0.05 * fabs(noise_.tick())));

@gogins
Copy link
Author

gogins commented Mar 11, 2022

The STK developers have not even assigned the issue I created in their repository, but this is no longer a Csound issue.

@gogins gogins closed this as completed Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants