View on
Jeremy Mates > Music-Tension > Music::Tension



Annotate this POD

View/Report Bugs
Module Version: 0.70   Source  


Music::Tension - music tension analysis


Beta interface! May change without notice!

  my $t = Music::Tension ();

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

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


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.)


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.


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 execeeded 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).



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


Copyright (C) 2012-2013 by Jeremy Mates

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.16 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: