NAME

Music::ModalFunction - Inspect Musical Modal Functions

VERSION

version 0.0102

SYNOPSIS

use Music::ModalFunction ();

# What modes have a Dmaj dominant chord?
my $m = Music::ModalFunction->new(
  chord_note   => 'd',
  chord        => 'maj',
  key_function => 'dominant',
);
my $q = $m->chord_key;
# [[ 'chord_key', 'g', 'ionian', 'd', 'maj', 'dominant' ],
#  [ 'chord_key', 'g', 'lydian', 'd', 'maj', 'dominant' ]]

# In what modes 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',
);
$q = $m->pivot_chord_keys;
# [[ 'pivot_chord_keys', 'g', 'maj', 'c', 'ionian', 'dominant', 'd', 'dorian', 'subdominant' ],
#  [ 'pivot_chord_keys', 'g', 'maj', 'c', 'ionian', 'dominant', 'd', 'ionian', 'subdominant' ],
#  [ 'pivot_chord_keys', 'g', 'maj', 'c', 'ionian', 'dominant', 'd', 'mixolydian', 'subdominant' ],
#  [ 'pivot_chord_keys', 'g', 'maj', 'c', 'lydian', 'dominant', 'd', 'dorian', 'subdominant' ],
#  [ 'pivot_chord_keys', 'g', 'maj', 'c', 'lydian', 'dominant', 'd', 'ionian', 'subdominant' ],
#  [ 'pivot_chord_keys', 'g', 'maj', 'c', 'lydian', 'dominant', 'd', 'mixolydian', 'subdominant' ]]

DESCRIPTION

Music::ModalFunction allows querying of a musical database of Prolog facts and rules that bind notes, chords, modes, keys and diatonic functionality.

* Currently there is a database of facts called chord_key/5 and one rule named pivot_chord_keys/8.

ATTRIBUTES

chord_note

chord

mode_note

mode

mode_function

key_note

key

key_function

verbose

METHODS

new

$m = Music::ModalFunction->new(%args);

Create a new Music::ModalFunction object.

chord_key

$q = $m->chord_key;

Ask the database a question about what chords are in what keys.

Arguments:

chord_key(ModeNote, Mode, ChordNote, Chord, KeyFunction)

If defined, the argument in that position will be bound to that value (e.g. '_' even). Otherwise an unbound variable is used.

pivot_chord_keys

$q = $m->pivot_chord_keys;

Ask the database a question about what chords share common keys.

Arguments:

pivot_chord_keys(ChordNote, Chord, ModeNote, Mode, ModeFunction, KeyNote, Key, KeyFunction)

If defined, the argument in that position will be bound to that value (e.g. '_' even). Otherwise an unbound variable is used.

SEE ALSO

The t/01-methods.t file in this distribution

Moo

AI::Prolog

MIDI::Util

Music::Note

Music::Scales

https://en.wikipedia.org/wiki/Prolog

https://en.wikipedia.org/wiki/Common_chord_(music)

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)