alphaTab icon indicating copy to clipboard operation
alphaTab copied to clipboard

transpositionPitches doesn't work on the fly (dynamically)

Open kinesphere opened this issue 2 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

In JS, after the initial render, if I run:

api.settings.notation.transpositionPitches = [7]; api.updateSettings(); api.render();

Nothing changes. All other things I tested work (e.g., api.settings.display.scale = 1.2;), but transpositionPitches and displayTranspositionPitches won't work, although they work fine in the initial render.

Expected Behavior

The notation should display the new pitch (different notes, in the case 7 semitones above from what is shown in the initial render).

Steps To Reproduce

  1. Initialise an alphaTab JS in HTML loading a GP file.
  2. Test in Firefox web developer tools via console, or by creating a function for transpositionPitches, updateSettings and Render.

Link to jsFiddle, CodePen, Project

No response

Found in Version

1.2

Platform

Web

Environment

- **OS**:
- **Browser**:
- **.net Version**:

Anything else?

The fix for me was to modify the library, adding inside the render function: ModelUtils.applyPitchOffsets(this.settings, this.score);

I don't know where is best to have this, but it fixed the issue for me.

kinesphere avatar Jun 10 '22 15:06 kinesphere

👍 I also encountered this when trying to implement an on-the-fly transposition feature.

kyledecot avatar Jun 29 '22 17:06 kyledecot

Reopening to ensure the new pitches are not only visually but also respected on audio.

Danielku15 avatar May 31 '23 19:05 Danielku15