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

Smooth retrigger #239

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Smooth retrigger #239

wants to merge 5 commits into from

Conversation

dpwe
Copy link
Collaborator

@dpwe dpwe commented Nov 2, 2024

Under this change, we add state for each BP_SET that records which segment it was in (synth[osc].current_seg[bp_set]), and has a dynamic field for the start value of the current envelope segment (synth[osc].seg_start_val[bp_set]). When compute_breakpoint_scale detects that the envelope is in a new segment, it sets seg_start_val to the most recently-returned scale value (last_scale) and the envelope segment proceeds from there.

This is quite nice in that it subsumes the previous behavior of release segments (which started from wherever you had gotten to) and extends it to the attack segment of retriggered notes. If you want to always restart your attacks from 0, simply add a '0,0,' prefix to your envelope spec.

This was to allow smooth retriggering of waveforms as suggested by @vijaymarupudi on Discord.

@vijaymarupudi
Copy link
Contributor

vijaymarupudi commented Nov 2, 2024

This is great, thank you very much again! I'm learning a lot by reading the code you've written, hopefully I can contribute to amy one day!

While the clicking in the sine waves is fixed, I seem to be hearing clicking when I use square waves, but only with a filter (and I suspect, only when I use note ons?). Just implemented recording functionality in my codebase to provide more data.

Oscillator settings: v0w1G1F500a8A10,1,1000,0Z

Screenshot from 2024-11-02 17-25-33

Here's a link to the .wav file if you want it, Github doesn't seem to allow me to upload it directly here: https://gtvault-my.sharepoint.com/personal/vmarupudi3_gatech_edu/_layouts/15/download.aspx?share=EVrEEvvLloJPsxnsiB6kREgB9vtVjejUBDZZrSRO5IEK2A

@dpwe
Copy link
Collaborator Author

dpwe commented Nov 3, 2024

I moved the filter reset to occur only at the same time as the phase reset. I think that will fix the discontinuity you saw, and it seems to leave most things unharmed. There were small changes in several of the tests, I think because some notes may terminate a frame or two earlier, but nothing I could notice by ear.

@vijaymarupudi
Copy link
Contributor

I can confirm that the issue is fixed for the monophonic square wave! I can't hear any clicks at all! Thank you so much!

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