Overview

Packages

  • DSG
    • cli
    • web

Classes

  • Chord
  • DSG

Functions

  • array_addtoset
  • array_removefromset
  • array_subset
  • Overview
  • Package
  • Class
  • Tree

Class Chord

Class to represent a chord

Package: DSG
Located at includes/Chord.class.php
Methods summary
public
# __construct( string|array $chord )

The parameter $chord can be a string of note names, an array of integers representing pitches (middle c = 60) or an associative array containing a chord analysis (same format as returned by the getChordAnalysis() method)

The parameter $chord can be a string of note names, an array of integers representing pitches (middle c = 60) or an associative array containing a chord analysis (same format as returned by the getChordAnalysis() method)

Parameters

$chord
string|array
$chord
public array
# getChordAnalysis( )

Returns an array containing the chord analysis

Returns an array containing the chord analysis

Returns

array
public string
# toString( )

Returns the chord as a string of note names separated by dashes

Returns the chord as a string of note names separated by dashes

Returns

string
public integer
# getDissonance( )

The dsg ("dissonance grading") is twice the dissonance total of the chord divided by the number of component notes

The dsg ("dissonance grading") is twice the dissonance total of the chord divided by the number of component notes

Returns

integer
the dissonance grading of the chord
public mixed
# getTotal( )

The chord's dissonance total is a number such that if you subtract from it the contribution of any of the chord's component notes (octaves make for exceptions here, sorry), you get the total of another chord that is just like this one except for the absence of that component note

The chord's dissonance total is a number such that if you subtract from it the contribution of any of the chord's component notes (octaves make for exceptions here, sorry), you get the total of another chord that is just like this one except for the absence of that component note

Returns

mixed
the dissonance total of the chord
public array
# getPitchSet( )

Returns a representation of the chord as an array of pitches (integers). Middle c = 60

Returns a representation of the chord as an array of pitches (integers). Middle c = 60

Returns

array
array (set) of integers representing pitches
public string
# getMIDItext( )

Returns a textual represention of a MIDI file for the current chord

Returns a textual represention of a MIDI file for the current chord

Creates a MF2T/T2MF MIDI format text string for the current chord, to be converted by Valentin Schmidts Midi Class 1.6 into a binary MIDI file

Returns

string
MF2T/T2MF format text string
public string
# getTextualAnalysis( )

Returns a human readable string representation of the analysis of the current chord, in the same format as that used by the original Pascal implementation

Returns a human readable string representation of the analysis of the current chord, in the same format as that used by the original Pascal implementation

Returns

string
human-readable analysis
public integer
# findPMaxContrib( array $exceptpitchset = array() )

Looks for the most dissonant tone in the chord

Looks for the most dissonant tone in the chord

Parameters

$exceptpitchset
array
$exceptpitchset array of pitches to be ignored (if any)

Returns

integer
the most dissonant tone
public integer
# findPMinContrib( array $exceptpitchset = array() )

Looks for the least dissonant tone in the chord

Looks for the least dissonant tone in the chord

Parameters

$exceptpitchset
array
$exceptpitchset array of pitches to be ignored (if any)

Returns

integer
the least dissonant tone
public integer
# findPMaxDiff( Chord $chord )

Returns the tone from the intersection of two chords which differs most in dissonance value in the two chords

Returns the tone from the intersection of two chords which differs most in dissonance value in the two chords

Parameters

$chord
Chord
$chord

Returns

integer
tone which differs most in dissonance value in the two chords
public array
# moveToneFourPossibleWays( integer $tone )

Changes a chord four different ways, by performing four possible second steps of a given tone

Changes a chord four different ways, by performing four possible second steps of a given tone

Parameters

$tone
integer
$tone tone to be moved

Returns

array
array containing four different variants of the chord
public static integer
# sortByDSG( Chord $a, Chord $b )

To allow sorting of an array of chords by DSG

To allow sorting of an array of chords by DSG

Parameters

$a
Chord
$a
$b
Chord
$b

Returns

integer
DSG API documentation generated by ApiGen 2.8.0