chord-function-calculator
v1.0.0
Published
Calculate chord functions based on key center, chord root, and chord quality.
Downloads
2
Readme
See my website for more information!
Chord Function Calculator is a powerful and intuitive npm package designed for musicians, composers, and developers working with music theory. This package enables users to effortlessly determine the chord function based on the key center, chord root, and chord quality.
npm install chord-function-calculator
Import the package: First, you need to import the
getChordFunctionFromName
function from the package in your JavaScript file.const { getChordFunctionFromName } = require('chord-function-calculator');
Use the function: You can use the
getChordFunctionFromName
function by passing the key center, chord root, and chord quality as arguments.const keyCenter = 'C'; const chordRoot = 'G'; const quality = 'Major7'; const chordFunction = getChordFunctionFromName(keyCenter, chordRoot, quality); console.log(chordFunction); // Outputs: VIMajor7
Example in a Node.js script: Here is a full example of how to use the package in a Node.js script.
const { getChordFunctionFromName } = require('chord-function-calculator'); const keyCenter = 'C'; const chordRoot = 'G'; const quality = 'Major7'; const chordFunction = getChordFunctionFromName(keyCenter, chordRoot, quality); console.log(`The chord function for ${chordRoot}${quality} in the key of ${keyCenter} is: ${chordFunction}`);
I've implemented unit tests for chord calculations and input validation, integration tests for different inputs and error responses.
Next I will improve error messages to make them more descriptive.
I saw firsthand the value of test-driven-development! It greatly increased my development velocity as well as my confidence in the stability of my code.
I've also had fun contributing to the NPM universe. I love NPM and am so happy to make a package that others can use.