question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proper way of implementing transposition

See original GitHub issue

I’m trying to transpose a tablature with notation but it’s not working. I’m not sure if I did follow the wiki correctly.

Here’s the code that I used.

let openSheetMusicDisplay = new opensheetmusicdisplay.OpenSheetMusicDisplay("osmdContainer");
openSheetMusicDisplay.setOptions({
  backend: "svg",
  drawTitle: true,
  drawingParameters: "compacttight" // don't display title, composer etc., smaller margins
});

openSheetMusicDisplay
  .load("$score")
  .then(function() {
    openSheetMusicDisplay.Sheet.Instruments[0].Transpose = 1
    openSheetMusicDisplay.updateGraphic();
    openSheetMusicDisplay.render()
  });

Thank you in advance.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ljfreelancer88commented, Sep 28, 2022

It did transpose using this code.

let openSheetMusicDisplay = new opensheetmusicdisplay.OpenSheetMusicDisplay("osmdContainer");
openSheetMusicDisplay.setOptions({
  backend: "svg",
  drawTitle: true,
  drawingParameters: "compacttight" // don't display title, composer etc., smaller margins
});

openSheetMusicDisplay
  .load("$score")
  .then(() => openSheetMusicDisplay.render());

  // quick and dirty way to transpose
  openSheetMusicDisplay.TransposeCalculator = new opensheetmusicdisplay.TransposeCalculator();
  document.querySelector('.js-transpose').addEventListener('click', function() {    
    openSheetMusicDisplay.Sheet.Instruments[0].Transpose = 2;
    openSheetMusicDisplay.updateGraphic();
    openSheetMusicDisplay.render();
  });
0reactions
sschmidTUcommented, Sep 28, 2022

Great! I would probably just create the TransposeCalculator once directly after creating the OSMD object, but it’s a tiny class, so it shouldn’t matter performance-wise.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working & List Of Transposition Techniques - eduCBA
Guide to Transposition techniques. Here we discuss the basic concept and List of Transposition Techniques with steps, examples, and working of Algorithms.
Read more >
algorithm - Transposition tables? - Stack Overflow
To encode a game position in a Zobrist key, take each stone, and for its colour and its position, take the number you...
Read more >
Transposition Cipher - Tutorialspoint
Transposition Cipher is a cryptographic algorithm where the order of alphabets in the plaintext is rearranged to form a cipher text.
Read more >
Transposition Tables & Zobrist Keys - Advanced Java Chess ...
Your browser can't play this video. Learn more. Switch camera.
Read more >
The Most Effective Way to Transpose Music - Music Theory
Musicians often need to transpose music from one key to another, in order to accommodate transposing instruments or to realign music in a ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found