NAME

Music::Chord::Progression::Transform - Generate transformed chord progressions

VERSION

version 0.0304

SYNOPSIS

use Music::Chord::Progression::Transform ();

my $prog = Music::Chord::Progression::Transform->new;

$prog = Music::Chord::Progression::Transform->new(
  transforms => [qw(L R P T6 R S T-6)],
);

my ($generated, $transforms, $chords) = $prog->generate;

($generated, $transforms, $chords) = $prog->circular;

# midi
use MIDI::Util qw(setup_score);
my $score = setup_score();
$score->n('wn', @$_) for @$generated;
$score->write_score('transform.mid');

DESCRIPTION

The Music::Chord::Progression::Transform module generates transposed and Neo-Riemann chord progressions.

ATTRIBUTES

base_note

$base_note = $prog->base_note;

The initial isobase, capitalized note on which the progression starts (but may be immediately transformed by the first operation).

Default: C (but may be C#, Db, etc.)

base_octave

$base_octave = $prog->base_octave;

The initial note octave on which the progression starts.

Default: 4

chord_quality

$chord_quality = $prog->chord_quality;

The quality or "flavor" of the initial chord.

For Neo-Riemann operations on triads, the quality must be either major ('') or minor ('m'). For seventh chords, use a quality of 7. For transposition operations, anything goes.

Please see the Music::Chord::Note module for a list of the known chords, like m for "minor" or 7 for a seventh chord, etc.

Default: '' (major)

base_chord

$base_chord = $prog->base_chord;

The initial chord given by the base_note, base_octave, and the chord_quality.

This is computed and not a constructor attribute.

format

$format = $prog->format;

The format of the returned results, as either named ISO notes or midinum integers.

Default: midinum

semitones

$semitones = $transpose->semitones;

The number of positive and negative semitones for a transposition transformation. That is, this is a +/- bound on the T transformations.

Default: 7 (a perfect 5th)

max

$max = $prog->max;

The number of circular transformations to make.

Default: 4

allowed

$allowed = $prog->allowed;

The allowed transformations. Currently this is either T for transposition, N for Neo-Riemannian, or both.

Default: T,N

transforms

$transforms = $prog->transforms;

The array-reference of T# transposed and Neo-Riemann transformations that define the chord progression.

The T# transformations are a series of transposition operations, where # is a positive or negative number between +/- semitones.

For Neo-Riemann transformations, please see the Music::NeoRiemannianTonnetz module for the allowed operations.

Additionally the following "non-transformation" operations are included: O returns to the initial chord, and I is the identity that leaves the current chord untouched.

This can also be given as an integer, which defines the number of random transformations to perform.

Default: 4

verbose

$verbose = $prog->verbose;

Show progress.

Default: 0

METHODS

new

$prog = Music::Chord::Progression::Transform->new; # use defaults

$prog = Music::Chord::Progression::Transform->new( # override defaults
  base_note     => 'Bb',
  base_octave   => 5,
  chord_quality => '7b5',
  format        => 'ISO',
  max           => 12,
  allowed       => ['T'],
  transforms    => [qw(O T1 T2 T3)],
);

Create a new Music::Chord::Progression::Transform object.

generate

($generated, $transforms, $chords) = $prog->generate;

Generate a linear series of transformed chords.

circular

($generated, $transforms, $chords) = $prog->circular;

Generate a circular series of transformed chords.

This method defines movement around a circular list ("necklace") of chord transformations. Starting at position zero, move forward or backward along the necklace, transforming the current chord.

SEE ALSO

The t/01-methods.t and eg/* files

Carp

Data::Dumper::Compact

Moo

Music::MelodicDevice::Transposition

Music::NeoRiemannianTonnetz

Music::Chord::Note

Music::Chord::Namer

https://viva.pressbooks.pub/openmusictheory/chapter/neo-riemannian-triadic-progressions/

AUTHOR

Gene Boggs <gene@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2023-2024 by Gene Boggs.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)