App-MusicTools
view release on metacpan or search on metacpan
next if $i < 0 or $i > $#pset;
if ( $i > 0 ) {
# KLUGE skip alteration if already applied by the scale in
# question (e.g. don't flatten 3rd of "i" in c-minor as will
# already be a minor 3rd). Better implementation might just deal
# with major vs. minor 3rds, and stack those up?
next
if $alterations->{$i} == -1
and ( $pset[$i] - $pset[ $i - 1 ] ) % $DEG_IN_SCALE == 3;
next
if $alterations->{$i} == 1
and ( $pset[$i] - $pset[ $i - 1 ] ) % $DEG_IN_SCALE == 4;
}
$pset[$i] += $alterations->{$i};
}
for my $p (@pset) {
$p += $transpose;
$p %= $DEG_IN_SCALE;
}
return \@pset;
}
END {
# Report problems when writing to stdout (perldoc perlopentut)
unless ( close(STDOUT) ) {
warn "error: problem closing STDOUT: $!\n";
exit 74;
}
}
__END__
=head1 NAME
vov - chord generation from roman numerals with sub-phrase support
=head1 SYNOPSIS
$ vov --outputtmpl='<%{chord}> \t% %{vov}' I IV/IV V7/IV IV V7 I
<c e g> % I
<b dis f> % IV/IV
<c e g b> % V7/IV
<f a c> % IV
<g b d f> % V7
<c e g> % I
=head1 DESCRIPTION
Musical V/V utility, for arbitrary "chord X relative to Y as tonic in
key Z" type calculations (V/V are called "applied dominants" among
various other names). Any scale degree can be used, e.g. the phrase with
a sub-phrase relative to IV "I IV/IV V/IV IV V I" says tonic (C),
subdominant of the subdominant (B of F), dominant of the subdominant (C
of F), and then subdominant (F), dominant (G) and back to the tonic.
The input format is based somewhat upon "Roman Numeral Analysis" and
other musical sources, with some tweaks for Unix command line input
needs. The output is somewhat suitable for input to lilypond, e.g. via
C<vov ... | ly-fu -> though can be adjusted by various options.
=head1 INPUT FORMAT
Supported input must be a roman numeral (I..VII and i..vii), possibly
prefixed with C<#> or C<b> to sharpen or flatten the root pitch,
possibly suffixed with C<+> to augment or C<*> to diminish or C<**> to
double diminish, possibly suffixed with an integer specifying the chord
factor or inversion:
V5 V6 V64 # Dominant fifth and inversions (or also Va, Vb, Vc)
V7 V65 V42 V2 # Dominant seventh and inversions (V7a, V7b, V7c, V7d)
bII6 # Neapolitan 6th
Use C</> to delimit chord-X-of-Y, to arbitrary depth (depending on
available memory, but going beyond 12 is silly):
$ vov V/V/V/V/V/V/V/V/V/V/V/V/V
g b d
=head1 OPTIONS
This program currently supports the following command line switches:
=over 4
=item B<--factor>=I<positive odd integer>
Specify default chord factor (odd integer between 1 for just the
fundamental and 13 for thirteenth chords, inclusive). Default is to
generate 5th chords; C<7> would get seventh chords.
$ vov --factor=7 II V I
d fis a c
g b d f
c e g b
=item B<--flats> | B<--noflats>
Use flats instead of sharps in the output note names. Prefix with no to
disable flats, in the event an alias has set them on by default.
=item B<--help>
Displays help and exits program.
=item B<--listmodes>
List available named scale modes and then exit. Used by ZSH compdef
script. The scales listed are a subset of what L<Music::Scales> offers.
=item B<--minor>
Use C<minor> mode (default is C<major>).
=item B<--mode>=I<mode>
Specify named scale mode instead of using B<--intervals>. Some modes
can be listed with the B<--listmodes> option; see L<Music::Scales> for
the complete list. Only ascending versions of scales are available at
this time.
=item B<--natural>
( run in 0.786 second using v1.01-cache-2.11-cpan-13bb782fe5a )