| 1 | #!/usr/bin/perl | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | package App::Music::PlayTab; | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | # Author : Johan Vromans | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # Created On : Tue Sep 15 15:59:04 1992 | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # Last Modified By: Johan Vromans | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # Last Modified On: Tue Dec 5 13:04:32 2017 | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # Update Count : 568 | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # Status : Unknown, Use with caution! | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | ################ Common stuff ################ | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | ▶ | use App::Music::PlayTab::Version; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | our $VERSION = $App::Music::PlayTab::Version::VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | # Package name. | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | my $my_package = 'Sciurix'; | |||||||||||||||||||||||||||||||||||||||||
| 22 | # Program name and version. | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 3 | my ($my_name, $my_version) = ( 'playtab', $VERSION ); | |||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 3 | ▶ | use base qw(Exporter); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 3 | our @EXPORT = qw(run); | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | ################ Command line parameters ################ | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 3 | ▶ | use Getopt::Long; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | sub app_options(); | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 3 | my $output; | |||||||||||||||||||||||||||||||||||||||||
| 34 | my $generate; | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 3 | my $preamble; | |||||||||||||||||||||||||||||||||||||||||
| 36 | 3 | my $gxpose = 0; # global xpose value | |||||||||||||||||||||||||||||||||||||||||
| 37 | 3 | my $verbose = 0; # verbose processing | |||||||||||||||||||||||||||||||||||||||||
| 38 | 3 | my $lilypond = 0; # use LilyPond syntax | |||||||||||||||||||||||||||||||||||||||||
| 39 | 3 | my $bpm = 4; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 3 | my $syntax; # show syntax help | |||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | # Development options (not shown with -help). | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 3 | my $debug = 0; # debugging | |||||||||||||||||||||||||||||||||||||||||
| 44 | 3 | my $trace = 0; # trace (show process) | |||||||||||||||||||||||||||||||||||||||||
| 45 | 3 | my $test = 0; # test | |||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | ################ The Process ################ | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 3 | my $line; # current line (for messages) | |||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 3 | my $xpose = $gxpose; | |||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 3 | my $data; # opus being constructed | |||||||||||||||||||||||||||||||||||||||||
| 54 | my $entry; # entry under construction | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 3 | my $width = 30; # horizontal 'step' for chords | |||||||||||||||||||||||||||||||||||||||||
| 56 | 3 | my $height = -15; # vertical 'step' for lines | |||||||||||||||||||||||||||||||||||||||||
| 57 | 3 | my $margin = 40; # default indentation, if required | |||||||||||||||||||||||||||||||||||||||||
| 58 | 3 | my $indent = 0; # actual indentation | |||||||||||||||||||||||||||||||||||||||||
| 59 | 3 | my $barno; # barnumber (slightly magical) | |||||||||||||||||||||||||||||||||||||||||
| 60 | 3 | my $s_margin = $margin; # save values | |||||||||||||||||||||||||||||||||||||||||
| 61 | 3 | my $s_indent = 0; # save values | |||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 3 | ▶ | use App::Music::PlayTab::Output; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | 3 | ▶ | use Encode; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 3 | ▶ | use Clone qw(clone); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 2 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=44 SCAR=56.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | ▶ | local (@ARGV) = @_ ? @_ : @ARGV; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 2 | app_options(); | |||||||||||||||||||||||||||||||||||||||||
| 72 | 2 | binmode( STDERR, ':utf8' ); | |||||||||||||||||||||||||||||||||||||||||
| 73 | 2 | ▶ | print STDOUT ("ok 1\n") if $test; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 2 | ▶ | if ( defined $output ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 2 | ▶ | open(OUTPUT, ">$output") or print STDOUT ("not ") if $test; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$test && (open(OUTPUT, ">$output") || print(STDOUT 'not '))
open OUTPUT, ">$output" or print STDOUT "not "
MC/DC0%0/3
$test && (open(OUTPUT, ">$output") || print(STDOUT 'not '))
$test
open OUTPUT, ">$output"
print STDOUT "not "
Truth table0%0/4
A && B or C
A= $testB= open OUTPUT, ">$output"C= print STDOUT "not "
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 2 | ▶ | print STDOUT ("ok 2\n") if $test; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||
| 79 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | die("Test mode requires -output option to be set\n") if $test; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | *OUTPUT = *STDOUT; | |||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | # Options post-processing. | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 2 | ▶ | $trace |= ($debug || $test); | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$debug || $test
MC/DC0%0/2
$debug || $test
$debug
$test
Truth table33%1/3
A || B
A= $debugB= $test
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 2 | $xpose = $gxpose; | |||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | # Actually we should probe all backends and let them register what | ||||||||||||||||||||||||||||||||||||||||||
| 89 | # they can handle. | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 2 | ▶ | $generate = 'PDF' if $Cava::Packager::PACKAGED; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 2 | ▶ | if ( $generate ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | if ( $generate eq 'ps' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | $generate = 'PostScript'; | |||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | elsif ( $generate eq 'pdf' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | $generate = 'PDF'; | |||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | elsif ( $output ) { | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 2 | ▶ | if ( $output =~ /\.ps$/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 2 | $generate = 'PostScript'; | |||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | elsif ( $output =~ /\.pdf$/i ) { | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | $generate = 'PDF'; | |||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | elsif ( $output =~ /\.dmp$/i ) { | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | $generate = 'Dump'; | |||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 2 | ▶ | $generate ||= 'PDF'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$generate ||= "PDF"
MC/DC0%0/1
$generate ||= "PDF"
$generate
Truth table50%1/2
A
A= $generate
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 2 | my $gen = App::Music::PlayTab::Output->new({ | |||||||||||||||||||||||||||||||||||||||||
| 114 | generate => $generate, | ||||||||||||||||||||||||||||||||||||||||||
| 115 | output => $output, | ||||||||||||||||||||||||||||||||||||||||||
| 116 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 2 | ▶ | print STDOUT ("ok 3\n") if $test; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | reset_globals(); | |||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | ▶ | while ( <> ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | # Skip comment lines. | ||||||||||||||||||||||||||||||||||||||||||
| 124 | 56 | ▶ | next if /^\s*#/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | # Skip LilyPond comment lines. | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 56 | ▶ | next if $lilypond && /^\s*%/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$lilypond and /^\s*%/
MC/DC0%0/2
$lilypond and /^\s*%/
$lilypond
/^\s*%/
Truth table66%2/3
A and B
A= $lilypondB= /^\s*%/
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | # Remove LilyPond line number comments. | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 56 | ▶ | $lilypond && s/\s+\%\s*\d+.*//; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | # Skip empty lines. | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 56 | ▶ | next unless /\S/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 46 | $_ = decode_utf8($_); | |||||||||||||||||||||||||||||||||||||||||
| 133 | 46 | chomp($line = $_); | |||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 46 | s/\^\s+//; | |||||||||||||||||||||||||||||||||||||||||
| 136 | 46 | ▶ | if ( /^!\s*(.*)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | 12 | control($1); | |||||||||||||||||||||||||||||||||||||||||
| 138 | 12 | next; | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 34 | ▶ | if ( /^\s*\[/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | # Chord diagram(s). | ||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | while ( /^\s*\[([^]]+)\](.*)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | eval { chord($1) }; | |||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | errout($@) if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | $_ = $2; | |||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | 34 | ▶ | if ( /^\s*\|/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 30 | bar($_); | |||||||||||||||||||||||||||||||||||||||||
| 153 | 30 | next; | |||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | # Spacing/margin notes. | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 4 | ▶ | if ( /^%?[-+=<]/ && $entry->{prefix} && $entry->{prefix} ne "" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
/^%?[-+=<]/ and $entry->{"prefix"} and $entry->{"prefix"} ne ""
/^%?[-+=<]/ and $entry->{"prefix"}
MC/DC0%0/3
/^%?[-+=<]/ and $entry->{"prefix"} and $entry->{"prefix"} ne ""
/^%?[-+=<]/
$entry->{"prefix"}
$entry->{"prefix"} ne ""
Truth table25%1/4
A and B and C
A= /^%?[-+=<]/B= $entry->{"prefix"}C= $entry->{"prefix"} ne ""
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | $entry->{height} = $height; | |||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | $entry->{margin} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | $entry->{measures} = []; | |||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | push_entry(); | |||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 4 | ▶ | if ( /^%?=(.*)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 1 | $entry->{prefix} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 167 | 1 | $entry->{pfx_vsp} = 2; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | 3 | ▶ | if ( /^%?-(.*)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 3 | $entry->{prefix} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 3 | $entry->{pfx_vsp} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 3 | next; | |||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | if ( /^%?\+(.*)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $entry->{prefix} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $entry->{pfx_vsp} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | if ( /^%?\</ ) { # cancel margin changes | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $s_margin = $margin; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $s_indent = $indent; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $margin = $indent = 0; | |||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | # Text. Treat as +Prefix without measures. | ||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if ( $entry->{prefix} && $entry->{prefix} ne "" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$entry->{"prefix"} and $entry->{"prefix"} ne ""
MC/DC0%0/2
$entry->{"prefix"} and $entry->{"prefix"} ne ""
$entry->{"prefix"}
$entry->{"prefix"} ne ""
Truth table0%0/3
A and B
A= $entry->{"prefix"}B= $entry->{"prefix"} ne ""
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $entry->{height} = $height; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | $entry->{margin} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | $entry->{measures} = []; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | push_entry(); | |||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | text($line); | |||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | continue { | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 56 | ▶ | if ( eof ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 4 | $gen->generate({ opus => $data }); | |||||||||||||||||||||||||||||||||||||||||
| 199 | 4 | reset_globals(); | |||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 2 | ▶ | print STDOUT ("ok 4\n") if $test; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 2 | ▶ | print STDOUT ("ok 5\n") if $test; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 2 | ▶ | close OUTPUT if defined $output; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 2 | ▶ | exit 0 unless $test; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 30 | ▶ | sub push_entry { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
push_entry: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 30 | ▶ | return unless $entry && keys(%$entry); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$entry and keys %$entry
MC/DC0%0/2
$entry and keys %$entry
$entry
keys %$entry
Truth table33%1/3
A and B
A= $entryB= keys %$entry
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | 30 | push( @{ $data->{lines} }, $entry ); | |||||||||||||||||||||||||||||||||||||||||
| 214 | 30 | $entry = {}; | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 6 | ▶ | sub reset_globals { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset_globals: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | 6 | $data = {}; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 6 | $entry = {}; | |||||||||||||||||||||||||||||||||||||||||
| 220 | 6 | $width = 30; # horizontal 'step' for chords | |||||||||||||||||||||||||||||||||||||||||
| 221 | 6 | $height = -15; # vertical 'step' for lines | |||||||||||||||||||||||||||||||||||||||||
| 222 | 6 | $margin = 40; # default indentation, if required | |||||||||||||||||||||||||||||||||||||||||
| 223 | 6 | $indent = 0; # actual indentation | |||||||||||||||||||||||||||||||||||||||||
| 224 | 6 | undef $barno; # barnumber (slightly magical) | |||||||||||||||||||||||||||||||||||||||||
| 225 | 6 | $s_margin = $margin; # save values | |||||||||||||||||||||||||||||||||||||||||
| 226 | 6 | $s_indent = 0; # save values | |||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | ################ Subroutines ################ | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | 30 | ▶ | sub bar { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bar: called CC=28 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 30 | my ($line) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | 30 | my @m = (); | |||||||||||||||||||||||||||||||||||||||||
| 235 | 30 | ▶ | $indent = $margin if $entry->{prefix} && $entry->{prefix} ne ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$entry->{"prefix"} and $entry->{"prefix"} ne ""
MC/DC50%1/2
$entry->{"prefix"} and $entry->{"prefix"} ne ""
$entry->{"prefix"}
$entry->{"prefix"} ne ""
Truth table66%2/3
A and B
A= $entry->{"prefix"}B= $entry->{"prefix"} ne ""
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | 30 | ▶ | $entry->{barno} = $barno if defined $barno && $barno > 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $barno and $barno > 0
MC/DC0%0/2
defined $barno and $barno > 0
defined $barno
$barno > 0
Truth table66%2/3
A and B
A= defined $barnoB= $barno > 0
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 30 | $entry->{width} = $width; | |||||||||||||||||||||||||||||||||||||||||
| 238 | 30 | $entry->{height} = $height; | |||||||||||||||||||||||||||||||||||||||||
| 239 | 30 | ▶ | $entry->{margin} = $indent if $indent; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 30 | $entry->{bpm} = $bpm; | |||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | # Autosensing... | ||||||||||||||||||||||||||||||||||||||||||
| 243 | # Uppercase chords -> not lilypond mode. | ||||||||||||||||||||||||||||||||||||||||||
| 244 | 30 | ▶ | if ( $line =~ /^\s*\|\s*[A-G]/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 1 | $lilypond = 0; | |||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | # Lowcase chords and : modifiers -> lilypond mode. | ||||||||||||||||||||||||||||||||||||||||||
| 248 | elsif ( $line =~ /^\s*\|\s*[a-g].*?:(m|\d|sus|aug|dim)/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 249 | 8 | $lilypond = 1; | |||||||||||||||||||||||||||||||||||||||||
| 250 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | 30 | ▶ | if ( $lilypond ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | # LilyPond chords use : and ., so don't split on these. | ||||||||||||||||||||||||||||||||||||||||||
| 255 | 21 | $line =~ s/([|`'])/ $1 /g; #'`])/; | |||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||
| 257 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 258 | 9 | $line =~ s/([|.:`'])/ $1 /g; #'`])/; | |||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | 30 | $line =~ s/ +/ /g; | |||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | 30 | my (@c) = split(' ', $line); | |||||||||||||||||||||||||||||||||||||||||
| 263 | 30 | my $firstbar = 1; | |||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | 30 | ▶ | while ( @c > 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | 519 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 267 | 519 | my $c = shift(@c); | |||||||||||||||||||||||||||||||||||||||||
| 268 | 519 | ▶ | if ( $c eq '|' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 141 | ▶ | if ( $firstbar ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 30 | $firstbar = 0; | |||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||
| 272 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 111 | push( @{ $entry->{measures} }, [ @m ] ); | |||||||||||||||||||||||||||||||||||||||||
| 274 | 111 | ▶ | $barno++ if defined $barno; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | 141 | @m = (); | |||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | elsif ( $c eq ':' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | push( @m, "again" ); | |||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||
| 281 | elsif ( $c eq '.' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 260 | push( @m, "space" ); | |||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | elsif ( $c eq '%' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | my $xs = 1; | |||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | if ( $lilypond ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $xs = $bpm; | |||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||
| 289 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | while ( @c > 0 && $c[0] eq '.' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@c > 0 and $c[0] eq "."
MC/DC0%0/2
@c > 0 and $c[0] eq "."
@c > 0
$c[0] eq "."
Truth table0%0/3
A and B
A= @c > 0B= $c[0] eq "."
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | shift(@c); | |||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | $xs++; | |||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | push( @m, [ "same", 1, $xs ] ); | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | elsif ( $c eq '-' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | push( @m, "rest" ); | |||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||
| 300 | elsif ( $c eq '\'' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | push( @m, "hmore" ); | |||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | elsif ( $c eq '`' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | push( @m, "hless" ); | |||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||
| 306 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 307 | 118 | my $chord = parse_chord($c); | |||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | 118 | ▶ | if ( $chord->is_rest ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 7 | push( @m, "rest" ); | |||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||
| 312 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 313 | 111 | ▶ | $chord->transpose($xpose) if $xpose; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 111 | push( @m, clone($chord) ); | |||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||
| 316 | 118 | ▶ | if ( my $d = $chord->duration ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | 81 | $d = int($d / ($chord->duration_base / $bpm)); | |||||||||||||||||||||||||||||||||||||||||
| 318 | 81 | ▶ | unshift(@c, ('.') x ($d-1)) if $d > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||
| 321 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 322 | 519 | ▶ | die($@) if $@ =~ /can\'t locate/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | 519 | ▶ | errout($@) if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | 30 | push_entry(); | |||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 12 | ▶ | sub control { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
control: called CC=19 SCAR=35.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 12 | local ($_) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | # Title. | ||||||||||||||||||||||||||||||||||||||||||
| 333 | 12 | ▶ | if ( /^t(?:itle)?\s+(.*)/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 2 | $data->{title} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 335 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | # Subtitle(s). | ||||||||||||||||||||||||||||||||||||||||||
| 339 | 10 | ▶ | if ( /^s(?:ub(?:title)?)?\s+(.*)/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 2 | push( @{ $data->{subtitle} }, $1 ); | |||||||||||||||||||||||||||||||||||||||||
| 341 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | # Width adjustment. | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 8 | ▶ | if ( /^w(idth)?\s+([-+]?\d+)/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | 2 | set_width($2); | |||||||||||||||||||||||||||||||||||||||||
| 347 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | # Height adjustment. | ||||||||||||||||||||||||||||||||||||||||||
| 351 | 6 | ▶ | if ( /^h(eight)?\s+([-+]?\d+)/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | 1 | set_height($2); | |||||||||||||||||||||||||||||||||||||||||
| 353 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | # Margin width adjustment. | ||||||||||||||||||||||||||||||||||||||||||
| 357 | 5 | ▶ | if ( /^m(argin)?\s+([-+]?\d+)/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | set_margin($2); | |||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | $indent = $margin if $indent; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||
| 362 | 5 | ▶ | if ( /^m(argin)?/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | $margin = $s_margin; | |||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | $indent = $s_indent; | |||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | # Transpose. | ||||||||||||||||||||||||||||||||||||||||||
| 369 | 5 | ▶ | if ( /^x(pose)?\s+([-+])(\d+)/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 1 | $xpose += $2.$3; | |||||||||||||||||||||||||||||||||||||||||
| 371 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | # Bar numbering. | ||||||||||||||||||||||||||||||||||||||||||
| 375 | 4 | ▶ | if ( /^n(umber)?\s+([-+]?\d+)?/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 376 | 1 | ▶ | set_barno(defined $2 ? $2 ? $2 < 0 ? $2+1 : $2 : 0 : 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | # LilyPond syntax. | ||||||||||||||||||||||||||||||||||||||||||
| 381 | 3 | ▶ | if ( /^l(?:y|ilypond)?(?:\s+(\d+))?/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | 3 | ▶ | $lilypond = defined $1 ? $1 : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 383 | 3 | ▶ | $bpm = ($lilypond && defined $1) ? $1 : 4; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$lilypond and defined $1
MC/DC0%0/2
$lilypond and defined $1
$lilypond
defined $1
Truth table66%2/3
A and B
A= $lilypondB= defined $1
| |||||||||||||||||||||||||||||||||||||||||||
| 384 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | # Global settings for drivers and so on. | ||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | if ( /^g(?:lobal)?\s+(.*)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 389 | 3 | ▶ | use Text::ParseWords; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | push( @{ $data->{globalsettings} }, shellwords($1) ); | |||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | # Postfix text. | ||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | if ( /^\>\s+(.+)/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | $entry->{postfix} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | errout("Unrecognized control"); | |||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | 3 | my $chordparser; | |||||||||||||||||||||||||||||||||||||||||
| 404 | my $lilyparser; | ||||||||||||||||||||||||||||||||||||||||||
| 405 | 118 | ▶ | sub parse_chord { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_chord: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | 118 | my $chord = shift; | |||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | 118 | my $parser; | |||||||||||||||||||||||||||||||||||||||||
| 409 | 118 | ▶ | if ( $lilypond ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 81 | ▶ | unless ( $lilyparser ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 411 | 1 | require App::Music::PlayTab::LyChord; | |||||||||||||||||||||||||||||||||||||||||
| 412 | 1 | $lilyparser = App::Music::PlayTab::LyChord->new; | |||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||
| 414 | 81 | $parser = $lilyparser; | |||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||
| 416 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 417 | 37 | ▶ | unless ( $chordparser ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 418 | 2 | require App::Music::PlayTab::Chord; | |||||||||||||||||||||||||||||||||||||||||
| 419 | 2 | $chordparser = App::Music::PlayTab::Chord->new; | |||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||
| 421 | 37 | $parser = $chordparser; | |||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||
| 423 | 118 | $parser->parse($chord); | |||||||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | ▶ | sub chord { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
chord: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | my (@l) = split( ' ', $_[0] ); | |||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | ▶ | die("Illegal [chord] spec, need 7 or 8 values") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@l == 8 or @l == 7
MC/DC0%0/2
@l == 8 or @l == 7
@l == 8
@l == 7
Truth table0%0/3
A or B
A= @l == 8B= @l == 7
| |||||||||||||||||||||||||||||||||||||||||||
| 430 | unless @l == 8 || @l == 7; | ||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | my $cn = shift(@l); | |||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my $chord = eval { parse_chord($cn) }; | |||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | my @c = (); | |||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | my $c = 0; | |||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | foreach ( @l ) { | |||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | $_ = -1 if lc($_) eq "x"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | if ( /^@(\d+)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | ▶ | $c = 0+$1 if $1 > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | ▶ | die("Illegal [chord] spec, need 6 numbers") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
/^-?\d$/ or @c == 6
MC/DC0%0/2
/^-?\d$/ or @c == 6
/^-?\d$/
@c == 6
Truth table0%0/3
A or B
A= /^-?\d$/B= @c == 6
| |||||||||||||||||||||||||||||||||||||||||||
| 444 | unless /^-?\d$/ || @c == 6; | ||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | push(@c, 0+$_); | |||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | unshift( @c, $c ); | |||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | ▶ | unshift( @c, $chord ? clone($chord) : $cn ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | ▶ | if ( $data->{lines}->[-1]->{chords} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | push( @{ $data->{lines}->[-1]->{chords} }, \@c ); | |||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||
| 454 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | $entry->{margin} = $margin; | |||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | $entry->{height} = $height; | |||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | $entry->{chords} = [ \@c ]; | |||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | push_entry(); | |||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | sub text { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | my ($line) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | $entry->{height} = $height; | |||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | $entry->{margin} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | $entry->{prefix} = $line; | |||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | $entry->{pfx_vsp} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | push_entry(); | |||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | ▶ | sub errout { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
errout: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | my $msg = "@_"; | |||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | $msg =~ s/ at .*line \d+.*//s; | |||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | warn("$msg\n", "Line $.: $line\n"); | |||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | ################ Helper Routines ################ | ||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||
| 479 | 4 | ▶ | sub _set_incr { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_incr: called CC=4 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||
| 480 | 4 | my $var = shift; | |||||||||||||||||||||||||||||||||||||||||
| 481 | 4 | my $ref = shift; | |||||||||||||||||||||||||||||||||||||||||
| 482 | 4 | my $v = shift; | |||||||||||||||||||||||||||||||||||||||||
| 483 | 4 | ▶ | warn("set_$var: number or increment expected\n") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 484 | unless $v =~ /^([-+])?(\d+)$/; | ||||||||||||||||||||||||||||||||||||||||||
| 485 | 4 | ▶ | if ( defined($1) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 486 | 4 | $$ref += $1.$2; | |||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||
| 488 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | $$ref = $2; | |||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||
| 491 | 4 | ▶ | $entry->{$var} = $$ref if $var; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | 2 | ▶ | sub set_width { unshift( @_, "width", \$width ); goto &_set_incr } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_width: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||
| 496 | 1 | ▶ | sub set_height { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_height: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 497 | 1 | unshift( @_, "height", \$height ); | |||||||||||||||||||||||||||||||||||||||||
| 498 | 1 | $height = -$height; | |||||||||||||||||||||||||||||||||||||||||
| 499 | 1 | &_set_incr; | |||||||||||||||||||||||||||||||||||||||||
| 500 | 1 | $height = -$height; | |||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | ▶ | sub set_margin { unshift( @_, "margin", \$margin ); goto &_set_incr } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_margin: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 504 | 1 | ▶ | sub set_barno { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_barno: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 505 | # Values: 0 = disable, >0 = use, <0 lead-in. | ||||||||||||||||||||||||||||||||||||||||||
| 506 | 1 | unshift( @_, undef, \$barno ); | |||||||||||||||||||||||||||||||||||||||||
| 507 | 1 | &_set_incr; | |||||||||||||||||||||||||||||||||||||||||
| 508 | 1 | ▶ | $barno = undef unless $barno; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||
| 511 | ################ Command Line Options ################ | ||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||
| 513 | sub app_ident; | ||||||||||||||||||||||||||||||||||||||||||
| 514 | sub app_usage($); | ||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||
| 516 | 2 | ▶ | sub app_options() { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
app_options: called CC=9 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 517 | 2 | my $help = 0; # handled locally | |||||||||||||||||||||||||||||||||||||||||
| 518 | 2 | my $ident = 0; # handled locally | |||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||
| 520 | # Process options, if any. | ||||||||||||||||||||||||||||||||||||||||||
| 521 | # Make sure defaults are set before returning! | ||||||||||||||||||||||||||||||||||||||||||
| 522 | 2 | ▶ | return unless @ARGV > 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||
| 524 | 2 | ▶ | if ( !GetOptions('output=s' => \$output, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not &GetOptions("output=s", \$output, "generate=s", \$generate, "preamble=s", \$preamble, "transpose|x=i", \$gxpose, "lilypond=i", \$lilypond, "syntax", \$syntax, "ident", \$ident, "verbose", \$verbose, "trace", \$trace, "help", \$help, "test", \$test, "debug", \$debug) or abs $gxpose > 11
MC/DC0%0/2
not &GetOptions("output=s", \$output, "generate=s", \$generate, "preamble=s", \$preamble, "transpose|x=i", \$gxpose, "lilypond=i", \$lilypond, "syntax", \$syntax, "ident", \$ident, "verbose", \$verbose, "trace", \$trace, "help", \$help, "test", \$test, "debug", \$debug) or abs $gxpose > 11
not &GetOptions("output=s", \$output, "generate=s", \$generate, "preamble=s", \$preamble, "transpose|x=i", \$gxpose, "lilypond=i", \$lilypond, "syntax", \$syntax, "ident", \$ident, "verbose", \$verbose, "trace", \$trace, "help", \$help, "test", \$test, "debug", \$debug)
abs $gxpose > 11
Truth table33%1/3
not(A) or B
A= not &GetOptions("output=s", \$output, "generate=s", \$generate, "preamble=s", \$preamble, "transpose|x=i", \$gxpose, "lilypond=i", \$lilypond, "syntax", \$syntax, "ident", \$ident, "verbose", \$verbose, "trace", \$trace, "help", \$help, "test", \$test, "debug", \$debug)B= abs $gxpose > 11
| |||||||||||||||||||||||||||||||||||||||||||
| 525 | 'generate=s' => \$generate, | ||||||||||||||||||||||||||||||||||||||||||
| 526 | 'preamble=s' => \$preamble, | ||||||||||||||||||||||||||||||||||||||||||
| 527 | 'transpose|x=i' => \$gxpose, | ||||||||||||||||||||||||||||||||||||||||||
| 528 | 'lilypond=i' => \$lilypond, | ||||||||||||||||||||||||||||||||||||||||||
| 529 | 'syntax' => \$syntax, | ||||||||||||||||||||||||||||||||||||||||||
| 530 | 'ident' => \$ident, | ||||||||||||||||||||||||||||||||||||||||||
| 531 | 'verbose' => \$verbose, | ||||||||||||||||||||||||||||||||||||||||||
| 532 | 'trace' => \$trace, | ||||||||||||||||||||||||||||||||||||||||||
| 533 | 'help' => \$help, | ||||||||||||||||||||||||||||||||||||||||||
| 534 | 'test' => \$test, | ||||||||||||||||||||||||||||||||||||||||||
| 535 | 'debug' => \$debug, | ||||||||||||||||||||||||||||||||||||||||||
| 536 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 537 | or abs($gxpose) > 11 ) | ||||||||||||||||||||||||||||||||||||||||||
| 538 | { | ||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | app_usage(2); | |||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||
| 541 | 2 | ▶ | app_ident if $ident; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 542 | 2 | ▶ | if ( $help ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | app_usage(0); | |||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | exit(0); | |||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||
| 546 | 2 | ▶ | if ( $syntax ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | ▶ | $lilypond ? ly_syntax() : syntax(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | pr_syntax(); | |||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | exit(0); | |||||||||||||||||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||||||||||||||||
| 551 | 2 | ▶ | $bpm = $lilypond if $lilypond; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | ▶ | sub app_ident { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
app_ident: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | print STDERR ("This is $my_package [$my_name $my_version]\n"); | |||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | sub app_usage($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
app_usage: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | my ($exit) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | app_ident; | |||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | print STDERR <<EndOfUsage; | |||||||||||||||||||||||||||||||||||||||||
| 562 | Usage: $0 [options] [file ...] | ||||||||||||||||||||||||||||||||||||||||||
| 563 | --output XXX output file name | ||||||||||||||||||||||||||||||||||||||||||
| 564 | --transpose +/-N transpose all | ||||||||||||||||||||||||||||||||||||||||||
| 565 | --lilypond N use LilyPond chord syntax, N = bpm | ||||||||||||||||||||||||||||||||||||||||||
| 566 | --help this message | ||||||||||||||||||||||||||||||||||||||||||
| 567 | --syntax explain chord syntax | ||||||||||||||||||||||||||||||||||||||||||
| 568 | --ident show identification | ||||||||||||||||||||||||||||||||||||||||||
| 569 | --verbose verbose information | ||||||||||||||||||||||||||||||||||||||||||
| 570 | EndOfUsage | ||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | ▶ | exit $exit if $exit != 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | ▶ | sub syntax { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
syntax: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | print STDERR <<EOD; | |||||||||||||||||||||||||||||||||||||||||
| 576 | Notes: C, D, E, F, G, A, B. | ||||||||||||||||||||||||||||||||||||||||||
| 577 | Raised with '#' or suffix 'is', e.g. A#, Ais. | ||||||||||||||||||||||||||||||||||||||||||
| 578 | Lowered with 'b' or suffix 's' or 'es', e.g. Bes, As, Eb. | ||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||
| 580 | Chords: note + optional modifiers. | ||||||||||||||||||||||||||||||||||||||||||
| 581 | Chord modifiers Meaning [examples] | ||||||||||||||||||||||||||||||||||||||||||
| 582 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 583 | nothing major triad [C] | ||||||||||||||||||||||||||||||||||||||||||
| 584 | - or min or m minor triad [Cm Fmin Gb-] | ||||||||||||||||||||||||||||||||||||||||||
| 585 | + or aug augmented triad [Caug B+] | ||||||||||||||||||||||||||||||||||||||||||
| 586 | o or 0 or dim diminished triad [Co D0 Fdim] | ||||||||||||||||||||||||||||||||||||||||||
| 587 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 588 | maj7 major 7th chord [Cmaj7] | ||||||||||||||||||||||||||||||||||||||||||
| 589 | % half-diminished 7 chord [C%] | ||||||||||||||||||||||||||||||||||||||||||
| 590 | 6,7,9,11,13 chord additions [C69] | ||||||||||||||||||||||||||||||||||||||||||
| 591 | sus sus4, sus2 suspended 4th, 2nd [Csus] | ||||||||||||||||||||||||||||||||||||||||||
| 592 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 593 | # raise the pitch of the note to a sharp [C11#9] | ||||||||||||||||||||||||||||||||||||||||||
| 594 | b lower the pitch of the note to a flat [C11b9] | ||||||||||||||||||||||||||||||||||||||||||
| 595 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 596 | no substract a note from a chord [C9no11] | ||||||||||||||||||||||||||||||||||||||||||
| 597 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 598 | () and _ may be used to avoid ambiguity, e.g. C(#9) <-> C#9 <-> C#_9 | ||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||
| 600 | Other: Meaning | ||||||||||||||||||||||||||||||||||||||||||
| 601 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 602 | . Chord space | ||||||||||||||||||||||||||||||||||||||||||
| 603 | - Rest | ||||||||||||||||||||||||||||||||||||||||||
| 604 | : Repeats previous chord | ||||||||||||||||||||||||||||||||||||||||||
| 605 | % Repeat pattern | ||||||||||||||||||||||||||||||||||||||||||
| 606 | / Powerchord constructor [D/G D/E-] | ||||||||||||||||||||||||||||||||||||||||||
| 607 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 608 | EOD | ||||||||||||||||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | ▶ | sub ly_syntax { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ly_syntax: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | print STDERR <<EOD; | |||||||||||||||||||||||||||||||||||||||||
| 613 | Notes: c, d, e, f, g, a, b. | ||||||||||||||||||||||||||||||||||||||||||
| 614 | Raised with suffix 'is', e.g. ais. | ||||||||||||||||||||||||||||||||||||||||||
| 615 | Lowered with suffix 'es', e.g. bes, ees. | ||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||
| 617 | Chords: note + optional duration + optional modifiers. | ||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||
| 619 | Duration = 1, 2, 4, 8, with possible dots, e.g., "2.". | ||||||||||||||||||||||||||||||||||||||||||
| 620 | No duration means: use the duration of the previous chord. | ||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||
| 622 | Modifiers are preceeded with a ":". | ||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||
| 624 | Modifiers Meaning [examples] | ||||||||||||||||||||||||||||||||||||||||||
| 625 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 626 | nothing major triad c4 | ||||||||||||||||||||||||||||||||||||||||||
| 627 | m minor triad c4:m | ||||||||||||||||||||||||||||||||||||||||||
| 628 | aug augmented triad c4:aug | ||||||||||||||||||||||||||||||||||||||||||
| 629 | dim diminished triad c4:dim | ||||||||||||||||||||||||||||||||||||||||||
| 630 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 631 | maj major 7th chord c4:maj | ||||||||||||||||||||||||||||||||||||||||||
| 632 | 6,7,9,11,13 chord additions c4:7 c4:6.9 (dot required) | ||||||||||||||||||||||||||||||||||||||||||
| 633 | sus sus4, sus2 suspended 4th, 2nd c4:sus | ||||||||||||||||||||||||||||||||||||||||||
| 634 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 635 | + raise the pitch of an added note c4:11.9+ | ||||||||||||||||||||||||||||||||||||||||||
| 636 | - lower the pitch of an added note c4:11.9- | ||||||||||||||||||||||||||||||||||||||||||
| 637 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 638 | ^ substract a note from a chord c4:9.^11 | ||||||||||||||||||||||||||||||||||||||||||
| 639 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||
| 641 | Other: Meaning | ||||||||||||||||||||||||||||||||||||||||||
| 642 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 643 | r Rest r2 | ||||||||||||||||||||||||||||||||||||||||||
| 644 | s Rest s4 | ||||||||||||||||||||||||||||||||||||||||||
| 645 | / Powerchord constructor d/g d/e:m | ||||||||||||||||||||||||||||||||||||||||||
| 646 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 647 | EOD | ||||||||||||||||||||||||||||||||||||||||||
| 648 | } | ||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||
| 650 | 0 | ▶ | sub pr_syntax { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pr_syntax: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | print STDERR <<EOD; | |||||||||||||||||||||||||||||||||||||||||
| 652 | EOD | ||||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||
| 655 | ################ Resources ################ | ||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||
| 657 | 3 | ▶ | sub ::findlib { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
findlib: called CC=8 SCAR=27.7
| |||||||||||||||||||||||||||||||||||||||||||
| 658 | 3 | my ( $file ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||
| 660 | # Packaged. | ||||||||||||||||||||||||||||||||||||||||||
| 661 | 3 | ▶ | if ( $App::Packager::PACKAGED ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | my $found = App::Packager::GetUserFile($file); | |||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | ▶ | return $found if -e $found; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | $found = App::Packager::GetResource($file); | |||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | ▶ | return $found if -e $found; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||
| 668 | 3 | ( my $me = __PACKAGE__ ) =~ s;::;/;g; | |||||||||||||||||||||||||||||||||||||||||
| 669 | 3 | foreach ( @INC ) { | |||||||||||||||||||||||||||||||||||||||||
| 670 | 22 | ▶ | return "$_/$me/user/$file" if -e "$_/$me/user/$file"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 671 | 22 | ▶ | return "$_/$me/res/$file" if -e "$_/$me/res/$file"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 672 | 22 | ▶ | return "$_/$me/$file" if -e "$_/$me/$file"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 673 | } | ||||||||||||||||||||||||||||||||||||||||||
| 674 | 3 | undef; | |||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||||
| 677 | 3 | ▶ | use lib ( grep { defined } ::findlib("CPAN") ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||
| 679 | ################ Documentation ################ | ||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||
| 683 | App::Music::PlayTab - Print chords of songs in a tabular fashion. | ||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||
| 687 | =head2 playtab | ||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||
| 689 | playtab [options] [file ...] | ||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | Options: | ||||||||||||||||||||||||||||||||||||||||||
| 692 | --transpose +/-N transpose all songs | ||||||||||||||||||||||||||||||||||||||||||
| 693 | --output XXX set outout file | ||||||||||||||||||||||||||||||||||||||||||
| 694 | --lilypond N accept chords in LilyPond syntax, N = bpm | ||||||||||||||||||||||||||||||||||||||||||
| 695 | --syntax print chord syntax | ||||||||||||||||||||||||||||||||||||||||||
| 696 | --ident show identification | ||||||||||||||||||||||||||||||||||||||||||
| 697 | --help brief help message | ||||||||||||||||||||||||||||||||||||||||||
| 698 | --verbose verbose information | ||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||
| 700 | =head2 App::Music::PlayTab | ||||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||
| 702 | use App::Music::PlayTab; | ||||||||||||||||||||||||||||||||||||||||||
| 703 | run(); # arguments in @ARGV | ||||||||||||||||||||||||||||||||||||||||||
| 704 | run(@args); # explicit arguments | ||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||
| 706 | perl -MApp::Music::PlayTab -e run ...arguments... | ||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||
| 708 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||
| 710 | This utility program is intended for musicians. It produces tabular | ||||||||||||||||||||||||||||||||||||||||||
| 711 | chord diagrams that are very handy for playing rhythm guitar or bass | ||||||||||||||||||||||||||||||||||||||||||
| 712 | in jazz, blues, and popular music. | ||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||
| 714 | I wrote it since in official (and unofficial) sheet music, I find it | ||||||||||||||||||||||||||||||||||||||||||
| 715 | often hard to stick to the structure of the piece. Also, as a guitar | ||||||||||||||||||||||||||||||||||||||||||
| 716 | player, I do not need all the detailed notes and such that are only | ||||||||||||||||||||||||||||||||||||||||||
| 717 | important for melody instruments. And usually I cannot turn over the | ||||||||||||||||||||||||||||||||||||||||||
| 718 | pages while playing. | ||||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||
| 720 | For more info and examples, | ||||||||||||||||||||||||||||||||||||||||||
| 721 | see http://johan.vromans.org/software/sw_playtab.html . | ||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||
| 723 | B<playtab> is just a trivial wrapper around the App::Music::PlayTab module. | ||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||
| 725 | =head1 COMMAND LINE OPTIONS | ||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||
| 727 | =over 8 | ||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||
| 729 | =item B<--transpose> I<amount> | ||||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||
| 731 | Transposes all songs by I<amount>. This can be B<+> or B<-> 11 semitones. | ||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||
| 733 | When transposing up, chords will be represented sharp if necessary; | ||||||||||||||||||||||||||||||||||||||||||
| 734 | when transposing down, chords will be represented flat if necessary. | ||||||||||||||||||||||||||||||||||||||||||
| 735 | For example, chord A transposed +1 will become A-sharp, but when | ||||||||||||||||||||||||||||||||||||||||||
| 736 | transposed -11 it will become B-flat. | ||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||
| 738 | =item B<--output> I<file> | ||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||
| 740 | Designates I<file> as the output file for the program. | ||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||
| 742 | =item B<--lilypond> | ||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||
| 744 | Interpet chord names according to LilyPond syntax. | ||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||
| 746 | =item B<--help> | ||||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||
| 748 | Print a brief help message and exits. | ||||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||
| 750 | =item B<--ident> | ||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||
| 752 | Prints program identification. | ||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||
| 754 | =item B<--verbose> | ||||||||||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||||||||||
| 756 | More verbose information. | ||||||||||||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||||||||||||
| 758 | =item I<file> | ||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||
| 760 | Input file(s). | ||||||||||||||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||||||||||||||
| 762 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||
| 764 | =head1 INPUT SYNTAX | ||||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||
| 766 | The input for playtab is plain ASCII. It contains the chords, the | ||||||||||||||||||||||||||||||||||||||||||
| 767 | division in bars, with optional annotations. | ||||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||
| 769 | An example: | ||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||
| 771 | !t Blue Bossa | ||||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||
| 773 | Bossanova | ||||||||||||||||||||||||||||||||||||||||||
| 774 | = | ||||||||||||||||||||||||||||||||||||||||||
| 775 | | c-9 ... | f-9 ... | d% . g7 . | c-9 ... | | ||||||||||||||||||||||||||||||||||||||||||
| 776 | | es-9 . as6 . | desmaj7 ... | d% . g7 . | c-9 . d% g7 | | ||||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||
| 778 | The first line, '!t' denotes the title of the song. Each song must | ||||||||||||||||||||||||||||||||||||||||||
| 779 | start with a title line. | ||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||
| 781 | The title line may be followed by one or more '!s', subtitles, for | ||||||||||||||||||||||||||||||||||||||||||
| 782 | example to indicate the composer. | ||||||||||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||||||||
| 784 | The text "Bossanova" is printed below the title and subtitle. | ||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||
| 786 | The "=" indicates some vertical space. Likewise, you can use '-' and | ||||||||||||||||||||||||||||||||||||||||||
| 787 | '+' as '=', but with a different vertical spacing. | ||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||
| 789 | The next lines show the bars of the song. In the first bar is the c-9 | ||||||||||||||||||||||||||||||||||||||||||
| 790 | chord (Cminor9), followed by three dots. The dots indicate that this | ||||||||||||||||||||||||||||||||||||||||||
| 791 | chord is repeated for all 4 beats of this bar. In the 3rd bar each | ||||||||||||||||||||||||||||||||||||||||||
| 792 | chord take two beats: d5% (d half dim), a dot, g7 and another dot. | ||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||
| 794 | Run playtab with B<-h> or B<--help> for the syntax of chords. | ||||||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||||||
| 796 | If you use "=" followed by some text, the printout is indented and the | ||||||||||||||||||||||||||||||||||||||||||
| 797 | text sticks out to the left. With this you can tag groups of bars, for | ||||||||||||||||||||||||||||||||||||||||||
| 798 | example the parts of a song that must be played in a certain order. | ||||||||||||||||||||||||||||||||||||||||||
| 799 | For example: | ||||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||
| 801 | !t Donna Lee | ||||||||||||||||||||||||||||||||||||||||||
| 802 | !s Charlie Parker | ||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||
| 804 | Order: A B A B | ||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||
| 806 | = A | ||||||||||||||||||||||||||||||||||||||||||
| 807 | | as . | f7 . | bes7 . | bes7 . | | ||||||||||||||||||||||||||||||||||||||||||
| 808 | | bes-7 . | es7 . | as . | es-7 D7 | | ||||||||||||||||||||||||||||||||||||||||||
| 809 | | des . | des-7 . | as . | f7 . | | ||||||||||||||||||||||||||||||||||||||||||
| 810 | | bes7 . | bes7 . | bes-7 . | es7 . | | ||||||||||||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||||||||||||
| 812 | = B | ||||||||||||||||||||||||||||||||||||||||||
| 813 | | as . | f7 . | bes7 . | bes7 . | | ||||||||||||||||||||||||||||||||||||||||||
| 814 | | c7 . | c7 . | f- . | c7#9 . | | ||||||||||||||||||||||||||||||||||||||||||
| 815 | | f- . | c7 . | f- . | aso . | | ||||||||||||||||||||||||||||||||||||||||||
| 816 | | as f7 | bes-7 es7 | as - | bes-7 es7 | | ||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||
| 818 | To see how this looks, see http://johan.vromans.org/software/sw_playtab.html . | ||||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||
| 820 | You can modify the width of the bars with a '!w' control. Standard | ||||||||||||||||||||||||||||||||||||||||||
| 821 | width of a beat is 30. '!w +5' increases the width to 35. '!w 25' sets | ||||||||||||||||||||||||||||||||||||||||||
| 822 | it to 25. You get the idea. You can also change the height with '!h' | ||||||||||||||||||||||||||||||||||||||||||
| 823 | (default is 15) and margin with '!m' (default width is 40). You can | ||||||||||||||||||||||||||||||||||||||||||
| 824 | restore the margin to its default value with '<'. This will save the | ||||||||||||||||||||||||||||||||||||||||||
| 825 | current settings, and '!m' without argument will restore the saved | ||||||||||||||||||||||||||||||||||||||||||
| 826 | settings. | ||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||
| 828 | You can transpose an individual song with '!x I<amount>', where | ||||||||||||||||||||||||||||||||||||||||||
| 829 | I<amount> can range from -11 to +11, inclusive. A positive transpose | ||||||||||||||||||||||||||||||||||||||||||
| 830 | value will make sharps, a negative value will make flats. | ||||||||||||||||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||||||||||||||||
| 832 | '!n' enables bar numbering. '!n 0' disables numbering, '!n I<n>' | ||||||||||||||||||||||||||||||||||||||||||
| 833 | starts numbering at I<n>. I<n> may be negative, e.g., to skip | ||||||||||||||||||||||||||||||||||||||||||
| 834 | numbering an intro. | ||||||||||||||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||||||||||||
| 836 | '!ly' or '!lilypond' enables LilyPond chord name recognition. If | ||||||||||||||||||||||||||||||||||||||||||
| 837 | followed by a '0', switches to classical chord name syntax. | ||||||||||||||||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||||||||||||||||
| 839 | Look at the examples, that is (currently) the best way to get grip on | ||||||||||||||||||||||||||||||||||||||||||
| 840 | what the program does. | ||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||
| 842 | Oh, I almost forgot: it can print guitar chord diagrams as well. | ||||||||||||||||||||||||||||||||||||||||||
| 843 | See "bluebossa", "sophisticatedlady" and some others. | ||||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||
| 845 | Have fun, and let me know your ideas! | ||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||
| 847 | =head1 INPUT SYNTAX | ||||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||
| 849 | Notes: C, D, E, F, G, A, B. | ||||||||||||||||||||||||||||||||||||||||||
| 850 | Raised with '#' or suffix 'is', e.g. A#, Ais. | ||||||||||||||||||||||||||||||||||||||||||
| 851 | Lowered with 'b' or suffix 's' or 'es', e.g. Bes, As, Eb. | ||||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||
| 853 | Chords: note + optional modifiers. | ||||||||||||||||||||||||||||||||||||||||||
| 854 | Chord modifiers Meaning [examples] | ||||||||||||||||||||||||||||||||||||||||||
| 855 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 856 | nothing major triad [C] | ||||||||||||||||||||||||||||||||||||||||||
| 857 | - or min or m minor triad [Cm Fmin Gb-] | ||||||||||||||||||||||||||||||||||||||||||
| 858 | + or aug augmented triad [Caug B+] | ||||||||||||||||||||||||||||||||||||||||||
| 859 | o or 0 or dim diminished triad [Co D0 Fdim] | ||||||||||||||||||||||||||||||||||||||||||
| 860 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 861 | maj7 major 7th chord [Cmaj7] | ||||||||||||||||||||||||||||||||||||||||||
| 862 | % half-diminished 7 chord [C%] | ||||||||||||||||||||||||||||||||||||||||||
| 863 | 6,7,9,11,13 chord additions [C69] | ||||||||||||||||||||||||||||||||||||||||||
| 864 | sus sus4, sus2 suspended 4th, 2nd [Csus] | ||||||||||||||||||||||||||||||||||||||||||
| 865 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 866 | # raise the pitch of the note to a sharp [C11#9] | ||||||||||||||||||||||||||||||||||||||||||
| 867 | b lower the pitch of the note to a flat [C11b9] | ||||||||||||||||||||||||||||||||||||||||||
| 868 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 869 | no subtract a note from a chord [C9no11] | ||||||||||||||||||||||||||||||||||||||||||
| 870 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 871 | _ may be used to avoid ambiguity, e.g. C_#9 <-> C#9 <-> C#_9 | ||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||
| 873 | Other: Meaning | ||||||||||||||||||||||||||||||||||||||||||
| 874 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 875 | . Chord space | ||||||||||||||||||||||||||||||||||||||||||
| 876 | - Rest | ||||||||||||||||||||||||||||||||||||||||||
| 877 | : Repeats previous chord | ||||||||||||||||||||||||||||||||||||||||||
| 878 | % Repeat | ||||||||||||||||||||||||||||||||||||||||||
| 879 | / Powerchord constructor [D/G D/E-] | ||||||||||||||||||||||||||||||||||||||||||
| 880 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||
| 882 | =head1 LILYPOND INPUT SYNTAX | ||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||
| 884 | Notes: c, d, e, f, g, a, b. | ||||||||||||||||||||||||||||||||||||||||||
| 885 | Raised with suffix 'is', e.g. ais. | ||||||||||||||||||||||||||||||||||||||||||
| 886 | Lowered with suffix 'es', e.g. bes, ees. | ||||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||
| 888 | Chords: note + optional duration + optional modifiers. | ||||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||
| 890 | Duration = 1, 2, 4, 8, with possible dots, e.g., "2.". | ||||||||||||||||||||||||||||||||||||||||||
| 891 | No duration means: use the duration of the previous chord. | ||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||
| 893 | Modifiers are preceeded with a ":". | ||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||
| 895 | Modifiers Meaning [examples] | ||||||||||||||||||||||||||||||||||||||||||
| 896 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 897 | nothing major triad c4 | ||||||||||||||||||||||||||||||||||||||||||
| 898 | m minor triad c4:m | ||||||||||||||||||||||||||||||||||||||||||
| 899 | aug augmented triad c4:aug | ||||||||||||||||||||||||||||||||||||||||||
| 900 | dim diminished triad c4:dim | ||||||||||||||||||||||||||||||||||||||||||
| 901 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 902 | maj major 7th chord c4:maj | ||||||||||||||||||||||||||||||||||||||||||
| 903 | 6,7,9,11,13 chord additions c4:7 c4:6.9 (dot required) | ||||||||||||||||||||||||||||||||||||||||||
| 904 | sus sus4, sus2 suspended 4th, 2nd c4:sus | ||||||||||||||||||||||||||||||||||||||||||
| 905 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 906 | + raise the pitch of an added note c4:11.9+ | ||||||||||||||||||||||||||||||||||||||||||
| 907 | - lower the pitch of an added note c4:11.9- | ||||||||||||||||||||||||||||||||||||||||||
| 908 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 909 | ^ subtract a note from a chord c4:9.^11 | ||||||||||||||||||||||||||||||||||||||||||
| 910 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||||||||||||||||
| 912 | Other: Meaning | ||||||||||||||||||||||||||||||||||||||||||
| 913 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 914 | r Rest r2 | ||||||||||||||||||||||||||||||||||||||||||
| 915 | s Rest s4 | ||||||||||||||||||||||||||||||||||||||||||
| 916 | / Powerchord constructor d/g d/e:m | ||||||||||||||||||||||||||||||||||||||||||
| 917 | -------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 918 | |||||||||||||||||||||||||||||||||||||||||||
| 919 | See also: http://lilypond.org/doc/stable/Documentation/user/lilypond/Chord-names | ||||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||
| 921 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||||
| 923 | http://chordie.sourceforge.net/ | ||||||||||||||||||||||||||||||||||||||||||
| 924 | |||||||||||||||||||||||||||||||||||||||||||
| 925 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||||||||||||||||
| 927 | Johan Vromans, Squirrel Consultancy E<lt>jvromans@squirrel.nlE<gt> | ||||||||||||||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||||||||||||
| 929 | =head1 COPYRIGHT AND DISCLAIMER | ||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||
| 931 | This program is Copyright 1990,2016 by Johan Vromans. | ||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||
| 933 | This program is free software; you may redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||
| 934 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||||||||||||||||
| 936 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||||||||||||||||
| 938 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||