.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Music::Chord::Namer 3pm" .TH Music::Chord::Namer 3pm "2023-02-20" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Music::Chord::Namer \- You give it notes, it names the chord. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Music::ChordName qw/chordname/; \& \& print chordname(qw/C E G/); # prints C \& print chordname(q/C E G/); # same (yes, array or string!) \& print chordname(qw/C Eb G Bb D/); # prints Cm9 \& print chordname(qw/G C Eb Bb D/); # prints Cm9/G .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Music::ChordName optionally exports one sub, chordname, which accepts some notes as either a string or a list and returns the best chord name it can think of. .SS "\s-1EXPORT\s0" .IX Subsection "EXPORT" None by default. .ie n .IP "$bestnamescalar|@namesarray = chordname($notesstring|@notesarray)" 4 .el .IP "\f(CW$bestnamescalar\fR|@namesarray = chordname($notesstring|@notesarray)" 4 .IX Item "$bestnamescalar|@namesarray = chordname($notesstring|@notesarray)" \&\fBchordname()\fR accepts either a string of notes such as \*(L"C Eb G A#\*(R" or a list of notes such as qw/Ab Bb F Bb D/. In a scalar context it returns the best name it could think of to describe the chord made from the notes you gave it. In an array context it returns all of the names it thought of, sorted from best to worst (shortest to longest!) .SH "EXAMPLES" .IX Header "EXAMPLES" .Vb 2 \& # to print a bunch of guitar chord names with at lest 4 notes each, \& # all below 5th fret... \& \& foreach my $s1(qw/\- E F Gb G Ab/){ \& foreach my $s2(qw/\- A Bb B C Db/){ \& foreach my $s3(qw/\- D Eb E F Gb/){ \& foreach my $s4(qw/\- G Ab A Bb/){ \& foreach my $s5(qw/\- B C Db D Eb/){ \& foreach my $s6(qw/\- E F Gb G Ab/){ \& my @notes = (); \& push @notes, $s1 unless $s1 eq \*(Aq\-\*(Aq; \& push @notes, $s2 unless $s2 eq \*(Aq\-\*(Aq; \& push @notes, $s3 unless $s3 eq \*(Aq\-\*(Aq; \& push @notes, $s4 unless $s4 eq \*(Aq\-\*(Aq; \& push @notes, $s5 unless $s5 eq \*(Aq\-\*(Aq; \& push @notes, $s6 unless $s6 eq \*(Aq\-\*(Aq; \& if(@notes >= 4){ \& print scalar(chordname(@notes)),\*(Aq = \*(Aq,join(\*(Aq \*(Aq,@notes),"\en"; \& } \& } \& } \& } \& } \& } \& } .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Music::Image::Chord could be combined nicely with this module. .SH "AUTHOR" .IX Header "AUTHOR" Jimi-Carlo Bukowski-Wills, jimi@webu.co.uk .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2006 by Jimi-Carlo Bukowski-Wills .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.