Skip to main content

Installation (.net)

The .net version of alphaTab can be used to render music notation either on servers, command line tools or on Windows desktop applications. AlphaTab comes with a .net version for either .net standard 2.0 or .net 8.0.

Grab your Copy​

NuGet.org​

We provide NuGet packages based on the latest development version via NuGet.org. Install packages like usual:

Core Package (.net standard 2.0)

https://www.nuget.org/packages/AlphaTab/

Windows Package (.net core 8.0 - WPF/WinForms)

https://www.nuget.org/packages/AlphaTab.Windows/

Local Copy​

While not recommended, you can grab the latest DLLs by downloading the Nupkg and unzipping it to your local folder. Afterwards you can reference the DLLs from this folder.

Initializing alphaTab​

Console​

For console applications you would start using the low level API of alphaTab like the ScoreLoader and ScoreRenderer. Usually, alphaTab provides controls UI platforms based on the AlphaTabApi. But for platforms where no UI is available, just start using the normal classes that alphaTab provides. You can refer to the samples in the GitHub repository for some kick-starter code.

// load score
var score = AlphaTab.Importer.ScoreLoader.LoadScoreFromBytes(File.ReadAllBytes(args[0]));

// render score with svg engine and desired rendering width
var settings = new AlphaTab.Settings();
settings.Core.Engine = "skia";
var renderer = new AlphaTab.Rendering.ScoreRenderer(settings)
{
Width = 970
};
var partialImages = new List<SKImage>();
var totalWidth = 0;
var totalHeight = 0;
renderer.PartialRenderFinished.On(r => { images.Add((SKImage) r.RenderResult); });
renderer.RenderFinished.On(r =>
{
totalWidth = (int) r.TotalWidth;
totalHeight = (int) r.TotalHeight;
});
renderer.RenderScore(score, new double[] { track.Index });

WPF​

For WPF we provide a UI control with the core functionality of alphaTab:

<Window x:Class="AlphaTab.Samples.Wpf.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wpf="clr-namespace:AlphaTab.Wpf;assembly=AlphaTab.Windows"
Title="AlphaTab" Height="800" Width="600" WindowState="Maximized">
<wpf:AlphaTab Tracks="{Binding TracksToDisplay}">
</wpf:AlphaTab>
</Window>
public IEnumerable<AlphaTab.Model.Track> TracksToDisplay { get; }

WinForms​

There is also a WinForms control that you can start using:

var control = new AlphaTab.WinForms.AlphaTabControl();
control.Dock = System.Windows.Forms.DockStyle.Fill;
this.Controls.Add(control);
control.Tracks = new []{ score.Tracks[0] };

Additional Notes​

You might want to check out the samples at https://github.com/CoderLine/alphaTabSamplesDotNet/ to get a small impression how to hook up things.

Dependencies​

For the .net Version alphaTab needs to rely on some 3rd party libraries to do certain operations.

  1. For rendering, either the built-in graphics library GDI+ can be used or alphaTab comes with a dependency to AlphaSkia for modern cross platform rendering of images. Skia is the graphics engine used in Chrome and is proven to be fast and reliable. We recommend using Skia as rendering engine over GDI+.

  2. For audio playback alphaTab comes with a dependency to NAudio which is used to play the synthesized sound.

If you want to get support for other UI frameworks or audio libraries feel free to reach out to us.