PHPackages                             mrcodefinger/twelvetones - 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. mrcodefinger/twelvetones

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

mrcodefinger/twelvetones
========================

Twelve-tone sequences in random or interval order (chromatic, whole tone, thirds, fifths, fourths).

0.4.0(4d ago)16MITPHPPHP ^8.2CI failing

Since Jun 25Pushed 4d ago1 watchersCompare

[ Source](https://github.com/mrcodefinger/TwelveTones)[ Packagist](https://packagist.org/packages/mrcodefinger/twelvetones)[ RSS](/packages/mrcodefinger-twelvetones/feed)WikiDiscussions master Synced yesterday

READMEChangelog (4)Dependencies (2)Versions (7)Used By (0)

TwelveTones
-----------

[](#twelvetones)

This library displays all twelve tones in random order or along systematic interval sequences (chromatic, whole tone, minor/major third, circle of fifths, circle of fourths).

Requires PHP 8.2 or later.

```
composer install
composer test
php index.php
```

### Usage

[](#usage)

```
use MrCodefinger\TwelveTones\OrderMode;
use MrCodefinger\TwelveTones\Service\RandomValue;
use MrCodefinger\TwelveTones\Service\TwelveTones;

$tones = new TwelveTones([
    'A',
    'B',
    'C',
    'D',
    'E',
    'F',
    'G',
    new RandomValue(['Ab', 'G#']),
    new RandomValue(['Bb', 'A#']),
    new RandomValue(['C#', 'Db']),
    new RandomValue(['D#', 'Eb']),
    new RandomValue(['F#', 'Gb']),
], OrderMode::Random);
```

### Order modes

[](#order-modes)

An optional `$start` note (default `C`) rotates the sequence so it begins on that pitch. Random order ignores `$start`.

ModeExample from C`OrderMode::Random`shuffled, enharmonic spellings random`OrderMode::Chromatic``C C# D D# E F F# G G# A A# B``OrderMode::WholeTone``C D E F# G# A# C# D# F G A B``OrderMode::MinorThird``C Eb Gb A Db E G Bb D F Ab B``OrderMode::MajorThird``C E G# C# F A D F# A# D# G B``OrderMode::Fifths``C G D A E B F# C# G# D# A# F``OrderMode::Fourths``C F Bb Eb Ab Db Gb B E A D G````
$tones = new TwelveTones([...], OrderMode::Fifths);
echo $tones;

$fromEb = new TwelveTones([...], OrderMode::Chromatic, start: 'Eb');

foreach ($tones->getValue() as $tone) {
    echo $tone . ' ';
}
```

Intervals that do not visit all twelve pitch classes in one cycle (whole tone, minor third, major third) concatenate the remaining cycles so every key still appears.

`ShuffleArray` is still available as a deprecated alias for random order.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance99

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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 ~12 days

Total

5

Last Release

4d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8933204?v=4)[Mr. Codefinger](/maintainers/mrcodefinger)[@mrcodefinger](https://github.com/mrcodefinger)

---

Top Contributors

[![mrcodefinger](https://avatars.githubusercontent.com/u/8933204?v=4)](https://github.com/mrcodefinger "mrcodefinger (20 commits)")

---

Tags

hacktoberfest-accepted

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mrcodefinger-twelvetones/health.svg)

```
[![Health](https://phpackages.com/badges/mrcodefinger-twelvetones/health.svg)](https://phpackages.com/packages/mrcodefinger-twelvetones)
```

PHPackages © 2026

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