++ed by:

1 non-PAUSE user.

Ben Daglish

NAME

 Note - representation of a single musical note, and various manipulation routines

SYNOPSIS

    use Music::Note;

        my $note = Music::Note->new("C#4","ISO");  # 'simple' style - notename/type
        $note->transpose->(-16);     # to A2
        $note->alter(1);             # to A#2
        $note->en_eq('flat');        # to Bb2
        print $note->format("kern"); # BB-
        $note = Music::Note->new({step=>'C',octave=>'4',alter=>1});
        print $note->octave();       # 4
        print $note->step();         # C

DESCRIPTION

 An OO encapsulation of a single musical note. Includes methods for transposition, enharmonic equivalence, and creation/output in a range of formats.

METHODS

new($notename,$type)

Creates a new Note object. See below for a list of types. $type defaults to "ISO" if omitted. $notename defaults to "C4".

new({%params})

Creates a new Note object. Parameters are MusicXML compliant - viz. "step" (A-G), 'octave' (+/- integer) and 'alter' (+/- integer). The 'octave' parameter is based upon standard usage, where C4=Middle C and the number changes between B and C. The 'alter' parameter indicates accidentals, where '1' is sharp, '-1' is flat, '2' is double-sharp and so on.

format($type)

Returns the note object formatted in one of the styles named below.

transpose($amount)

Transposes the note by $amount semitones (+/-), keeping accidental types where possible (eg. - Ab + 2 = Bb, not A#). Returns the note object.

en_eq($type)

Changes the Note into an enharmonic equivalent (C#->Db, for instance). $type can be either 'sharp' (or 's'/'#') or 'flat'('f'/'b'). Double accidentals are naturalised - so 'Bbb' will become 'A' if sharpened, and 'Fx' becomes 'G' if flattened. Returns the note object.

STYLES

 ISO      (C3, D#4, Ab5)
 isobase  (C, Ds, Af  (as ISO, but no octave number) )
 midi     (C3, Ds4, Af5)
 midinum  (0-127)
 kern     (CC, d+, aa-)
 MusicXML (<pitch><step>D</step><octave>4</octave><alter>1</alter></pitch>)
 pdl      (c3, ds4, af5)

 'xml' can be used as a synonym for 'MusicXML'.

TODO more types - abc, solfa (do,re,mi,fa,so,la,ti), Indian (sa,re,ga,ma,pa,da,ni) length manipulation

AUTHOR

 Ben Daglish (bdaglish@cpan.org)

BUGS

 None known
 All feedback most welcome.

COPYRIGHT

 Copyright (c) 2003, Ben Daglish. All Rights Reserved.
 This program is free software; you can redistribute
 it and/or modify it under the same terms as Perl itself.

 The full text of the license can be found in the
 LICENSE file included with this module.

SEE ALSO

 perl(1).