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

Fix: Music Keyboard to Action Conversion Sync #4262

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

MostlyKIGuess
Copy link
Member

Summary

This PR addresses the issue where notes in the action block are 2.6666666665 times longer than those played in the MusicKeyboard. It applies a scale factor to each note's duration before generating the fraction, ensuring the durations match their original lengths.

Changes

  • Divides each note's duration by 2.6666666665 before creating the fraction in the action block.

Code Snippet

const scaleFactor = 2.6666666665;
const maxWidth = Math.max.apply(Math, note.duration) / scaleFactor;
const obj = toFraction(maxWidth);

Testing

  • Verified that the exported action blocks now match the playback lengths in the MusicKeyboard.

Video:

  • Uploaded in the matrix channel.

@Commanderk3
Copy link
Contributor

@MostlyKIGuess It works. But there is one more thing I found. There is a delay (1125 ms) after each note played which is set specifically. Our goal is to make the widget sound the same as the blocks so that users can get a proper idea of how it will fill like when they export it to the action block.
If you make the time to be 1000 ms then we will get our desired result.

time

@Commanderk3
Copy link
Contributor

If we don't edit the time, for shorter notes like 1/16 it will play very fast and a significant difference can be seen.

@Commanderk3
Copy link
Contributor

@pikurasa What do you think? Changing the timeout value to 1000 should be fine I guess.

fixifix.mp4

@MostlyKIGuess
Copy link
Member Author

@MostlyKIGuess It works. But there is one more thing I found. There is a delay (1125 ms) after each note played which is set specifically. Our goal is to make the widget sound the same as the blocks so that users can get a proper idea of how it will fill like when they export it to the action block. If you make the time to be 1000 ms then we will get our desired result.

time

Absolutely, I will change it.

@Commanderk3
Copy link
Contributor

nice work bro 👊

@MostlyKIGuess MostlyKIGuess changed the title Keyboardfix Fix: Music Keyboard to Action Conversion Sync Jan 12, 2025
@MostlyKIGuess
Copy link
Member Author

@pikurasa Do review, this is done as discussed in the matrix channel.

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