music_notes 0.11.1 copy "music_notes: ^0.11.1" to clipboard
music_notes: ^0.11.1 copied to clipboard

Comprehensive set of utilities for working with music theory concepts.

Dart CI Coverage Status style: very good analysis pub package License

A simple Dart library that provides a comprehensive set of utilities for working with music theory concepts through a beautifully crafted API.

Features #

  • Chords, harmonic functions, and circle of fifths
  • Intervals and qualities
  • Notes, frequencies, accidentals, and enharmonic operations
  • Scales and scale degrees
  • Tonalities, key signatures, and modes
  • Tuning systems (work in progress)

Usage #

Import the package into your Dart code:

import 'package:music_notes/music_notes.dart';

Now, you can use the provided APIs to perform various music theory operations. Here's briefly how it looks:

void main() {
  // Notes
  Note.a.flat; // A♭
  Note.c.sharp; // C♯
  Note.parse('fx'); // F𝄪
  PositionedNote.parse("g''"); // G5
  PositionedNote.parse('Bb3'); // B♭3

  // Intervals
  Note.c.interval(Note.g); // P5
  Note.d.interval(Note.f.sharp).inverted; // m6
  Note.g.flat.transposeBy(-Interval.m3); // E♭

  Interval.P5.circleFrom(Note.c, distance: 12);
  // [C, G, D, A, E, B, F♯, C♯, G♯, D♯, A♯, E♯, B♯]
  Note.c.circleOfFifths();
  // (flats: [F, B♭, E♭, A♭, D♭, G♭], sharps: [G, D, A, E, B, F♯])

  // Scales
  Note.a.flat.major.scale; // A♭ Major (ionian) (A♭ B♭ C D♭ E♭ F G A♭)
  ScalePattern.lydian.on(Note.d).degree(ScaleDegree.iv); // G♯
  Note.c.major.scale.functionChord(
    HarmonicFunction.dominantV / HarmonicFunction.dominantV,
  ); // D maj. (D F♯ A)

  // Chords
  Note.c.majorTriad; // C maj. (C E G)
  ChordPattern.augmentedTriad.add11().add13().on(Note.d.sharp);
  // D♯ aug. (D♯ F𝄪 A𝄪 G♯ B♯)
  Note.f.minorTriad.add7().add9(ImperfectQuality.minor);
  // F min. (F A♭ C E♭ G♭)
  Note.e.flat.diminishedTriad.add7().transposeBy(Interval.m2);
  // F♭ dim. (F♭ A𝄫 C𝄫 E𝄫)

  // Frequencies
  Note.a.inOctave(4).equalTemperamentFrequency(); // 440.0 Hz
  Note.b.flat.inOctave(4).equalTemperamentFrequency(
        reference: Note.c.inOctave(4),
        frequency: const Frequency(256),
      ); // 456.1401436878537 Hz

  // Crazy chaining
  ScalePattern.lydian // Lydian (M2 M2 M2 m2 M2 M2 m2)
      .on(Note.parse('a')) // A Lydian (A B C♯ D♯ E F♯ G♯ A)
      .transposeBy(Interval.M2) // B Lydian (B C♯ D♯ E♯ F♯ G♯ A♯ B)
      .degree(ScaleDegree.iii) // D♯
      .respelledUpwards // E♭
      .major // E♭ major
      .relative // C minor
      .scale // C Natural minor (aeolian) (C D E♭ F G A♭ B♭ C)
      .degreeChord(ScaleDegree.v) // G min. (G B♭ D)
      .add9(); // G min. (G B♭ D A)
}

For more detailed usage instructions and examples, please refer to the API documentation.

Inspiration #

This library is inspired by a range of music theory projects.

Contributing #

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the GitHub repository.

License #

This package is released under the BSD-3-Clause License.

9
likes
0
pub points
62%
popularity

Publisher

unverified uploader

Comprehensive set of utilities for working with music theory concepts.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

collection, meta, test

More

Packages that depend on music_notes