PHPackages                             chaloman/tonal-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. chaloman/tonal-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

chaloman/tonal-php
==================

PHP port of Tonal.js - A music theory library for notes, intervals, chords, scales, and more

v1.2.0(5mo ago)015MITPHPPHP ^8.3

Since Dec 12Pushed 4mo agoCompare

[ Source](https://github.com/ChalomanDev/tonal-php)[ Packagist](https://packagist.org/packages/chaloman/tonal-php)[ Docs](https://github.com/ChalomanDev/tonal-php)[ RSS](/packages/chaloman-tonal-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

Tonal PHP
=========

[](#tonal-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e09f8ea0d21dbddd33938c77bde3e4258b53eeacb78cfce16f21f5c9d96b0ef9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6368616c6f6d616e2f746f6e616c2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chaloman/tonal-php)[![Total Downloads](https://camo.githubusercontent.com/6017a2a5816fdd1f96455a00d720d9f98b6e4a6bc046ae7e14a9c8733a5acfb5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6368616c6f6d616e2f746f6e616c2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chaloman/tonal-php)[![License](https://camo.githubusercontent.com/41a2dd009e3da5ee322729249ee0be09960ccb3f468b85384d16e31db942a842/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6368616c6f6d616e2f746f6e616c2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chaloman/tonal-php)

A PHP port of [Tonal.js](https://github.com/tonaljs/tonal) - a music theory library for working with notes, intervals, chords, scales, modes, keys, and more.

Requirements
------------

[](#requirements)

- PHP 8.3 or higher

Installation
------------

[](#installation)

```
composer require chaloman/tonal-php
```

Usage
-----

[](#usage)

### Notes

[](#notes)

```
use Chaloman\Tonal\Note;

// Get note properties
$note = Note::get('C#4');
$note->name;    // "C#4"
$note->pc;      // "C#" (pitch class)
$note->letter;  // "C"
$note->acc;     // "#"
$note->octave;  // 4
$note->midi;    // 61
$note->freq;    // 277.18...

// Transpose notes
Note::transpose('C4', '3M');  // "E4"
Note::transpose('D4', '-2M'); // "C4"

// Get enharmonic equivalents
Note::enharmonic('C#');  // "Db"
Note::enharmonic('Db');  // "C#"

// Simplify notes
Note::simplify('E##'); // "F#"
```

### Intervals

[](#intervals)

```
use Chaloman\Tonal\Interval;

// Get interval properties
$interval = Interval::get('3M');
$interval->name;     // "3M"
$interval->semitones; // 4
$interval->quality;  // "M"
$interval->num;      // 3

// Calculate distance between notes
Interval::distance('C4', 'E4'); // "3M"

// Add intervals
Interval::add('3M', '3m'); // "5P"

// Simplify compound intervals
Interval::simplify('9M'); // "2M"

// Invert intervals
Interval::invert('3M'); // "6m"
```

### Chords

[](#chords)

```
use Chaloman\Tonal\Chord;

// Get chord properties
$chord = Chord::get('Cmaj7');
$chord->name;      // "C major seventh"
$chord->symbol;    // "Cmaj7"
$chord->tonic;     // "C"
$chord->type;      // "major seventh"
$chord->notes;     // ["C", "E", "G", "B"]
$chord->intervals; // ["1P", "3M", "5P", "7M"]

// Get chord notes with octave
Chord::get('Dm7/F')->notes; // ["F", "A", "C", "D"]

// Transpose chords
Chord::transpose('Cmaj7', '5P'); // "Gmaj7"

// Detect chords from notes
use Chaloman\Tonal\ChordDetect;
ChordDetect::detect(['C', 'E', 'G']);     // ["CM", "Em#5/C", ...]
ChordDetect::detect(['D', 'F', 'A', 'C']); // ["Dm7", ...]
```

### Scales

[](#scales)

```
use Chaloman\Tonal\Scale;

// Get scale properties
$scale = Scale::get('C major');
$scale->name;      // "C major"
$scale->tonic;     // "C"
$scale->type;      // "major"
$scale->notes;     // ["C", "D", "E", "F", "G", "A", "B"]
$scale->intervals; // ["1P", "2M", "3M", "4P", "5P", "6M", "7M"]

// Get scale notes
Scale::get('D dorian')->notes; // ["D", "E", "F", "G", "A", "B", "C"]

// Detect scales from notes
Scale::detect(['C', 'D', 'E', 'F', 'G', 'A', 'B']); // ["C major", "C ionian", ...]

// Find chords in a scale
Scale::chords('C major'); // ["C", "Dm", "Em", "F", "G", "Am", "Bdim"]
```

### Keys

[](#keys)

```
use Chaloman\Tonal\Key;

// Major keys
$key = Key::majorKey('C');
$key->tonic;       // "C"
$key->type;        // "major"
$key->scale;       // ["C", "D", "E", "F", "G", "A", "B"]
$key->chords;      // ["C", "Dm", "Em", "F", "G", "Am", "Bdim"]

// Minor keys
$key = Key::minorKey('A');
$key->natural->scale;  // ["A", "B", "C", "D", "E", "F", "G"]
$key->harmonic->scale; // ["A", "B", "C", "D", "E", "F", "G#"]
$key->melodic->scale;  // ["A", "B", "C", "D", "E", "F#", "G#"]
```

### Modes

[](#modes)

```
use Chaloman\Tonal\Mode;

// Get mode properties
$mode = Mode::get('dorian');
$mode->name;      // "dorian"
$mode->intervals; // ["1P", "2M", "3m", "4P", "5P", "6M", "7m"]
$mode->triad;     // "m"
$mode->seventh;   // "m7"

// Get notes of a mode
Mode::notes('dorian', 'D'); // ["D", "E", "F", "G", "A", "B", "C"]

// Get all mode names
Mode::names(); // ["ionian", "dorian", "phrygian", ...]
```

### Progressions

[](#progressions)

```
use Chaloman\Tonal\Progression;

// Convert roman numerals to chords
Progression::fromRomanNumerals('C', ['I', 'IV', 'V', 'I']);
// ["C", "F", "G", "C"]

// Convert chords to roman numerals
Progression::toRomanNumerals('C', ['C', 'Dm', 'G', 'C']);
// ["I", "IIm", "V", "I"]
```

### MIDI

[](#midi)

```
use Chaloman\Tonal\Midi;

// Convert between MIDI and notes
Midi::toMidi('C4');       // 60
Midi::midiToNoteName(60); // "C4"

// Convert between MIDI and frequency
Midi::midiToFreq(69);  // 440.0
Midi::freqToMidi(440); // 69
```

### Roman Numerals

[](#roman-numerals)

```
use Chaloman\Tonal\RomanNumeral;

$rn = RomanNumeral::get('bVII');
$rn->name;     // "bVII"
$rn->roman;    // "VII"
$rn->interval; // "7m"
$rn->acc;      // "b"
$rn->major;    // true
```

Available Modules
-----------------

[](#available-modules)

- **Note** - Note operations (transpose, enharmonic, simplify)
- **Interval** - Interval calculations (add, subtract, invert)
- **Chord** - Chord properties and operations
- **ChordType** - Chord type dictionary
- **ChordDetect** - Chord detection from notes
- **Scale** - Scale properties and operations
- **ScaleType** - Scale type dictionary
- **Key** - Major and minor key information
- **Mode** - Musical modes
- **Pcset** - Pitch class set operations
- **Progression** - Roman numeral progressions
- **RomanNumeral** - Roman numeral analysis
- **Midi** - MIDI utilities
- **Range** - Note range generation
- **Collection** - Array utilities
- **AbcNotation** - ABC notation conversion
- **DurationValue** - Note duration values
- **TimeSignature** - Time signature parsing
- **Voicing** - Chord voicing utilities
- **VoicingDictionary** - Voicing patterns
- **VoiceLeading** - Voice leading algorithms
- **RhythmPattern** - Rhythm pattern generation

Credits
-------

[](#credits)

This library is a PHP port of [Tonal.js](https://github.com/tonaljs/tonal) by [danigb](https://github.com/danigb).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance73

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

156d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fedd2f6c71bce116149b566240008b7d5e5fbcf2f88cd06d5007c44390270d44?d=identicon)[Chaloman](/maintainers/Chaloman)

---

Top Contributors

[![Gonzalo2683](https://avatars.githubusercontent.com/u/1046320?v=4)](https://github.com/Gonzalo2683 "Gonzalo2683 (1 commits)")

---

Tags

notesmusickeysmiditheoryintervalschordsscalesmodestonal

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/chaloman-tonal-php/health.svg)

```
[![Health](https://phpackages.com/badges/chaloman-tonal-php/health.svg)](https://phpackages.com/packages/chaloman-tonal-php)
```

###  Alternatives

[tomatophp/filament-notes

Add Sticky Notes to your FilamentPHP dashboard with tons of options and style

434.4k](/packages/tomatophp-filament-notes)[winter/wn-notes-plugin

Easily add notes to any record in WinterCMS

121.4k](/packages/winter-wn-notes-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
