NAME
Music::ModalFunction - Inspect musical modal functions
VERSION
version 0.0315
SYNOPSIS
use Music::ModalFunction ();
# What mode(s) have a Dmaj dominant chord?
my $m = Music::ModalFunction->new(
chord_note => 'd',
chord => 'maj',
key_function => 'dominant',
);
my $results = $m->chord_key;
# [['chord_key','d','maj','g','ionian','dominant','r_V'],
# ['chord_key','d','maj','g','lydian','dominant','r_V']]
# In what mode(s) can a Gmaj chord function as a subdominant pivot chord?
$m = Music::ModalFunction->new(
chord_note => 'g',
chord => 'maj',
mode_note => 'c',
key_function => 'subdominant',
);
$results = $m->pivot_chord_keys;
# [['pivot_chord_keys','g','maj','c','ionian','dominant','d','dorian','subdominant','r_IV'],
# ['pivot_chord_keys','g','maj','c','ionian','dominant','d','ionian','subdominant','r_IV'],
# ['pivot_chord_keys','g','maj','c','ionian','dominant','d','mixolydian','subdominant','r_IV'],
# ['pivot_chord_keys','g','maj','c','lydian','dominant','d','dorian','subdominant','r_IV'],
# ['pivot_chord_keys','g','maj','c','lydian','dominant','d','ionian','subdominant','r_IV'],
# ['pivot_chord_keys','g','maj','c','lydian','dominant','d','mixolydian','subdominant','r_IV']]
DESCRIPTION
Music::ModalFunction
allows querying of a musical database of Prolog facts and rules that bind notes, chords, modes, keys and diatonic functionality. In this database, the facts are all called chord_key
and the rules are pivot_chord_keys
and roman_key
.
To bind a value to a fact or rule argument, declare it in the object constructor. Unbound arguments will return all the possible values that make the query true.
The essential question is, "Can a chord in one key function in a second?" Any parts of this open-ended question may be unbound, thereby resulting in all possible truths.
ATTRIBUTES
chord_note
c
, df
, d
, ef
, e
, f
, gf
, g
, af
, a
, bf
, or b
* Sharps are not used - only flats.
chord
maj
, min
, or dim
mode_note
c
, df
, d
, ef
, e
, f
, gf
, g
, af
, a
, bf
, or b
mode
ionian
, dorian
, phrygian
, lydian
, mixolydian
, aeolian
, or locrian
mode_function
tonic
, supertonic
, mediant
, subdominant
, dominant
, submediant
, leading_tone
, or subtonic
mode_roman
r_I
, r_ii
, r_iii
, r_IV
, r_V
, r_vi
, or r_vii
key_note
c
, df
, d
, ef
, e
, f
, gf
, g
, af
, a
, bf
, or b
key
ionian
, dorian
, phrygian
, lydian
, mixolydian
, aeolian
, or locrian
key_function
tonic
, supertonic
, mediant
, subdominant
, dominant
, submediant
, leading_tone
, or subtonic
key_roman
r_I
, r_ii
, r_iii
, r_IV
, r_V
, r_vi
, or r_vii
verbose
Default: 0
METHODS
new
$m = Music::ModalFunction->new(%args);
Create a new Music::ModalFunction
object.
chord_key
$results = $m->chord_key;
Ask the database a question about what chords are in what keys.
Constructor arguments:
chord_note, chord, key_note, key, key_function, key_roman
Here, chord_note and chord together are the named chord defined within the context of the key_note and key. The chord's function in the key is the key_function and basically indicates the relative scale position. The key_roman argument serves as an indicator of both the chord quality and the position in the scale.
If defined, argument values will be bound to a variable. Otherwise an unbound variable is used.
pivot_chord_keys
$results = $m->pivot_chord_keys;
Ask the database a question about what chords share common keys.
Constructor arguments:
chord_note, chord, mode_note, mode, mode_function, mode_roman, key_note, key, key_function, key_roman
Here, chord_note and chord together are the named chord defined within the context of the mode_note and mode. The chord's function in the mode is the mode_function and basically indicates the relative scale position. The mode_roman argument serves as an indicator of both the chord quality and the position in the scale. The key_note and key are the final "destination" of the query transformation (often a pivot). The function of the chord in the "destination" is key_function. As with mode_roman, key_roman is the resulting chord quality and scale position.
If defined, argument values will be bound to a variable. Otherwise an unbound variable is used.
roman_key
$results = $m->roman_key;
Ask the database a question about what Roman numeral functional chords share common keys.
Constructor arguments:
mode, mode_roman, key, key_roman
If defined, argument values will be bound to a variable. Otherwise an unbound variable is used.
SEE ALSO
The t/01-methods.t and eg/* files in this distribution
https://en.wikipedia.org/wiki/Prolog
https://en.wikipedia.org/wiki/Common_chord_(music)
https://ology.github.io/2023/06/05/querying-a-music-theory-database/ is the write-up about using this module
AUTHOR
Gene Boggs <gene@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2023 by Gene Boggs.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)