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

Limits on attack time for lookup table oscillators #80

Open
dpwe opened this issue Dec 21, 2023 · 2 comments
Open

Limits on attack time for lookup table oscillators #80

dpwe opened this issue Dec 21, 2023 · 2 comments

Comments

@dpwe
Copy link
Collaborator

dpwe commented Dec 21, 2023

Lookup table oscillator (sine, pulse, saw, etc.) interpolate their amplitudes over adjacent frames, to avoid clicks when amplitudes change rapidly. This means the fastest that a note can start from zero is 5.8 ms (one frame), which is a little too long for the attack of some percussive instruments, like a punchy piano. It would be nice to be able to go down to ~1 ms.

Using shorter frames (e.g. 128 samples instead of 256) would improve this, at the cost of greater processing overhead.

We could also special-case attack frames, perhaps with a split linear amplitude fade (ramp up for some sub-portion of the frame, then have a different slope for the remainder).

@dpwe
Copy link
Collaborator Author

dpwe commented Dec 21, 2023

I tried setting AMY_BLOCK_SIZE to 64, and everything worked pretty well (except for PARTIALS, see #81). 64 gives us a minimum attack time of under 1.5 ms which is pretty good, but it means the per-block processing overhead (which involves floating point operations etc) is 4x greater, which will reduce the total number of oscillators we can manage for a given CPU capacity.

See branch test_short_blocks

@PythonLinks PythonLinks mentioned this issue Jan 2, 2024
14 tasks
@dpwe
Copy link
Collaborator Author

dpwe commented Jun 22, 2024

This was mostly solved by a06dad4 which shifted the amplitude envelope one block earlier. Thus, if the envelope generator value at time 0 is 1.0, the osc amplitude starts at 1.0 (previously it would fade from 0 to 1 over the first 5.8ms). This makes possible instantaneous attacks (attack time=0, good for percussion) but still leaves the second fastest attack time limited to 5.8ms.

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

1 participant