chord-canvas 1.0.1

dotnet add package chord-canvas --version 1.0.1
                    
NuGet\Install-Package chord-canvas -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="chord-canvas" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="chord-canvas" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="chord-canvas" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add chord-canvas --version 1.0.1
                    
#r "nuget: chord-canvas, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package chord-canvas@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=chord-canvas&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=chord-canvas&version=1.0.1
                    
Install as a Cake Tool

ChordCanvas

ChordCanvas is a small C# library which provides an API for generating images of guitar chord diagrams on a HTML5 canvas. Based on https://github.com/acspike/ChordJS, which in turn was based on a .NET web service.

This library uses the implementation of a HTML5 canvas for Microsoft Blazor, found here. This API does not provide a mechanism to create or retrieve chord objects, nor the actual canvas for drawing to. It should be paired with a web service or app that can construct the requested chord data, and the canvas context is passed as a parameter on a draw call.

If you wish to use this API in your own project, it can be cloned as is and added as a project reference, using

git clone https://github.com/amayesingnathan/chord-canvas.git

or it is available as a NuGet package here.

Documentation

Syntax

A chord draw request is made by calling CanvasAPI.CreateImage(Canvas2DContext ctx, Chord chord, Layout layout, double size). This function is marked as async and has no return value.

  • ctx: The context for the canvas on which the image is drawn. Full type signature is Blazor.Extensions.Canvas.Canvas2D.Canvas2DContext.

  • chord: The chord to be drawn. This object is explained below in further detail.

  • layout: The layout enum for the chord diagram. '1' would draw the finger names onto the strings and show the string names below the diagram. '2' would draw the finger names below the chord diagrams and not dispaly the string names.

  • size: The size of the chord diagram to generate. E.g.: 3 for medium size or 5 for a pretty big size.

Chord

The layout of the chord object is heavily influenced by the UberChord API (https://api.uberchord.com/), as this is what was used to retrieve chords.

  • Strings: A string containing the fret on each string for the chord, separated by spaces. E.g. 'X 3 2 0 1 0' for C major.

  • Fingering: Similar to strings, except the fingers to use on each string. E.g. 'X 3 2 X 1 X' for C major.

  • ChordName: A string containing 4 components separated by commas. The components are root note, quality, tension, and bass note. E.g. 'C,,,' for C major.

  • EnharmonicChordName: Same as ChordName, but the enharmonic equivalent chord name. E.g. 'A#,,,' for Bb major.

  • VoicingID: Provides an ID for the chord shape (i.e. Am shape).

  • Tones: A list of the notes in the chord separated by commas. E.g. 'A,C#,E,G' for Amaj7.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 199 4/15/2024
1.0.0 309 10/16/2022