music-builder
TypeScript icon, indicating that this package has built-in type declarations

1.2.5 • Public • Published

Music Builder

The Music Builder returns the musical notes for a chord, scale, or any array of intervals. It works in any key up to a double flat or sharp within the 12 tones of western music. It is highly recommended that you use TypeScript when working with this library.

Installation

Use npm to install the dependencies:

npm i music-builder

Usage

Interval Builder

The IntervalBuilder is the heart of the music builder and is utilized in both the chord and scale builders. It allows you to generate any musical idea or pattern you like provided a key and array of intervals.

import { IntervalBuilder } from 'music-builder';

IntervalBuilder.getNotes('C', ['1P', '5P']);
// returns ['C', 'G']

Intervals include:

  • Perfect unison: '1P'
  • Minor second: '2m'
  • Major second: '2M'
  • Minor third: '3m'
  • Major third: '3M'
  • Perfect fourth: '4P'
  • Augmented fourth: '4A'
  • Diminished fifth: '5d'
  • Perfect fifth: '5P'
  • Minor sixth: '6m'
  • Major sixth: '6M'
  • Minor seventh: '7m'
  • Major seventh: '7M'
  • Perfect octave: '8P'

Scale Builder

The ScaleBuilder returns a scale provided a key.

import { ScaleBuilder } from 'music-builder';

ScaleBuilder.major('A');
// returns ['A', 'B', 'C#', 'D',  'E', 'F#', 'G#', 'A']

Scales include:

  • Major
  • Minor
  • Major Pentatonic
  • Minor Pentatonic
  • Dorian
  • Phrygian
  • Lydian
  • Mixolydian
  • Aeolian
  • Locrian

Chord Builder

The ChordBuilder returns a chord provided a key.

import { ChordBuilder } from 'music-builder';

ChordBuilder.major('C');
// returns ['C', 'E', 'G']

Chords include:

  • major
  • major7
  • minor
  • minor7
  • dominant
  • diminished
  • minor7flat5

Contributing

The music-builder is a pet project currently but contributions and ideas for improvement are welcome! Feel free to report any bugs or suggestions on the project's issues page. Before sending a pull request with a new feature, check if it's already been discussed on the issues page and ask yourself three questions:

  1. Are you sure that this new feature is important enough to justify its presence in the music-builder core?
  2. Is it written in a simple, concise way that doesn't add bulk to the codebase?
  3. Is it tested sufficiently?

Code of Conduct

Everyone is invited to participate in the music-builder community and related projects: we want to create a welcoming and friendly environment. Harassment of participants or other unethical and unprofessional behavior will not be tolerated in our spaces. The Contributor Covenant applies to all projects utilizing music-builder.

Thank You

Thanks for taking the time to view this project and I hope it proves itself useful/interesting for you!

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.1-beta.10beta
1.2.54latest

Version History

VersionDownloads (Last 7 Days)Published
1.2.54
1.2.40
1.2.30
1.2.20
1.2.10
1.2.00
1.1.00
1.0.00
1.0.1-beta.10
1.0.1-beta.00
1.0.1-beta.120
1.0.0-beta.120
1.0.0-beta.110
1.0.0-beta.101
1.0.0-beta.90
1.0.0-beta.80
1.0.0-beta.70
1.0.0-beta.60
1.0.0-beta.50
1.0.0-beta.40
1.0.0-beta.30
1.0.0-beta.20
1.0.0-beta.10
1.0.0-beta.00

Package Sidebar

Install

npm i music-builder

Weekly Downloads

5

Version

1.2.5

License

GPL-3.0-or-later

Unpacked Size

27 kB

Total Files

35

Last publish

Collaborators

  • alexkaufman06