NAME

Music::MelodicDevice::Ornamentation - Chromatic and diatonic musical ornamentation

VERSION

version 0.0200

SYNOPSIS

use Music::MelodicDevice::Ornamentation;

# Chromatic
my $md = Music::MelodicDevice::Ornamentation->new;
my $spec = $md->grace_note('qn', 'D5', 1); # [[xn D#5], [d90 D5]]
$spec = $md->turn('qn', 'D5', 1);          # [[sn D#5], [sn D5], [sn C#5], [sn D5]]
$spec = $md->trill('qn', 'D5', 2, 1);      # [[sn D#5], [sn D5], [sn D#5], [sn D5]]
$spec = $md->mordent('qn', 'D5', 1);       # [[yn D5], [yn D#5], [den D5]]

# Diatonic
$md = Music::MelodicDevice::Ornamentation->new(scale_name => 'major');
$spec = $md->grace_note('qn', 'D5', 1); # [[xn E5], [d90 D5]]
$spec = $md->turn('qn', 'D5', 1);       # [[sn E5], [sn D5], [sn C5], [sn D5]]
$spec = $md->trill('qn', 'D5', 2, 1);   # [[sn E5], [sn D5], [sn E5], [sn D5]]
$spec = $md->mordent('qn', 'D5', 1);    # [[yn D5], [yn E5], [den D5]]

DESCRIPTION

Music::MelodicDevice::Ornamentation provides chromatic and diatonic musical ornamentation methods.

The duration part of the returned note specifications is actually in MIDI::Simple d### style, even though the SYNOPSIS shows them as MIDI::Simple and Music::Durations abbreviations. This is for conceptual reasons only.

ATTRIBUTES

scale_note

Default: C

scale_name

Default: chromatic

For the chromatic scale, enharmonic notes are listed as sharps. For a scale with flats, a diatonic scale_name must be used with a flat scale_note.

Please see "SCALES" in Music::Scales for a list of valid scale names.

verbose

Default: 0

METHODS

new

$x = Music::MelodicDevice::Ornamentation->new(
  scale_note => $scale_note,
  scale_name => $scale_name,
  verbose => $verbose,
);

Create a new Music::MelodicDevice::Ornamentation object.

grace_note

$spec = $md->grace_note($duration, $pitch, $offset);

"Appoggiatura" means emphasis on the grace note. "Acciaccatura" means emphasis on the main note. This module doesn't accent notes. You'll have to do that bit.

turn

$spec = $md->turn($duration, $pitch, $direction);

The note Above, the Principle note (the pitch), the note Below, the Principle note again.

The default direction is 1, but if given as -1, the turn is "inverted" and goes: Below, Principle, Above, Principle.

trill

$spec = $md->trill($duration, $pitch, $number, $offset);

A trill is a number of pairs of notes spread over a given duration. The first of the pair being the given pitch and the second one given by the offset.

mordent

$spec = $md->mordent($duration, $pitch, $offset);

"A rapid alternation between an indicated note [the pitch], the note above or below, and the indicated note again."

So if the pitch is D5, a diatonic upper mordent would be D5-E5-D5. A chromatic lower mordent would be D5-C#5-D5.

SEE ALSO

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

Carp

Data::Dumper::Compact

List::SomeUtils

MIDI::Simple

Moo

Music::Duration

Music::Note

Music::Scales

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

AUTHOR

Gene Boggs <gene@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 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.