NAME

Music::VoicePhrase - Construct a measured phrase of notes

VERSION

version 0.0104

SYNOPSIS

use Music::VoicePhrase ();
my $mvp = Music::VoicePhrase->new;

# TODO add handy examples! But until then:
# > perl -Ilib -MData::Dumper::Compact=ddc -MMusic::VoicePhrase -E'$x=Music::VoicePhrase->new; say ddc $x'
# bless( {
#   base => 'C',
#   groups => [ 0, 0, 0 ],
#   intervals => [ -3, -2, -1, 1, 2, 3 ],
#   motif_num => 4,
#   octave => 0,
#   pool => [ 'dhn', 'hn', 'qn' ],
#   scale => 'major',
#   size => 4,
#   verbose => 0,
#   weights => [ 1, 2, 2 ],
# }, "Music::VoicePhrase" )

DESCRIPTION

A Music::VoicePhrase constructs a measured phrase of voices with both pitch and rhythmic value.

ATTRIBUTES

base

$base = $mvp->base;

Base scale note.

Default: C

scale

$scale = $mvp->scale;

Scale name known to the Music::Scales module.

Default: major

octave

$octave = $mvp->octave;

Octave integer from 0 to 9.

Default: 0

pitches

$pitches = $mvp->pitches;

Scale name known to the Music::Scales module.

Default: 2 consecutive octaves given the base note, scale name, and starting octave.

intervals

$intervals = $mvp->intervals;

Intervals that define the Music::VoiceGen selection.

Default: [-3, -2, -1, 1, 2, 3]

size

$size = $mvp->size;

Size of a measure.

Default: 4

pool

$pool = $mvp->pool;

The pool of note durations, given in Perl MIDI abbreviated notation, that define the Music::Duration::Partition phrase.

Default: ['dhn', 'hn', 'qn']

weights

$weights = $mvp->weights;

Weights that define the Music::Duration::Partition phrase.

Default: [ 1, 2, 2 ]

groups

$groups = $mvp->groups;

Groups that define the Music::Duration::Partition phrase.

Default: [ 0, 0, 0 ]

motif_num

$motif_num = $mvp->motif_num;

The number of motifs to generate by the build_motifs() method.

Default: 4

motifs

$motifs = $mvp->motifs;

The rhythmic motifs given by Music::Duration::Partition.

Default: 4 motifs

verbose

$verbose = $mvp->verbose;

Show progress.

Default: 0

METHODS

new

$mvp = Music::VoicePhrase->new(%arguments);

Create a new Music::VoicePhrase object.

build_motifs

$motifs = $mvp->build_motifs;

Build a list of motifs given the motif_num.

SEE ALSO

Moo

Music::Duration::Partition

Music::Scales

Music::VoiceGen

AUTHOR

Gene Boggs <gene.boggs@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Gene Boggs.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.