PHP code example of jakub-the-developer / musical-scales

1. Go to this page and download the library: Download jakub-the-developer/musical-scales 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/ */

    

jakub-the-developer / musical-scales example snippets


use JakubTheDeveloper\MusicalScales\MusicalScales;

$musicalScales = MusicalScales::getInstance();

$musicalScales->findScales("Bebop");
// Result:
// [
//     "Chromatic Bebop",
//     "Dominant Bebop",
//     "Half-Diminished Bebop",
//     "Major Bebop",
//     "Major Bebop Heptatonic Mela Mararanjani (India)",
//     "Major Bebop Hexatonic",
//     "Minor Bebop (As Minor Bebop 11/891011/3 in 12edo)",
//     "Minor Bebop (all b’s) 11/2891011/3 in 12edo)",
//     "Minor Bebop (as 7/0/4 in 12 edo)",
//     "Minor Bebop Heptatonic (as 7/3/4 in 12edo)"
// ]

use JakubTheDeveloper\MusicalScales\MusicalScales;

$musicalScales = MusicalScales::getInstance();

$musicalScales->getNotes("Chromatic Bebop", "E");
// Result: ['E', 'F', 'F#', 'G#', 'A', 'B', 'C#', 'D', 'D#'] 

$musicalScales->getNotes("Dominant Pentatonic", "C"); 
// Result: ['C', 'D', 'E', 'G', 'A#']

$musicalScales->getNotes("Lydian Diminished", "A#"); 
// Result: ['A#', 'C', 'C#', 'E', 'F', 'G', 'A']

use JakubTheDeveloper\MusicalScales\MusicalScales;

$musicalScales = MusicalScales::getInstance();

$musicalScales->getNotes('Ionian, Major', 'G');
// Result: ['G', 'A', 'B', 'C', 'D' ,'E', 'F#']

$musicalScales->useHInsteadOfB();
$musicalScales->getNotes('Ionian, Major', 'G');
// Result: ['G', 'A', 'H', 'C', 'D' ,'E', 'F#']

$musicalScales->useHInsteadOfB(false);
$musicalScales->getNotes('Ionian, Major', 'G');
// Result: ['G', 'A', 'B', 'C', 'D' ,'E', 'F#']