NAME

Music::Intervals - Mathematical breakdown of musical intervals

version 0.0507

SYNOPSIS

use Music::Intervals;

my \$m = Music::Intervals->new(
notes    => [qw/C E G B/], # Default: C major scale
size     => 3,             # Must be <= the notes
chords   => 1,             # Required for chord names
justin   => 1,             # Required for natural_*
equalt   => 1,             # Required for eq_tempered_*
freqs    => 1,             # Required for *_frequencies
interval => 1,             # Required for *_intervals
cents    => 1,             # Required for *_cents
prime    => 1,             # Required for prime factors
integer  => 1,             # Required for integer notation
);

\$m->process;

# Then
print Dumper # any of:
\$m->chord_names,
\$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
\$name  = \$m->by_ratio(\$ratio);
\$ratio = \$m->by_name(\$interval_name);

# Show all the known intervals:
perl -MData::Dumper -MMusic::Intervals::Ratios -e'print Dumper \$Music::Intervals::Ratios::ratio'

DESCRIPTION

A Music::Intervals object shows the mathematical break-down of musical notes, intervals and chords.

This module reveals the "guts" within a given tonality. And by guts I mean, the measurements of the notes and the intervals between them.

ATTRIBUTES

chords

Show chord names.

Default: 0

rootless

Show chord names with no root.

Default: 0

equalt

Show equal temperament.

Default: 0

justin

Show just intonation.

Default: 0

integer

Show integer notation.

Default: 0

cents

Show the logarithmic units of measure.

Default: 0

freqs

Show frequencies.

Default: 0

interval

Show note intervals.

Default: 0

prime

Show prime factorization.

Default: 0

octave

The octave to use.

Default: 4

Concert pitch.

Default: 440

Chord size

Default: 3

tonic

The root of the computations.

Default: C

* Currently (and for the foreseeable future) this will remain the only value that produces sane results.

semitones

Number of notes in the scale.

Default: 12

temper

Physical distance between notes.

Default: semitones * 100 / log(2)

The actual notes to use in the computation.

Default: [ C D E F G A B ]

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 pM7' => {
'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.

Default: 69

Computed hashref

Computed hashref

Computed hashref

Computed hashref

Computed hashref

Computed hashref

Computed hashref

Computed hashref

Computed hashref

METHODS

new()

\$x = Music::Intervals->new(%arguments);

Create a new Music::Intervals object.

process()

Do the actual computations!

Return pairs of the given combinations 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.

The t/ tests and eg/ example 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://github.com/ology/Music/blob/master/intervals - The predecessor to this module

http://en.wikipedia.org/wiki/List_of_musical_intervals

http://en.wikipedia.org/wiki/Equal_temperament

http://en.wikipedia.org/wiki/Just_intonation

AUTHOR

Gene Boggs <gene@cpan.org>