The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Music::Tension - music tension analysis

SYNOPSIS

  my $t = Music::Tension ();
  $t->pitch2freq(60);
  $t->freq2pitch(440);


  my $ct = Music::Tension::Cope ();
  $ct->... # see that module for details

  my $plt = Music::Tension::PlompLevelt ();
  $plt->... # see that module for details

DESCRIPTION

Music tension (dissonance) analysis. This module merely provides pitch and frequency conversion routines. The other modules under this distribution provide various algorithms that produce a number for how consonant or dissonant a chord or other musical events are, presumably for use in musical analysis or composition.

The numbers produced by one module can only be used in comparison with other musical events calculated by the same module; no attempt has been made to correlate the output of any overlapping methods between the different modules. (Though comparisons may be interesting.)

SUB-MODULES

If you have ideas for a new tension analysis module, please let me know, so it can be included in this distribution, or locate it outside of the Music::Tension::* space.

  • Music::Tension::Cope - methods outlined in "Computer Models of Musical Creativity" by David Cope, including routines for specific pitches, verticals (chords), metric position, and other factors.

  • Music::Tension::PlompLevelt - Plomp-Levelt consonance curve calculations based on writings and code by William Sethares, among others. For frequencies (and pitches) in vertical relationships.

METHODS

Any method may croak if something is awry with the input. These methods are inherited by the sub-modules.

new optional params

Constructor. Accepts an optional parameter to change the reference frequency use by the frequency/pitch conversion calls (440 by default).

  my $t = Music::Tension->new(reference_frequency => 442);
freq2pitch frequency

Given a frequency (Hz), returns the integer pitch number (which might also be a MIDI number, unless that range is exceeded somehow). Fractional pitch results are rounded to the nearest pitch number. (I'm not sure if the standard practice is to round or truncate the conversion, so I guessed to round.)

pitch2freq pitch

Given a pitch number (a positive integer, perhaps from the MIDI numbers range), returns the frequency (Hz).

SEE ALSO

AUTHOR

thrig - Jeremy Mates (cpan:JMATES) <jmates at cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2012,2017,2018 by Jeremy Mates

https://opensource.org/licenses/BSD-3-Clause