Skip to content

cmxl/MIDIPiano

 
 

Repository files navigation

MIDI Piano

This is a simple MIDI piano component for Blazor.
It will use the Web MIDI API in the future.
Currently it run on a custom notation format and mp3 samples.

Initial idea and code from @dominikz98


Usage

  • Add a project reference to MIDIPiano in your Blazor project.

  • Add the following to your index.html file:

<script src="_content/MIDIPiano/scripts/audio.js"></script>
  • Add the following to your _Imports.razor file:
@using MIDIPiano
@using MIDIPiano.Components
  • Add the following to your razor page view:
<Piano @ref="Piano" />
  • Add the following to your razor page code:
using MIDIPiano;
using MIDIPiano.Components;

public partial class MyRazorPage
{
	Piano Piano { get; set; }
	
	protected override void OnAfterRender(bool firstRender)
	{
		if (firstRender)
		{
			// this is just to demonstrate the usage of the component
			Piano.Song = MusicSheets.FadedByAlanWalker.MapToVm();
			Piano.Play();
		}
	}
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 93.5%
  • CSS 4.1%
  • HTML 1.3%
  • JavaScript 1.1%