一个全面的 Dart 库,旨在简化音乐理论概念的使用。它提供了处理音符、音阶、和弦、音程和调号的工具,拥有直观的 API。非常适合用于构建音乐应用程序、教育工具或音频处理功能的开发者,支持在 Android、iOS、Web、macOS、Windows 和 Linux 上进行跨平台开发。该库将复杂的音乐关系抽象为易于使用的函数,从而实现准确高效的音乐相关计算。
适合场景
音乐应用开发
互动音乐教育
和弦与音阶生成
音频应用逻辑
实时音乐分析
成分辅助
主要特点
注意和音程操作
音阶和和弦构成
调号支持
跨平台兼容性
直观的 API 设计
准确的音乐理论计算
适合对象
Dart 开发者在音乐应用中
教育软件创作者
音频处理项目
使用基于代码的工具的音乐家
需要音乐理论逻辑的应用构建者
使用建议
需要了解基本的音乐理论
仅限理论方面(不包括音频播放)
无内置音效合成
最好配合其他音频库使用
可能需要针对高级用例进行自定义
专注于核心功能的文档
原始 README
以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。
A comprehensive Dart library for effortlessly working with music theory concepts,
offering an elegant and beautifully crafted API.
Features
Notes, accidentals, and enharmonic operations
Intervals, qualities, and circle of fifths
Chords, scales, harmonic functions, inversions and retrogrades
Keys, key signatures, and modes
Frequencies and 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.
For more detailed usage instructions and examples, please refer to the
API documentation.
Notes
Define a Note from a NoteName (.a to .g) and an Accidental, or using their
shorthand static constants:
constNote(.e, .flat); // E♭Note.c; // CNote.d; // DNote.f; // F
NoteNames can be obtained from semitones or ordinal:
ScalePattern.lydian.on(Note.d); // D Lydian (D E F♯ G♯ A B C♯ D)ScalePattern.wholeTone.on(Note.f); // F Whole-tone (F G A B C♯ D♯ F)ScalePattern.majorPentatonic.on(Note.g.flat);
// G♭ Major pentatonic (G♭ A♭ B♭ D♭ E♭ G♭)
Or get it from a Key:
Note.a.flat.major.scale; // A♭ Major (ionian) (A♭ B♭ C D♭ E♭ F G A♭)Note.d.minor.scale; // D Natural minor (aeolian) (D E F G A B♭ C D)
Even experiment with any ScaleDegree or HarmonicFunction:
ScalePattern.lydian.on(Note.e).degree(.iv); // A♯Note.c.major.scale.functionChord(
HarmonicFunction.dominantV / .dominantV,
); // D
Rearrange any collection of Notes, Pitches or PitchClasses
as inversion or retrograde:
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(.M2) // B Lydian (B C♯ D♯ E♯ F♯ G♯ A♯ B)
.degree(.iii) // D♯
.respelledUpwards // E♭
.major // E♭ major
.relative // C minor
.scale // C Natural minor (aeolian) (C D E♭ F G A♭ B♭ C)
.degreeChord(.v) // G-
.add9(); // G-9
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.