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

Add modulation matrix #335

Merged
merged 20 commits into from
Aug 9, 2020
Merged

Add modulation matrix #335

merged 20 commits into from
Aug 9, 2020

Conversation

jpcima
Copy link
Collaborator

@jpcima jpcima commented Jul 27, 2020

Modulation matrix update

This model is operational and it can handle CC.
Support

  • Amplitude
  • Pan
  • Width
  • Position
  • Pitch
  • Volume

Not much tested yet, also I will clean old source which is made obsolete by this.
This will also make obsolete #326.
The CC list will be obtainable by inspecting matrix edges of CC source. Also it permits to have access to the target, and determine a useful name for the midnam item.

@jpcima
Copy link
Collaborator Author

jpcima commented Jul 27, 2020

There is some EventEnvelopesT code #if 0'd in the removal commit above. I'm not sure yet what to replace it with.
I removed all old things regarding modifiers.

@jpcima jpcima requested a review from paulfd July 27, 2020 15:38
@jpcima
Copy link
Collaborator Author

jpcima commented Jul 27, 2020

The commit 51b7322 ensures to always run the modulation source, even if no voice uses it.
This ensures the CC will continue to smooth in the back, even with no voice playing.

@jpcima
Copy link
Collaborator Author

jpcima commented Jul 27, 2020

@paulfd this faces a problem with the smooth filter shortcut..

For instance I'm smoothing pitch CC at center 600, value 1200.
The filter basically stops rising at around 599,121033, and it's too far off of the virtuallyZero` difference threshold such that shortcutting would be possible.

What to do in this case? consider relative difference?

@paulfd
Copy link
Member

paulfd commented Jul 27, 2020

There is some EventEnvelopesT code #if 0'd in the removal commit above. I'm not sure yet what to replace it with.
I removed all old things regarding modifiers.

You can remove it I think, these tests were not great and we can make better ones for the FlexEGs

@paulfd
Copy link
Member

paulfd commented Jul 27, 2020

@paulfd this faces a problem with the smooth filter shortcut..

For instance I'm smoothing pitch CC at center 600, value 1200.
The filter basically stops rising at around 599,121033, and it's too far off of the virtuallyZero` difference threshold such that shortcutting would be possible.

What to do in this case? consider relative difference?

Hmm I'd say yes, but is it OK on both ends ? (e.g. for small values too)

@jpcima
Copy link
Collaborator Author

jpcima commented Jul 27, 2020

but is it OK on both ends ? (e.g. for small values too)

hmm, as a relative distance, how about:
(abs(x-y)) / (abs(y)+virtuallyZero)

@paulfd
Copy link
Member

paulfd commented Jul 27, 2020

Yes that seems reasonable.

@jpcima
Copy link
Collaborator Author

jpcima commented Jul 28, 2020

The only remaining feature that I can see missing, it's a modulation affecting the depth of another modulation.
eg. lfoN_amplitude_onccX
This will be a feature for another PR.

src/sfizz/modulations/ModGenerator.h Outdated Show resolved Hide resolved
src/sfizz/modulations/ModGenerator.h Outdated Show resolved Hide resolved
tests/RegionT.cpp Show resolved Hide resolved
src/sfizz/modulations/sources/Controller.cpp Show resolved Hide resolved
src/sfizz/modulations/ModMatrix.cpp Outdated Show resolved Hide resolved
src/sfizz/modulations/ModMatrix.cpp Outdated Show resolved Hide resolved
useThisSource = (regionId == source.key.region());

if (useThisSource) {
if (isFirstSource) {
Copy link
Member

Choose a reason for hiding this comment

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

Could shortcut here if depth == 0.0f

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes not only you're correct, but there is a greater problem.
The source is supposed to be buffered per region or cycle, not have its generation output used directly.
This makes the source generate more than once if in use by multiple targets.

ie. make use of Source buffer/bufferReady

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See a97f506.
Regarding the shortcut: a future consideration is that depth can be modulated.
When this is implemented, sourceDepth=0 is an insufficient condition, one has also to check that depth is free of any modulations.

I'm sure I to have this idea in mind previously, but postponed it until making the depth modulation.
There is not an immediate benefit anyway, the source will have to implement a fast path in generateDiscarded.

As CC as concerned, I believe the fast path is implementable in case of not smoothing, or smoothing near completed.

@jpcima jpcima merged commit a12cf4e into sfztools:develop Aug 9, 2020
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.

2 participants