The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

VERSION

version 0.0107

SYNOPSIS

  use MIDI::Util qw(setup_score midi_format);
  use Music::Chord::Progression::Transform ();

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

  my $chords = $prog->generate;
  $chords = $prog->circular;

  # render a midi file
  my $score = setup_score();
  $score->n('wn', midi_format(@$_)) for @$chords;
  $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.

Default: C

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.

format

  $format = $prog->format;

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

Default: ISO

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 "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 => '7',
    format        => 'midinum',
    max           => 12,
    allowed       => ['T'],
    transforms    => [qw(O T1 T2 T3)],
  );

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

generate

  $chords = $prog->generate;

Generate a linear series of transformed chords.

circular

  $chords = $prog->circular;

Generate a series of transformed chords based on a circular list of transformations.

This method defines movement over a circular list ("necklace") of chord transformations, including O, which means "return to the original chord", and I which means to "make no transformation." 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 by Gene Boggs.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)