App-MusicTools

 view release on metacpan or  search on metacpan

bin/canonical  view on Meta::CPAN

        while (@$new) {
            say join( ' ',
                $Flag_Map ? shift @$orig : (),
                grep { defined } shift @$new,
                shift @$rest );
        }
    } else {
        print join( ' ', @$new ), "\n";
    }
}

__END__

=head1 NAME

canonical - compute canon voices via the Music::Canon module

=head1 SYNOPSIS

  $ canonical --contrary --retrograde exact c cis d
  $ canonical --transpose=12 exact c ees g
  $ canonical --raw --contrary exact 1 2 3

  $ canonical modal --input=lydian --output=locrian c e g

Raw pitch numbers or lilypond note names (though only in the default
"nederlands" language) are accepted. Consult the C<lilypond> "Notation
Reference" section "Note names in other languages" for the syntax.

=head1 DESCRIPTION

Command line interface to the mapping methods present in the
L<Music::Canon> module. Certain questions might be better answered by
coding directly against L<Music::Canon>; see the C<eg/> directory under
the distribution of that Perl module for examples.

Note that input via the command line is handled differently from notes
supplied via standard input; in the first case, all of the input is
considered to be notes. In the second case, only the first column
(delimited by a space) is considered to be note material, and the other
columns should be passed through unchanged.

  $ echo 42 cat | canonical exact --transpose=a
  a cat

=head1 GLOBAL OPTIONS

This program currently supports the following global command line
switches. These can also be specified to the underlying modes.

=over 4

=item B<--contrary> | B<-c> | B<--nocontrary>

Whether to compute the output line in contrary motion or not (default
is not to).

=item B<--duration>=I<value>

Set the default duration for rhythm handling (C<4> by default). Rhythm
handling should be transparent, though does not extend to tied notes,
triplet groups, or grace notes.

=item B<--flats> B<--noflats>

Print notes with flats instead of sharps.

=item B<--help>

Emits help and exits the program.

=item B<--map> B<--nomap>

Whether to show the original input pitch numbers or note names one per
line alongside the corresponding output pitch number or note name.
Disabled by default.

=item B<--raw> B<--noraw>

Whether to emit output in raw pitch numbers (default is to emit lilypond
note names).

=item B<--relative>=I<lilypond_note>

Use relative mode in L<Music::LilyPondUtil> and make the input notes
relative to the specified note. Without this option, the assumption is
that the lilypond input is specified in absolute form:

  g d\'             # MIDI pitches 55 62 (absolute)
  --rel=g\' g d\'   # MIDI pitches 67 74 (relative to g' or 67)

=item B<--retrograde> | B<-r> | B<--noretrograde>

Whether to reverse the output phrase or not. (Default is not to.)

=item B<--transpose>=I<pitch_or_lilypond_note> | B<-t>=...

Transpose to the first note of the output phrase by the specified amount
in semitones (integer) or to the specified lilypond note name. (Default
is no transposition.)

=back

=head1 MODES

=head2 EXACT

Exact interval canon computation. No new options beyond the global ones
listed above.

  $ canonical exact --transpose=e c e g

=head2 MODAL

Modal interval canon computation. In addition to the global options
listed above, accepts:

=over 4

=item B<--chrome>=I<troolean>



( run in 2.190 seconds using v1.01-cache-2.11-cpan-0d23b851a93 )