NAME
Music::Intervals - Breakdown of musical intervals
VERSION
version 0.0905
SYNOPSIS
use
Music::Intervals;
my
$m
= Music::Intervals->new(
notes
=> [
qw/C Eb G B/
]);
# Then any of:
Dumper(
$m
->natural_frequencies,
$m
->natural_intervals,
$m
->natural_cents,
$m
->natural_prime_factors,
$m
->eq_tempered_frequencies,
$m
->eq_tempered_intervals,
$m
->eq_tempered_cents,
$m
->integer_notation,
);
# Find known intervals
my
$name
=
$m
->by_ratio(
'6/5'
);
my
$ratio
=
$m
->by_name(
'Eb'
);
my
$intervals
=
$m
->by_description(
'pythagorean'
);
perl -MMusic::Intervals::Ratios -E
'say $Music::Intervals::Ratios::ratio->{C}{name}'
# unison, perfect prime, tonic
# Show all the 400+ known intervals:
perl -MData::Dumper -MMusic::Intervals::Ratios -e
'print Dumper $Music::Intervals::Ratios::ratio'
DESCRIPTION
A Music::Intervals
object shows the breakdown of musical notes and intervals. (See Music::Intervals::Numeric to use integer ratios instead of named notes.)
This module reveals the "guts" within a given tonality. And by guts I mean, the measurements of the notes and the intervals between them.
For Western notes and intervals, this tonality begins with the C
note. That is, all intervals are calculated from C
. So, if you want to analyze a minor chord, either make it start on C
(like [C Eb G]
) or somewhere between C
and B
(like [D F A]
).
ATTRIBUTES
notes
The actual notes to use in the computation.
Default: [ C E G ]
The list of notes may be any of the keys in the Music::Intervals::Ratios ratio
hashref. This is very very long and contains useful intervals such as those of the common scale and even the Pythagorean intervals, too.
A few examples:
[
qw( C E G )
]
[
qw( C D D# )
]
[
qw( C D Eb )
]
[
qw( C D D# Eb E E# Fb F )
]
[
qw( C 11h 7h )
]
[
qw( C pM3 pM7 )
]
For natural_intervals this last example produces the following:
{
'C pM3'
=> {
'81/64'
=>
'Pythagorean major third'
},
'C pM7'
=> {
'243/128'
=>
'Pythagorean major seventh'
},
'pM3 pM7'
=> {
'3/2'
=>
'perfect fifth'
}
}
Note that case matters for interval names. For example, "M" means major and "m" means minor.
METHODS
new
$x
= Music::Intervals->new(
%arguments
);
Create a new Music::Intervals
object.
integer_notation
Math! See source...
eq_tempered_cents
The Equal tempered cents.
eq_tempered_frequencies
The Equal tempered frequencies.
eq_tempered_intervals
The Equal tempered intervals.
natural_cents
Just intonation cents.
natural_frequencies
Just intonation frequencies.
natural_intervals
Just intonation intervals.
natural_prime_factors
Just intonation prime factors.
dyads
Return pairs of the given notes with fractional and pitch ratio parts.
ratio_factorize
Return the dyadic fraction as a prime factored expression.
by_name
$ratio
=
$m
->by_name(
'C'
);
# { ratio => '1/1', name => 'unison, perfect prime, tonic' }
Return a known ratio or undef.
by_ratio
$name
=
$m
->by_ratio(
'1/1'
);
# { 'symbol' => 'C', 'name' => 'unison, perfect prime, tonic' }
Return a known ratio name or undef.
by_description
$intervals
=
$m
->by_description(
'pythagorean'
);
Search the description of every ratio for the given string.
SEE ALSO
The t/* tests and eg/* examples in this distribution
For the time being, you will need to look at the source of Music::Intervals::Ratios for the note and interval names.
Music::Intervals::Numeric for numeric-only note-intervals
https://en.wikipedia.org/wiki/Interval_(music)#Main_intervals
https://en.wikipedia.org/wiki/List_of_pitch_intervals
http://en.wikipedia.org/wiki/Equal_temperament
http://en.wikipedia.org/wiki/Just_intonation
DEPENDENCIES
AUTHOR
Gene Boggs <gene@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2022 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.