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

wavetable morph interpolation discontinuity #7778

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

blancoberg
Copy link
Contributor

This addresses the following:

Continuous frame interpolation
The interpolation between frames weren't continuous, which could introduce lots of noise in some cases. It was especially apparent in noisy/phase shifting wavetables.

Seamless loop in "one shot"-mode
So it turns out that you can actually loop "one shots". In one-shot-mode the unison voices parameter acts as a loop counter.
Anything between 1-6 loops the sample that amount of times. Anything over 7 will loop forever.
The loop was not seamless though, so that has been adressed.

Addresses #7777

This addresses the following:
* continuous frame interpolation
* seamless loop in "one shot"-mode
tableid = limit_range((int)intpart, 0, (int)oscdata->wt.n_tables - 2 + nointerp);

if (tableid > last_tableid)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this code removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the logic for the old morph interpolation. It has to be removed for the new one to work.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case please comment it out instead of removing it, since this code will have to remain here in order for the option switch to work.

Copy link
Contributor Author

@blancoberg blancoberg Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case please comment it out instead of removing it, since this code will have to remain here in order for the option switch to work.

ok, but you you told me the opposite about my last pr that I should just remove instead of commenting out, since there is a git history :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference is that we know we'll need this code soon. :) Leaving commented-out code blocks hanging around indefinitely is what we want to avoid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it. I'll change it to a comment

@@ -62,10 +62,12 @@ void WavetableOscillator::init(float pitch, bool is_display, bool nonzero_init_d

n_unison = limit_range(oscdata->p[wt_unison_voices].val.i, 1, MAX_UNISON);

isOneShot = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a bool you can use the constant true and false for better readability here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isOneShot is actually not used anymore. I added it because it was used as a check in convolute(), but I realised later that it wasn't needed. I forgot to remove it.
Should I remove it or just change it to a bool?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is completely unused it can be removed.

if (oscdata->wt.flags & wtf_is_sample)
{
sampleloop = n_unison;
n_unison = 1;
isOneShot = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

@baconpaul
Copy link
Collaborator

So that test failure looks real. Also added a couple of comments.

Once those are resolved we should add a 1.4 issue to put this behind a flag or add a changelog entry

removed isOneShot
made removed logic a comment instead
@baconpaul
Copy link
Collaborator

Ok will have to look into that test

you don’t have a Linux box right? If not I can look after the weekend but only have Mac with me right now

@blancoberg
Copy link
Contributor Author

Ok will have to look into that test

you don’t have a Linux box right? If not I can look after the weekend but only have Mac with me right now

Only pc/windows here :/

@baconpaul
Copy link
Collaborator

Ok!
We can get to this early next eeek when I have Linux booted then (or maybe I’ll try it under Asan on my Mac if I have a chance)

wonder what it could be

@blancoberg
Copy link
Contributor Author

Ok! We can get to this early next eeek when I have Linux booted then (or maybe I’ll try it under Asan on my Mac if I have a chance)

wonder what it could be

So I just installed linux/ubuntu on virtualbox and it builds without any issues. All audio in virtualbox is glitchy though, so I can't really do any sound tests

@baconpaul
Copy link
Collaborator

Does the test pass when you run it? That’s really what we need to figure out

@blancoberg
Copy link
Contributor Author

How do i do that?

@baconpaul
Copy link
Collaborator

Sorry

built the target surge-testrunner
Then run the executable that results from the base of the source directory

@blancoberg
Copy link
Contributor Author

===============================================================================
All tests passed (5862500 assertions in 109 test cases)

But honestly I don't know what I'm doing so you should probably do a test yourself to be sure :)

@baconpaul
Copy link
Collaborator

Ok lemme kick ci again just in case it’s an actions gremlin and if it fails I’ll try the particular test under sssn or some such

@mkruselj
Copy link
Collaborator

mkruselj commented Sep 5, 2024

And it worked!

@baconpaul
Copy link
Collaborator

That’s frustrating - I should have tried that a week ago :(

sorry about that

Let me merge this then

evil - any thoughts on the menu for the ifs?

@baconpaul baconpaul merged commit 110e99f into surge-synthesizer:main Sep 5, 2024
10 checks passed
@mkruselj
Copy link
Collaborator

mkruselj commented Sep 6, 2024

@baconpaul Similar to Sine osc, call the option Legacy mode, disabled by default for new patches, enabled for old patches.

@baconpaul
Copy link
Collaborator

@baconpaul Similar to Sine osc, call the option Legacy mode, disabled by default for new patches, enabled for old patches.

And stick it as deform on which param? Morph probably right?

@mkruselj
Copy link
Collaborator

mkruselj commented Sep 6, 2024

Yup!

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

Successfully merging this pull request may close these issues.

4 participants