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: Corrected MIDI pitch note addition bug #4216

Merged
merged 2 commits into from
Jan 3, 2025

Conversation

Abhay145
Copy link
Contributor

Description

This fix resolves an issue where newly added 'pitch' notes in the Music Keyboard Widget did not work with MIDI playback until the keyboard was restarted. While notes through virtual keyboard were clickable, they failed to play with MIDI initially.

Changes Made

1.Replaced the simpler pitchLabels array with a detailed version including sharps
2.Updated the logic to ensure new pitches don’t duplicate existing ones in the layout.
3.Ensured getElement mappings are updated immediately for new notes:

Testing

Verified that new pitches are functional immediately via MIDI without requiring a widget restart.

Untitled.video.-.Made.with.Clipchamp.mp4

Related Issue

Fixes #4149 - Bug in MIDI

@Abhay145
Copy link
Contributor Author

Abhay145 commented Jan 2, 2025

@walterbender @pikurasa Pls review it

@@ -1917,7 +1917,8 @@ function MusicKeyboard(activity) {
this._createAddRowPieSubmenu = function () {
docById("wheelDivptm").style.display = "";
// docById("wheelDivptm").style.zIndex = "300";
const pitchLabels = ["do", "re", "mi", "fa", "sol", "la", "ti"];
const pitchLabels = [ "do", "do♯", "re", "re♯", "mi", "fa", "fa♯", "sol", "sol♯", "la", "la♯", "ti",
Copy link
Member

Choose a reason for hiding this comment

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

Please remove spaces before "do" and put the ] on this line.

@@ -2115,6 +2119,11 @@ function MusicKeyboard(activity) {
this.displayLayout = this.displayLayout.concat(sortedHertzList);
this._createKeyboard();
this._createTable();
const n= this.layout.length;
Copy link
Member

Choose a reason for hiding this comment

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

please add space before =

@@ -2115,6 +2119,11 @@ function MusicKeyboard(activity) {
this.displayLayout = this.displayLayout.concat(sortedHertzList);
this._createKeyboard();
this._createTable();
const n= this.layout.length;
const key = this.layout[n-1];
Copy link
Member

Choose a reason for hiding this comment

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

please add spaces around -

@Abhay145
Copy link
Contributor Author

Abhay145 commented Jan 2, 2025

@walterbender I have made the required changes. Please review

@walterbender walterbender merged commit ba4ec7f into sugarlabs:master Jan 3, 2025
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.

Bug in MIDI
2 participants