Music::MelodicDevice::Ornamentation - Chromatic and diatonic melodic ornamentation
version 0.0706
use Music::MelodicDevice::Ornamentation; my $md = Music::MelodicDevice::Ornamentation->new; # chromatic $md = Music::MelodicDevice::Ornamentation->new( # diatonic scale_note => 'C', scale_name => 'major', verbose => 1, ); # With named notes my $spec = $md->grace_note('qn', 'D5', -1); $spec = $md->turn('qn', 'D5', 1); $spec = $md->trill('qn', 'D5', 2, 1); $spec = $md->mordent('qn', 'D5', 1); $spec = $md->slide('qn', 'D5', 'F5'); # With integer pitches $spec = $md->grace_note('qn', 74, -1); $spec = $md->turn('qn', 74, 1); $spec = $md->trill('qn', 74, 2, 1); $spec = $md->mordent('qn', 74, 1); $spec = $md->slide('qn', 74, 77);
Music::MelodicDevice::Ornamentation provides chromatic and diatonic musical melodic ornamentation methods.
Music::MelodicDevice::Ornamentation
Each returns a note-set specification. This specification is a list of two part array-references: a duration and a pitch.
If the pitch is given as an integer, then specs with integers are returned.
Since the point is likely to use MIDI-Perl to render these ornaments, to audio, it is handy to know that named pitches in these specifications can be translated with the MIDI::Util midi_format function:
midi_format
my @spec = ([qw(en C4)], [qw(sn C#4)], [qw(qn D4)], ...); @spec = map { [ MIDI::Util::midi_format(@$_) ] } @spec; $score->n(@$_) for @spec;
Default: C
C
Default: chromatic
chromatic
For the chromatic scale, enharmonic notes are listed as sharps. For a scale with flats, use a diatonic scale_name with a flat scale_note.
Please see "SCALES" in Music::Scales for a list of valid scale names.
Default: 0
0
Show the progress of the methods.
$x = Music::MelodicDevice::Ornamentation->new( scale_note => $scale_note, scale_name => $scale_name, verbose => $verbose, );
Create a new Music::MelodicDevice::Ornamentation object.
$spec = $md->grace_note($duration, $pitch, $offset);
Default offset: 1
1
NB: I believe that "appoggiatura" means emphasis on the grace note, and "acciaccatura" means emphasis on the principle note. This module doesn't accent notes. You'll have to do that bit.
$spec = $md->turn($duration, $pitch, $offset);
The note Above, the Principle note (the pitch), the note Below, followed by the Principle note again.
Above
Principle
Below
For example: D4 C4 B3 C4 (where C4 is the Principle note)
D4 C4 B3 C4
C4
But if the offset is given as -1, the turn is "inverted" and goes: Below, Principle, Above, Principle.
-1
$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.
Default number: 2
2
$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."
An offset of 1 returns an upper mordent one pitch away. An offset of -1 returns a lower mordent.
So if the pitch is D5, a diatonic upper mordent, in say C major, would be D5 E5 D5. A chromatic lower mordent would be D5 C#5 D5.
D5
D5 E5 D5
D5 C#5 D5
$spec = $md->slide($duration, $from, $to);
Return a specification where the notes move (in the chromatic scale) between the from and to pitches, for the given duration.
This ornament is also known as the "glissando."
The t/01-methods.t and eg/* programs in this distribution
Carp
Data::Dumper::Compact
List::SomeUtils
MIDI::Simple
Moo
Music::Duration
Music::Scales
https://en.wikipedia.org/wiki/Ornament_(music)
Gene Boggs <gene@cpan.org>
This software is copyright (c) 2020-2023 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.
To install Music::MelodicDevice::Ornamentation, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Music::MelodicDevice::Ornamentation
CPAN shell
perl -MCPAN -e shell install Music::MelodicDevice::Ornamentation
For more information on module installation, please visit the detailed CPAN module installation guide.