NAME
Music::Tension::PlompLevelt - Plomp-Levelt consonance curve calculations
SYNOPSIS
Beta interface! Will likely change without notice!
use Music::Tension::PlompLevelt;
my $tension = Music::Tension::PlompLevelt->new;
$tension->frequences(440, 880);
$tension->pitches(69, 81);
$tension->vertical([qw/60 64 67/]);
DESCRIPTION
Plomp-Levelt consonance curve calculations based on work by William Sethares and others ("SEE ALSO" for links).
Parsing music into a form suitable for use by this module and practical uses of the results are left as an exercise to the reader.
TERMINIOLOGY
The calculations use the harmonics--the fundamental plus some number of overtones above that--the first six by default. Finding details on the harmonics for a particular instrument may require consulting a book, or performing spectral analysis on recordings of a particular instrument (e.g. via Audacity), or fiddling around with a synthesizer, and likely making simplifying assumptions on what gets fed into this module.
| Harmonics ...
|-----------------------------------
| Fundamental | Overtones
| c | c' g' c'' e'' ...
The critical band is considered to be about a minor 3rd, or about 6/5 of the frequency, though this expands to perhaps a major 3rd for lower frequencies. (Hence composers favoring larger, more consonant intervals in the bass?) Maximum dissonance is found at a location studied by Plomp, Levelt, and others.
CAVEATS
Other music writers indicate that the partials should be ignored, for example Harry Partch: "Long experience... convinces me that it is preferable to ignore partials as a source of musical materials. The ear is not impressed by partials as such. The faculty--the prime faculty--of the ear is the perception of small-numbered intervals, 2/1, 3/2, 4/3, etc. and the ear cares not a whit whether these intervals are in or out of the overtone series." (Genesis of a Music, 1947). (However, note that this declamation predates the work by Sethares and others.)
On the plus side, this method does rate an augmented triad as more dissonant than a diminished triad (though that test was with distortions from equal temperament), which agrees with a study mentioned over in Music::Tension::Cope that the Cope method finds the opposite of.
See also "Harmony Perception: Harmoniousness is more than the sum of interval consonance" by Norman Cook (2009) though that method should probably be in a different module than this one.
METHODS
Any method may croak if something is awry with the input. Methods are inherited from the parent class, Music::Tension. Unlike Music::Tension::Cope, this module is very sensitive to the register of the pitches involved, so input pitches should ideally be from the MIDI note numbers and in the proper register. Or instead use frequencies via methods that accept those (especially to avoid the distortions of equal temperament tuning).
The tension number depends heavily on the equation (and constants to said equation), and should not be considered comparable to any other tension modules in this distribution, and only to other tension values from this module if the same harmonics were used in all calculations. Also, the tension numbers could very easily change between releases of this module.
- new optional params
-
Constructor. Accepts various optional parameters.
my $tension = Music::Tension::PlompLevelt->new( amplitudes => { made_up_numbers => [ 42, 42, ... ], ... }, default_amp_profile => 'made_up_numbers', normalize_amps => 1, reference_frequency => 442, );
amplitudes specifies a hash reference that should contain named amplitude sets and an array reference of amplitude values for each harmonic.
default_amp_profile what amplitude profile to use by default.
normalize_amps if true, normalizes the amplitude values such that they sum up to one.
reference_frequency sets the MIDI reference frequency, by default 440 (Hz). Used by pitch2freq conversion called by the pitches and vertical methods.
- frequencies freq_or_ref1, freq_or_ref2
-
Method that accepts two frequencies, or two array references containing the harmonics and amplitudes of such. Returns tension as a number.
# default harmonics will be filled in $tension->frequencies(440, 880); # custom harmonics $tension->frequencies( [ {amp=>1, freq=>440}, {amp=>0.5, freq=>880}, ... ], [ {amp=>0.88, freq=>880}, ... ], ... );
The harmonics need not be the same number, nor use the same frequencies nor amplitudes. This in theory allows comparison of instruments with different harmonic profiles.
- pitches pitch1, pitch2
-
Accepts two integers (ideally MIDI note numbers) and converts those to frequencies via pitch2freq (which does the MIDI number to frequency conversion equation) and then calls frequencies with those values. Use frequencies with the proper Hz if a non-equal temperament tuning is involved. Returns tension as a number.
- vertical pitch_set
-
Given a pitch set (an array reference of integer pitch numbers that are ideally MIDI numbers), converts those pitches to frequencies via pitch2freq, then calls frequencies for the first pitch compared in turn with each subsequent in the set. Returns tension as a number.
SEE ALSO
http://jjensen.org/DissonanceCurve.html - Java applet, discussion.
http://sethares.engr.wisc.edu/consemi.html - "Relating Tuning and Timbre" by William Sethares. Also http://sethares.engr.wisc.edu/comprog.html
"Music: A Mathematical Offering", David Benson, 2008. (Chapter 4) http://homepages.abdn.ac.uk/mth192/pages/html/maths-music.html
Music::Chord::Note - obtain pitch sets for common chord names.
Music::Tension::Cope - alternative tension algorithm based on work of David Cope.
R. Plomp and W. J. M. Levelt, Tonal consonance and critical bandwidth, J. Acoust. Soc. Amer. 38 (4) (1965), 548-560.
AUTHOR
Jeremy Mates, <jmates@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2012 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.