All Projects → tonaljs → Tonal

tonaljs / Tonal

Licence: mit
A functional music theory library for Javascript

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Tonal

mahler.c
Western music theory library in C99
Stars: ✭ 13 (-99.4%)
Mutual labels:  scale, music-theory, chords, interval, key-signatures
chords
Text-based chord progression editor
Stars: ✭ 25 (-98.84%)
Mutual labels:  music-theory, chords, chord-progression
Scribbletune
Create music with JavaScript
Stars: ✭ 3,509 (+62.76%)
Mutual labels:  scale, music, chords
MusicTheory
Music Theory Library for Java and Android apps
Stars: ✭ 24 (-98.89%)
Mutual labels:  scale, music-theory, chords
arpeggio
A chord naming app for guitar written in React.
Stars: ✭ 49 (-97.73%)
Mutual labels:  music-theory, chords
Musictheory
Universal music theory library for iOS, iPadOS, macOS, tvOS and watchOS in Swift
Stars: ✭ 262 (-87.85%)
Mutual labels:  interval, scale
Chordious
Fretboard diagram generator for fretted stringed instruments.
Stars: ✭ 22 (-98.98%)
Mutual labels:  scale, music
Kotlin Openapi Spring Functional Template
🍃 Kotlin Spring 5 Webflux functional application with api request validation and interactive api doc
Stars: ✭ 159 (-92.63%)
Mutual labels:  functional
Folktale
[not actively maintained!] A standard library for functional programming in JavaScript
Stars: ✭ 1,995 (-7.47%)
Mutual labels:  functional
Ni Media
NI Media is a C++ library for reading and writing audio streams.
Stars: ✭ 158 (-92.67%)
Mutual labels:  music
Html Midi Player
🎹 Play and display MIDI files on the web
Stars: ✭ 158 (-92.67%)
Mutual labels:  music
Openbook
Open source lilypond real book for Jazz musicians
Stars: ✭ 159 (-92.63%)
Mutual labels:  music
Electronic Netease Music
Netease Music built by Electron
Stars: ✭ 164 (-92.39%)
Mutual labels:  music
Omr Datasets
Collection of datasets used for Optical Music Recognition
Stars: ✭ 158 (-92.67%)
Mutual labels:  music
Lstm Music Genre Classification
Music genre classification with LSTM Recurrent Neural Nets in Keras & PyTorch
Stars: ✭ 166 (-92.3%)
Mutual labels:  music
Viano
A toy that lets you write songs using Vue components.
Stars: ✭ 158 (-92.67%)
Mutual labels:  music
Music Suite
Music in Haskell
Stars: ✭ 166 (-92.3%)
Mutual labels:  music
Undermoon
Mordern Redis Cluster solution for easy operation.
Stars: ✭ 166 (-92.3%)
Mutual labels:  scale
Blossom
A lovely interactive music generator
Stars: ✭ 162 (-92.49%)
Mutual labels:  music
Discord Player
🎧 Complete framework to simplify the implementation of music commands using discords.js v12
Stars: ✭ 161 (-92.53%)
Mutual labels:  music

tonal

npm version build status minified size gzipped size

tonal is a music theory library. Contains functions to manipulate tonal elements of music (note, intervals, chords, scales, modes, keys). It deals with abstractions (not actual music or sound).

tonal is implemented in Typescript and published as a collection of Javascript npm packages.

It uses a functional programing style: all functions are pure, there is no data mutation, and entities are represented by data structures instead of objects.

Example

import { Interval, Note, Scale } from "@tonaljs/tonal";

Note.midi("A4"); // => 60
Note.freq("a4").freq; // => 440
Note.accidentals("c#2"); // => '#'
Note.transpose("C4", "5P"); // => "G4"
Interval.semitones("5P"); // => 7
Interval.distance("C4", "G4"); // => "5P"
Scale.get("C major").notes; // =>["C", "D", "E", "F", "G", "A", "B"];

Install

Install all packages at once:

npm install --save @tonaljs/tonal

Usage

Tonal is compatible with both ES5 and ES6 modules, and browser.

ES6 import:

import { Note, Scale } from "@tonaljs/tonal";

ES5 require:

const { Note, Scale } = require("@tonaljs/tonal");

Browser

You can use the browser version from jsdelivr CDN directly in your html:

<script src="https://cdn.jsdelivr.net/npm/@tonaljs/tonal/browser/tonal.min.js"></script>
<script>
  console.log(Tonal.Key.minorKey("Ab"));
</script>

Or if you prefer, grab the minified browser ready version from the repository.

Bundle size

@tonaljs/tonal includes all published modules.

Although the final bundle it is small (~10kb minified and gzipped), you can reduce bundle sizes even more by installing the modules individually, and importing only the functions you need:

npm i @tonaljs/note
import { transpose } from "@tonaljs/note";
transpose("A4", "P5");

Documentation

Generally, you just need to install:

The API documentation lives inside README.md file of each module

Notes and intervals

Scales and chords

Keys, chord progressions

Time, rhythm

Utilities

Contributing

Read contributing document for instructions

Inspiration

This library takes inspiration from other music theory libraries:

Projects using tonal

Showcase of projects that are using Tonal:

Thank you all!

Add your project here by editing this file

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].