logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Music::Chord::Namer - You give it notes, it names the chord.

Author

       Jimi-Carlo Bukowski-Wills, jimi@webu.co.uk

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.

   EXPORT
       None by default.

       $bestnamescalar|@namesarray = chordname($notesstring|@notesarray)
           chordname()  accepts either a string of notes such as "C Eb G A#" 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!)

Examples

               # 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 '-';
                                                               push @notes, $s2 unless $s2 eq '-';
                                                               push @notes, $s3 unless $s3 eq '-';
                                                               push @notes, $s4 unless $s4 eq '-';
                                                               push @notes, $s5 unless $s5 eq '-';
                                                               push @notes, $s6 unless $s6 eq '-';
                                                               if(@notes >= 4){
                                                                       print scalar(chordname(@notes)),' = ',join(' ',@notes),"\n";
                                                               }
                                                       }
                                               }
                                       }
                               }
                       }
               }

Name

       Music::Chord::Namer - You give it notes, it names the chord.

See Also

       Music::Image::Chord could be combined nicely with this module.

Synopsis

               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

See Also