Created
August 9, 2023 15:41
-
-
Save Jeswang/d4173b154c8e3ace3f6c3b0ba3b49736 to your computer and use it in GitHub Desktop.
import_and_export_alphatab.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const alphaTab = require("@coderline/alphatab"); | |
const fs = require("fs"); | |
const fileData = fs.readFileSync("sound-reproduce/accentuations-input.gp"); | |
const settings = new alphaTab.Settings(); | |
const score = alphaTab.importer.ScoreLoader.loadScoreFromBytes( | |
new Uint8Array(fileData), | |
settings | |
); | |
const json = alphaTab.model.JsonConverter.scoreToJson(score) | |
console.log(json) | |
const exporter = new alphaTab.exporter.Gp7Exporter() | |
const data = exporter.export(score, settings); | |
fs.writeFile("sound-reproduce/accentuations-output.gp", data, (err) => { | |
if (err) { | |
console.log(err); | |
} else { | |
console.log('File written successfully!'); | |
} | |
}); | |
console.log(score.title); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment