1. Go to this page and download the library: Download chaloman/tonal-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
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", ...]
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"]
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