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 frequency quantize and MIDI note frequency nodes #66

Merged
merged 4 commits into from
Dec 29, 2024

Conversation

Nytra
Copy link
Collaborator

@Nytra Nytra commented Dec 29, 2024

Also update lang version

@Nytra Nytra changed the title Add frequence quantize and MIDI note frequency nodes Add frequency quantize and MIDI note frequency nodes Dec 29, 2024
@Nytra
Copy link
Collaborator Author

Nytra commented Dec 29, 2024

Currently FrequencyQuantize has a bug with the RoundToNearest mode where it gives the wrong values sometimes

@Xlinka
Copy link
Owner

Xlinka commented Dec 29, 2024

The calculation for closestSemitone does not account for the wrapping nature of scales (e.g., a degree of 11 might be closer to 0).
The adjustment midi += (scaleDegree - closestSemitone) doesn’t properly align the MIDI note because scaleDegree is relative to the root note, not the original MIDI note.

Account for Wrapping: Consider the circular nature of scales by properly handling distances across the 0-11 boundary.

Compute the correct difference between the original MIDI note and the desired semitone relative to the root note.

@Nytra
Copy link
Collaborator Author

Nytra commented Dec 29, 2024

Fixed it

Funny thing is I asked chatGPT for help and it repeatedly gave me broken code and said it wasn't broken lol

@Xlinka Xlinka merged commit 536d406 into Xlinka:main Dec 29, 2024
1 check passed
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