Skip to content

Instantly share code, notes, and snippets.

@belfie13
Created April 7, 2020 19:59
Show Gist options
  • Save belfie13/1077ea4259f2359825a9bd312a6ba862 to your computer and use it in GitHub Desktop.
Save belfie13/1077ea4259f2359825a9bd312a6ba862 to your computer and use it in GitHub Desktop.
B13 GuitMuso
<?php
// Frequency hertz()
// PitchClass::A::B::C::D::E::F::G
// Accidental::NATURAL::SHARP::FLAT
// Octave number()
// Note pitchClass() accidental() octave()
# note is defined by frequency(Hz) but can translate into pitchClass/accidental/octave
# mode is made up of intervals
# scale is a mode starting from a tonic, or set of notes with key
# chord is a key with a set of notes, pitch classes, or intervals
interface Frequency
{
public function hertz():float;
public static function createNote(Note $note):Frequency;
public static function create(float $frequency = 440.0):Frequency;
public static function createComponents(string $pitchClass, string $accidental, int $octave):Frequency;
}
interface PitchClass
{
const A = 'A';
const B = 'B';
const C = 'C';
const D = 'D';
const E = 'E';
const F = 'F';
const G = 'G';
}
interface Accidental
{
const NATURAL = '';
const SHARP = '#';
const FLAT = 'b';
}
interface Octave
{
public function number():int;
}
interface Beat {
public function duration():int;
}
interface Note
{
public function pitchClass():PitchClass;
public function accidental():?Accidental;
public function octave():?Octave;
}
interface Interval {}
interface IntervalSet {}
interface NoteSet {}
interface Tonic extends Note {}
interface Chord {}
interface Scale {} // tonic, pitchClassSet
interface Mode {} // intervalSet
// --->>> Instrument Definition <<<--- //
interface String {}
interface Medium {}
interface Guitar extends Medium {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment