**Prof.Dr.Godfried-Willem RAES**

**<GMT> & Harmony
Library Reference Manual**: Module 3: Fuzzy Harmony Functions

<Index > | <Introduction> | <General Functions> |

<Fuzzy Functions> | <Analysis Functions> | <Acoustical Functions> |

<Visualisation Functions> | <File Management> | <Psychological Functions> |

__Harmony functions and
procedures based on Fuzzy-sets:__

Files: source code now all included in g_mus.dll. Declarations for Power Basic are in g_mus.bi

These functions do not always use the binary shepard chord description. Here the octave position of notes in chords is a parameter in the calculation of the dissonance property. Thus 12,97 is less dissonant then 60,61. Under binary shepard reduction, this would not be the case. The functions and procedures contained herein make use of a data file containing expert data that form the base for the assignment of properties to harmonic and melodic intervals. This data file should never be renamed and should always be present in the same directory as the library and the applications main module.

**Alphabetical list of Subs and functions
in the module HARM_FUZ:**

- FUNCTION Cons% (crd%)
- FUNCTION DisHar! (note1%, note2%)
- FUNCTION DisHar3! (note1%, note2%, note3%)
- FUNCTION Dismel! (note1%, note2%)
- FUNCTION Flue!(note1%, note2%, note3%)
- FUNCTION FuzFrameVar! (Chordnumberarray%(), framesize%)
- SUB GetFuzzyData (FuzInt!())
- SUB GetFuzzyMelo (FuzMel!())
- FUNCTION HarForce (note1%, note2%) AS SINGLE
- FUNCTION HarmFrameQual! (Chordnumberarray%(), framesize%)
- FUNCTION HarmQual! (Chordnumberarray%())
- FUNCTION MelForce (note1%, note2%) AS SINGLE
- FUNCTION MelFrameQual! (MelodyArray%(), framesize%)
- FUNCTION MeloQual! (Melodyarray%())
- FUNCTION MelQualWeight! (Melodyarray%())
- FUNCTION SecSolveQual! (Chordnumber1%, Chordnumber2%)
- FUNCTION TritSolveQual! (Chordnumber1%, Chordnumber2%)

__Users guide for fuzzy procedures and
functions:__

- reads the lookup tables for melody fuzzyfication from a data-file on disk. This data file should be called gmt.ini and contains a section with relevant data. The user is free to change or modify the data for his own purposes. A call to this procedure is required prior to using any function related to melody in this library. In software versions older then V3.7 this data file was called "fuz-har.dat". If there is no data section in your gmt.ini file, the library will use our default.

- reads the lookup tables for harmony fuzzification from the "gmt.ini" data-file on disk. A call to this procedure is required prior to using any function related to harmony in this library. In software versions older then V3.7 the data file used was called "fuz_har.dat". If there is no data section in your gmt.ini file, the library will use our default.

- Function returning a normalized value for the degree of dissonance of an harmonic interval consisting of 2 notes passed as midi values in b1% and b2%. The parameters must be midi note values.

FUNCTION Dishar3! (b1%, b2%, b3%)

- Function returning a normalized value for the degree of dissonance in a 3-note chord. The parameters must be midi note values.

- Function returning a normalized value for the dissonance of a melodic interval. If b1% and b2% are the same, the function returns 0. The result depends on the data in the fuzzy data file.

FUNCTION Flue! (b1%, b2%, b3%)

- Function returning a normalized value for the degree of fluency of a succesion of three notes passed as midi-numbers in b1%,b2%,b3%.

- Function returning a normalized value for the melodic quality of an arbitrary sequence of notes. The sequences should be passed to the function as a one-dimensional array. The returned value is not weighted.

FUNCTION MelQualWeight! (Ml%())

- Function returning a normalized value for the melodic quality of an arbitrary sequence of notes. The sequence should be passed to the function as a one-dimensional array. The returned values is weighted over the complete size of the array.

FUNCTION MelFrameQual! (Ml%(), size%)

- Function returning a normalized value for the melodic quality of an arbitrary sequence of notes. The sequence should be passed to the function as a one-dimensional array. The returned values is weighted over the last number of notes specified in size%. Size% should note be larger than the size of the array passed to the function.

- Function returning a normalized value for the harmonic quality of an arbitrary sequence of chords, given as an array of chordnumbers. The sequence should be passed to the function as a one-dimensional array. The function returns a fuzzy value for the global 'quality' of a harmonic sequence of chords, using shepard formatted chordnumbers. The result is weighted over history. The integration frame depends on the lenght of Ch%. Equal time distribution is assumed. An improved version would also take into account objective timing information in the weighting procedure, requiring the passing of a 2-dimensional array or a typed variable. Functions taking into account the amplitude relationships of individual notes in the chord are provided in the library section Harm_Psy

FUNCTION HarmQualWeight! (Hm%())

- This function functions like HarmQual! but also performs integration over time. The chords passed to it as chordnumbers in the inputarray are assumed to be in order and equally distributed over time. The weighting takes place over the entire array.

FUNCTION HarmFrameQual! (ch%(), size%)

- This function returns a normalised value for a chord sequence passed as a chordnumber array ch%() integrated over and limited in size% Thus the integration will take place only over a number of chords passed in size%. This function is an application of HarmQual! and makes use of its code.

- This function returns 1 for consonants only. It is binary, for allother chords it returns 0. The function thus returns 1 for all consonant triads and duals. Single notes and 0 notes will be returned as consonant as well. The function makes internal use of a series of binary constants. Make sure the constant declaration is in your application program. (d0=1, d1=2, d3=4...)
- This is a very classical function. We use it internally in other code in this library to speed up the calculations in HarmQual! and its derived functions (fuzzy library).
- Only the following 7 chords (on C) can be consonants, if we consider chords containing seconds and/or tritons as dissonant.

I. 0000 1000 1001 classic minor chord [12 rotations]

II. 0001 0000 1001 major chord on Tc% + 8 = rotation nr.9 of III

III. 0000 1001 0001 classic major chord [12 rotations]

IV. 0001 0001 0001 beautiful symmetric chord (5+ major) [ 4 rotations]

V. 0010 0001 0001 minor chord on Tc% - 3 = rotation nr.10 of I

VI. 0001 0010 0001 minor chord on Tc% + 5 = rotation nr. 6 of I

VII. 0010 0010 0001 major chord on Tc% + 5 = rotation nr.6 of III

- after removal of the redundant chords (chords appearing as rotations of another chord) it appears we have enough with only 3 types of triad in twelve-tone harmony. It also follows that no four-note-chord can be a consonant. This brief analysis reveals that we can have a maximum of 12+12+4 =28 consonant triads.

FUNCTION FuzFrameVar! (Hm%(), size%)

This function returns a normalized fuzzy value for the amount of harmonic (chordal) variation in a chord sequence passed to the function as an array of chordnumbers. If all chords are different, the function returns 1. If all chords are the same, it will return 0. The function considers only the last number of chords as specified in the parameter size%. There is no weighting over time in this function.

FUNCTION SecSolveQual! (crd1%, crd2%)

This function returns a vectorized value for the quality of the solution of minor or major seconds contained in crd1% into crd2%. crd1% and crd% constitute the chord sequence passed to it. The harmonic rules are: Minor seconds in crd1% should solve by enlargement to minor thirds in crd2%.Major seconds in crd2% should solve by enlargement to major thirds in crd2% However, this is not a tonal function! It does not make use of tonality context in the value returned.

FUNCTION TritSolveQual! (crd1%, crd2%)

This function returns a normalized value for the quality of the solution for eventual tritons present in the harmonic connection from crd1% into crd2% If no tritons are found in chord crd1% the function returns 1. For perfect solutions the result will be 1 also. The harmonic rules are: Tritons solve by either chromatic enlargement of its intervals, or by chromatic diminution of its intervals. Partial solutions (such as diatonic steps) yield 'imperfect' results.

FUNCTION HarForce (n1%, n2%) AS SINGLE

This function returns a normalized value for the harmonic force of a diad, following the theory of Paul Hindemith as expressed in Ludus Tonalis.

FUNCTION MelForce (n1%, n2%) AS SINGLE

This function returns a normalized value for the melodic force of a note couple, following the theory of Paul Hindemith as expressed in Ludus Tonalis.

Filedate: 970320- last update: 2004-11-02

<Index> | Naar homepage dr.Godfried-Willem RAES | <General Functions> |