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

NAME

Music::Harmonics - Calculate harmonics for stringed instruments

VERSION

Version 0.01

SYNOPSIS

  use Music::Harmonics;
  
  my $h = Music::Harmonics->new();
  foreach (2..5) {
      my %harm = $h->GetStringHarmonic(name => 'E2', harmonic => $_);
      printf("Grab fret %i to play the harmonic #%i. It'll be a %s.\n",
          $harm{frets}->[0], $_, uc $harm{name});
  }    

DESCRIPTION

This module calculates the note names and positions of harmonics and overtones. So far, it is limited to stringed instruments.

Note that the first harmonic is the foundational pitch, the second harmonic is the first overtone, and so on.

The pitch names used in this module are the sames as used by MIDI::Pitch.

CONSTRUCTOR

new

  my $h = Music::Harmonics->new(frets_per_octave => 12);

Creates a new Music::Harmonics object. The frets_per_octave parameter is optional and defaults to 12.

FUNCTIONS

GetFret

    my $f = $h->GetFret($position);

Given a position on the fingerboard between 0 and 1 (0 being directly at the nut, 1 being at the other end of the string at the bridge), returns the fret number as a float (assuming even intonation). For example, 0.5 refers to the middle of the string, so that GetFret(0.5) on an instrument with 12 frets per octave returns 12.

GetStringHarmonic

    %harm = $h->GetStringHarmonic(name => 'E2', harmonic => 2,
        minfret => 0, maxfret => 12);

Returns the positions where a certain harmonic can be played. minfret and maxfret are optional, their default values are 0 and 12 respectively.

The result is a hash. name gives the name of the harmonic, frequency the frequency and frets is a list of fret positions.

GetStringHarmonics

    $h->GetStringHarmonics(name => 'E2', minharmonic => 2, maxharmonic => 6);

Retrieves a list of harmonics from minharmonic to maxharmonic.

SEE ALSO

MIDI::Pitch

AUTHOR

Christian Renz, <crenz @ web42.com>

BUGS

Please report any bugs or feature requests to bug-music-harmonics@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Music-Harmonics. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT AND LICENSE

Copyright 2005 Christian Renz <crenz @ web42.com>, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.