NAME

Music::VoicePhrase - Construct a measured phrase of notes

VERSION

version 0.0106

SYNOPSIS

use Music::VoicePhrase ();

my $mvp = Music::VoicePhrase->new;

my $motifs = $mvp->motifs;
my $voices = $mvp->voices;

$mvp->motif_num(6);
$motifs = $mvp->build_motifs;
$voices = $mvp->build_voices;

DESCRIPTION

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

This module is also equipped with a few handy attributes to make real-time processing work. See the linked script in the "SEE ALSO" section.

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

voices

$voices = $mvp->voices;

The pitches given by Music::VoiceGen.

Default: 4 voices

queue

$queue = $mvp->queue;

Computed attribute for the priority queue used in real-time processing.

index

$index = $mvp->index;
$mvp->index($n);

Computed attribute for the queue index that is used in real-time processing.

Default: 0

note

$note = $mvp->note;
$mvp->note($n);

Computed attribute for the currently selected note that is used in real-time processing.

Default: {}

onsets

$onsets = $mvp->onsets;

Computed attribute for the note onsets used in real-time processing.

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 fresh list of motifs based on the .

build_voices

$voices = $mvp->build_voices;

Build a fresh list of voices based on the number of motifs.

increment_index

$i = $mvp->increment_index;

Just add one to the index attribute.

SEE ALSO

Moo

Music::Duration::Partition

Music::Scales

Music::VoiceGen

https://github.com/ology/Music/blob/master/tones-together.pl

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.