Installation (Web)
The web version of alphaTab is suitable for building websites displaying and playing musicsheets in different fashions. You can create websites that offer Guitar Tabs for download, provide lessons to students or just if you want to share your composed music with others. It's up to you what you make out of alphaTab.
You can either install alphaTab wia NPM or just download the package manually and place it in your project. So far we do not offer a CDN.
Grab your Copy​
- NPM
- CDN
- Local Copy
We provide NPM packages via npmjs.com. Just install the package via:
npm install @coderline/alphatab
And alphaTab is downloaded to your node_modules for usage in your application.
We do not provide a CDN on our own but there are various CDNs on top of NPM. You can use one of these to integrate alphaTab to your installation.
The easiest way to obtain a local copy is to use the download button over at jsdelivr.com. Select the version you want to have and press the download button on the top right side.
Then unpack the assets to your project and you're all set to start developing.
Using AlphaTab
Once you have alphaTab in your project simply include it and start using it. The next pages will explain you how to configure alphaTab and use it. You can also check out our tutorials to learn in a more stepwise approach how to continue.
You can also find various sample projects for different usage types over at:
- Browser (ESM)
- Browser (Classic)
- Node.js
- Angular
- React
- Vue.js
You can import
alphaTab from within the browser as JavaScript Module (ESM).
The following code illustrates the setup in a script tag but you can also use imports
from within any other JavaScript module file.
<div id="alphaTab">
\title "Hello alphaTab"
.
:4 0.6 1.6 3.6 0.5 2.5 3.5 0.4 2.4 |
3.4 0.3 2.3 0.2 1.2 3.2 0.1 1.1 |
3.1.1
</div>
<script type="module">
// here we use JsDelivr as source (notice the .mjs extension which indicates the module variant)
import * as alphaTab from 'https://cdn.jsdelivr.net/npm/@coderline/alphatab@latest/dist/alphaTab.min.mjs'
// initialize alphaTab on the prepared element
const element = document.getElementById('alphaTab');
const api = new alphaTab.AlphaTabApi(element, {
tex: true
});
</script>
The output of this is:
If you are not yet using JavaScript modules you can also import alphaTab as global variable into your browser via the Universal Module Definition flavor.
<div id="alphaTab">
\title "Hello alphaTab"
.
:4 0.6 1.6 3.6 0.5 2.5 3.5 0.4 2.4 |
3.4 0.3 2.3 0.2 1.2 3.2 0.1 1.1 |
3.1.1
</div>
<script src="https://cdn.jsdelivr.net/npm/@coderline/alphatab@latest/dist/alphaTab.min.js"></script>
<script type="text/javascript">
// initialize alphaTab on the prepared element
const element = document.getElementById('alphaTab');
const api = new alphaTab.AlphaTabApi(element, {
tex: true
});
</script>
The output of this is:
For usage in Node.js refer to this guide. Generally alphaTab can be added in Node.js via both require
and import
of the NPM package:
// alphaTab via CJS
const alphaTab = require("@coderline/alphatab");
// alphaTab via modules
import * as alphaTab from '@coderline/alphatab';
For Node.js currently only low-level APIs are available but we also plan to improve the usage to render music sheets on a "virtual UI" producing images via alphaSkia.
alphaTab doesn't provide yet an out-of-the box Angular control and integration which would take care of all bindings and UI hooks. Therefore developers are expected to do the low level DOM mapping and Angular integration as part of their application. Through Angular means of creating DOM elements (e.g. ElementRef), alphaTab can be started into them. Then you can take care of bindings according to your needs using the alphaTab APIs to update.
AlphaTab is sensitive to bundling as it spawns background WebWorkers and AudioWorklets. AlphaTab comes with plugins for various bundlers which takes care of the right configurations and bundling logic so that alphaTab can operate.
- WebPack: Installation (WebPack)
- Vite: Installation (Vite)
alphaTab doesn't provide yet an out-of-the box React control and integration which would take care of all bindings and UI hooks. Therefore developers are expected to do the low level DOM mapping and React integration as part of their application. Through React means of creating DOM elements (e.g. Refs), alphaTab can be started into them. Then you can take care of bindings according to your needs using the alphaTab APIs to update.
AlphaTab is sensitive to bundling as it spawns background WebWorkers and AudioWorklets. AlphaTab comes with plugins for various bundlers which takes care of the right configurations and bundling logic so that alphaTab can operate.
- WebPack: Installation (WebPack)
- Vite: Installation (Vite)
alphaTab doesn't provide yet an out-of-the box Vue control and integration which would take care of all bindings and UI hooks. Therefore developers are expected to do the low level DOM mapping and React integration as part of their application. Through React means of creating DOM elements (e.g. Refs), alphaTab can be started into them. Then you can take care of bindings according to your needs using the alphaTab APIs to update.
AlphaTab is sensitive to bundling as it spawns background WebWorkers and AudioWorklets. AlphaTab comes with plugins for various bundlers which takes care of the right configurations and bundling logic so that alphaTab can operate.
- WebPack: Installation (WebPack)
- Vite: Installation (Vite)
Additional Notes​
Dependencies​
AlphaTab does not need any other libraries as dependency. It ships with everything it needs out of the box. But to operate alphaTab in the web with all features there are still 2 dependencies involved:
- Bravura is the Music Font of our choice. It is a free font containing music notation symbols. AlphaTab bundles this font and it is placed right beside the script files.
- To play audio a SoundFont2 file is needed. It contains the audio samples for the instruments to be played via the midi synthesizer of alphaTab. AlphaTab comes with a copy of a SONiVOX based SoundFont which is part of the Android Open Source Project and available for free under Apache License.