JSFiddle - React, Tailwind, and code Playground

by Daniel Kuschny

HTML

<script src="https://cdn.jsdelivr.net/npm/@coderline/alphatab@1.3.0-alpha.119/dist/alphaTab.js"></script>
<button id="play">
Play
</button>
<div id="alphaTab" data-tex="true" data-player-enableplayer="true" data-player-soundfont="https://docs.alphatab.net/develop/assets/js/alphaTab/default.sf2">
\title "Canon Rock"
\subtitle "JerryC"
\tempo 100 
.
1.2.8 2.2.8 3.2.8 3.2.8{gr} 5.2.8
 </div>

CSS

/* Styles for player */
.at-cursor-bar {
  /* Defines the color of the bar background when a bar is played */
  background: rgba(255, 242, 0, 0.25);
}

.at-selection div {
  /* Defines the color of the selection background */
  background: rgba(64, 64, 255, 0.1)
}

.at-cursor-beat {
  /* Defines the beat cursor */
  background: rgba(64, 64, 255, 0.75);
  width: 3px;
}

.at-highlight * {
  /* Defines the color of the music symbols when they are being played (svg) */
  fill: #0078ff;
  stroke: #0078ff;
}

JavaScript

const el = document.getElementById('alphaTab');
let at = new alphaTab.AlphaTabApi(el);
document.getElementById('play').onclick = function(e) {
  e.stopPropagation();
  at.changeTrackMute([0], true)
  at.playPause();
};