NAME

Music::GuitarChordDiagram - Draw Guitar Chord Diagrams

VERSION

version 0.0200

SYNOPSIS

use Music::GuitarChordDiagram;

my $dia = Music::GuitarChordDiagram->new(
  chord      => 'x02220',
  position   => 1,
  string_num => 6,
  fret_num   => 5,
  size       => 30,
  outfile    => 'chord-diagram',
  font       => '/path/to/TTF/font.ttf',
  notes      => { 1 => [qw/D Eb E F .../], 2 => [qw/.../], },
  verbose    => 1,
);

$dia->draw();

DESCRIPTION

A Music::GuitarChordDiagram object draws guitar chord diagrams including neck position and chord name annotations.



ATTRIBUTES

chord

$dia->chord('xx0232');
$chord = $dia->chord;

A guitar chord given in string format, where non-zero digits represent frets, x (or X) indicates a muted string and 0 (or o or O) indicates an open string. The order of the strings is 654321 from lowest to highest.

Examples:

 c: x32010
 d: xxO232
 e: 022100
 f: xx3211
 g: 210002
 a: x02220
 b: xx4442

 cm: xx5543
 dm: xx0231
 em: 022000
 fm: xx3111
 gm: xx5333
 am: x02210
 bm: xx4432

 c7: x32310
 d7: xx0212
 e7: 020100
 f7: xx1211
 g7: 320001
 a7: x02020
 b7: x21202

position

$position = $dia->position;

The neck position of a chord to be diagrammed. This number is rendered to the left of the first fret.

Default: 1

string_num

$string_num = $dia->string_num;

The number of strings.

Default: 6

fret_num

$fret_num = $dia->fret_num;

The number of frets.

Default: 5

size

$size = $dia->size;

The relative size of the diagram.

Default: 30

outfile

$outfile = $dia->outfile;

The image file name minus the (PNG) extension.

Default: chord-diagram

font

$font = $dia->font;

The TTF font to use when rendering the diagram.

Default: /opt/X11/share/fonts/TTF/VeraMono.ttf

notes

$notes = $dia->notes;

A hashref of string keys and note list values to use in computing the chord.

Default:

1 => [ E F  Gb G  Ab A Bb B  C  Db D Eb ]
2 => [ B C  Db D  Eb E F  Gb G  Ab A Bb ]
3 => [ G Ab A  Bb B  C Db D  Eb E  F Gb ]
4 => [ D Eb E  F  Gb G Ab A  Bb B  C Db ]
5 => [ A Bb B  C  Db D Eb E  F  Gb G Ab ]
6 => [ E F  Gb G  Ab A Bb B  C  Db D Eb ]

verbose

$verbose = $dia->verbose;

Monitor the progress of the diagram construction.

Default: 0

METHODS

new()

$dia = Music::GuitarChordDiagram->new(%arguments);

Create a new Music::GuitarChordDiagram object.

draw()

$dia->draw;

Render the requested chord diagram as a PNG image.

SEE ALSO

Imager

Moo

Music::Chord::Namer

Similar modules:

Music::Image::Chord

GD::Tab::Guitar

AUTHOR

Gene Boggs <gene@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019 by Gene Boggs.

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