abcjs-music / obsidian-plugin-abcjs

Plugin which renders music notations from code blocks
189 stars 14 forks source link

I can't modify tuning #27

Open Microbion opened 1 year ago

Microbion commented 1 year ago

Thanks for tablature in new version. I can use TAB in obsidian. But TAB can't show when I modify the tuning parameter. Do I misunderstand the tuning parmater? I followed tablature totural. Here's my code:

{
  "tablature": [{"instrument": "guitar",
  "capo": 1,
  "label": "Guitar (%T)",
  "tuning": ["E", "A", "D", "G", "B", "e"]
 }]
}
---
X:1
T: Cooley's
M: 4/4
L: 1/8
R: reel
K: G
|:D2|EB{c}BA B2 EB|~B2 AB dBAG|FDAD BDAD|FDAD dAFD|

and TAB was lost without any warnings. image When I dropped tuning parameter, It worked as expected.

{
  "tablature": [{"instrument": "guitar",
  "capo": 1,
  "label": "Guitar (%T)"
 }]
}
---
X:1
T: Cooley's
M: 4/4
L: 1/8
R: reel
K: G
|:D2|EB{c}BA B2 EB|~B2 AB dBAG|FDAD BDAD|FDAD dAFD|

image

alensiljak commented 1 year ago

Thanks for the report. The plugin code is fairly simple and should just pass on all the parameters to abcjs. I've tried with a simple HTML file:

<!DOCTYPE html>
<html>
<body>
    <div id="paper"></div>

    <script src="https://cdn.jsdelivr.net/npm/abcjs@6.1.6/dist/abcjs-basic-min.js"></script>

    <script>
        var options = {
            responsive: "resize",
            "tablature": [{"instrument": "guitar",
                "capo": 1,
                "label": "Guitar (%T)",
                "tuning": ["E", "A", "D", "G", "B", "e"]
            }]
        }

        let abcCode = "F c F c"

        ABCJS.renderAbc('paper', abcCode, options);
    </script>

</body>
</html>

and the same is happening.

Pinging @paulrosen.

paulrosen commented 1 year ago

Sorry for such a late response! I've been underwater here. There are two issues:

First, the lower notes are in the wrong octave and need a comma, so if you change it to the following it will work:

"tuning": ["E,", "A,", "D", "G", "B", "e"]

Second, clearly that case should have been handled. If you want to put light strings on the bottom of your guitar that's ok with me! I'll improve the error checking in the next version

Microbion commented 1 year ago

Thank @alensiljak and @paulrosen. It's my misunderstanding, and now I get it. I transform standard tuning to open D,and it works: "tuning": ["D,", "A,", "D", "#F", "A", "d"] image I suggest to permit light strings on the bottom. In that way, I can record ukelele scores with violin style.

Microbion commented 1 year ago

"tuning": ["D,", "A,", "D", "^F", "A", "d"] is suitful for open D tuning, right? image