Music:...::Namer(3pm)
π NAME π
Music::Chord::Namer β bestie, you hand it some notes and it hands you back the chord's name. That's it. That's the whole gig. πΉβ¨
(It lives in the 3pm manual section, aka the User Contributed Perl Documentation zone, so you already know it's a little indie darling. π
)
β¨ 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
okay so the vibes are immaculate: give it notes, get a name. You can pass an array, you can pass a string, it does not care, it's flexible like that. π¦
πΈ DESCRIPTION πΈ
Music::ChordName optionally exports exactly one sub, chordname, and what that sub does is accept some notes β as either a string or a list β and return the best chord name it can think of. That's the whole personality. It's giving "I know music theory so you don't have to." π
π EXPORT π
None by default. Ngl, you gotta ask for it. (See that qw/chordname/ in the synopsis? That's you asking. π«Ά)
$bestnamescalar|@namesarray = chordname($notesstring|@notesarray)β so here's the tea:chordname()takes either a string of notes like"C Eb G A#", or a list of notes likeqw/Ab Bb F Bb D/. In scalar context it returns the single best name it could come up with for the chord built from the notes you gave it. In array context it returns all the names it thought of, sorted from best to worst β and by "best to worst" we mean shortest to longest! (Shortest name = most iconic. Periodt. π )
π₯ EXAMPLES π₯
Behold, a nesting situation so deep it's practically a group chat with six parallel threads. This one prints a bunch of guitar chord names with at least 4 notes each, all below the 5th fret:
# 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";
}
}
}
}
}
}
}
(The - entries are the "no note here bestie" slots, and yes, that at lest typo is canon, it's in the original, we do not touch the source material. π)
π¦ SEE ALSO π¦
Music::Image::Chord could be combined nicely with this module. Collab of the century honestly, one names the chord and the other draws it. Chef's kiss. π€
π AUTHOR π
Jimi-Carlo Bukowski-Wills, jimi@webu.co.uk β the icon, the legend, the moment. π«‘
π COPYRIGHT AND LICENSE π
Copyright (C) 2006 by Jimi-Carlo Bukowski-Wills
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.
So basically: go forth and remix, bestie. Just keep it under the same terms as Perl. That's the deal. π€β¨
okay that's the whole page, love u, go name some chords π This little tour was brought to you by perl v5.36.0, dated 2023-02-20, filed under Music:...::Namer(3pm). mwah π
π¦ where this page comes from
- debian trixie: libmusic-chord-namer-perl 0.01-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmusic-chord-namer-perl 0.01-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmusic-chord-namer-perl 0.01-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmusic-chord-namer-perl 0.01-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms