Skip to content

Instantly share code, notes, and snippets.

@Jeswang
Created August 9, 2023 15:41
Show Gist options
  • Save Jeswang/d4173b154c8e3ace3f6c3b0ba3b49736 to your computer and use it in GitHub Desktop.
Save Jeswang/d4173b154c8e3ace3f6c3b0ba3b49736 to your computer and use it in GitHub Desktop.
import_and_export_alphatab.js
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