App-MusicTools

 view release on metacpan or  search on metacpan

bin/atonal-util  view on Meta::CPAN

        'pitchset|P=s' => \my @base_input,
        'root=s'       => \my $root_pitch
    ) or print_help();

    die "error: atonal-util findin needs --pitchset=... option\n"
      unless @base_input;

    $Lyu->chrome('flats') if $Flag_Flat;

    for my $bi (@base_input) {
        say "PS $bi" if @base_input > 1;

        my $ps_base;
        if ( $bi =~ m/^\d-/ ) {
            $ps_base = $Atu->forte2pcs($bi);
            die "unknown Forte Number '$bi'\n" if !defined $ps_base;
        } else {
            $ps_base = args2pitchset( split /[ ,]/, $bi );
        }
        my $desired = args2pitchset(@args);
        my %excludes;

bin/atonal-util  view on Meta::CPAN

            my $tstr = '';
            if ($Flag_Tension) {
                $tstr = sprintf "\t%.03f  %.03f  %.03f", $Tension->vertical( \@pitches );
            }

            @pitches = $Lyu->p2ly(@pitches) if $Flag_Lyout;

            my $s = sprintf "%s\tT(%d)\t%-${ps_width}s%s", $fnum, $i,
              join( ',', @pitches ), $tstr;
            $s =~ s/\s+$//;
            say $s;
        }
    }

  TRANSINV: for my $i ( 0 .. $Atu->scale_degrees - 1 ) {
        my %ips;
        @ips{ @{ $Atu->transpose_invert( $i, 0, $ps_base ) } } = ();
        if ( all { exists $ips{$_} } @$desired ) {
            my @pitches = @{ $Atu->transpose_invert( $i, 0, $ps_base ) };
            next if defined $root_pitch and $pitches[0] != $root_pitch;
            if (%$excludes) {

bin/atonal-util  view on Meta::CPAN

            my $tstr = '';
            if ($Flag_Tension) {
                $tstr = sprintf "\t%.03f  %.03f  %.03f", $Tension->vertical( \@pitches );
            }

            @pitches = $Lyu->p2ly(@pitches) if $Flag_Lyout;

            my $s = sprintf "%s\tTi(%d)\t%-${ps_width}s%s", $fnum, $i,
              join( ',', @pitches ), $tstr;
            $s =~ s/\s+$//;
            say $s;
        }
    }
}

sub fnums {
    my (@args) = @_;
    GetOptionsFromArray( \@args, @Std_Opts ) or print_help();
    _init_tension('cope') if $Flag_Tension;

    my $fns = $Atu->fnums;

bin/atonal-util  view on Meta::CPAN

        my $icc  = $Atu->interval_class_content($pset);

        my $tstr = '';
        if ($Flag_Tension) {
            $tstr = sprintf "\t%.03f  %.03f  %.03f", $Tension->vertical($pset);
        }

        my $s = sprintf "%s\t%-16s\t%-8s%s", $fn, join( ',', @$pset ),
          join( '', @$icc ), $tstr;
        $s =~ s/\s+$//;
        say $s;
    }
}

sub forte2pcs {
    my (@args) = @_;
    GetOptionsFromArray( \@args, @Std_Opts ) or print_help();

    emit_pitch_set( $Atu->forte2pcs( $args[0] ), rs => $Flag_Record_Sep );
}

bin/canonical  view on Meta::CPAN

    my ( $is_multicolumn, $orig, $new, $rest ) = @_;

    $is_multicolumn = 1 if $Flag_Map;

    # As a not-compatible change, this *always* used to emit space-
    # delimited values though for multicolumness (and to avoid a
    # subsequent `tr ' ' '\n'`) switched output to be delimited by
    # newlines.
    if ($is_multicolumn) {
        while (@$new) {
            say join( ' ',
                $Flag_Map ? shift @$orig : (),
                grep { defined } shift @$new,
                shift @$rest );
        }
    } else {
        print join( ' ', @$new ), "\n";
    }
}

__END__

bin/ly-fu  view on Meta::CPAN

);
$tmp_ly->print($lilypond_input);
$tmp_ly->flush;
$tmp_ly->sync;

my $ly_filename = $tmp_ly->filename;
( my $score_filename = $ly_filename ) =~ s/\.ly/\.pdf/;
( my $midi_filename  = $ly_filename ) =~ s/\.ly/\.midi/;
close $tmp_ly;

say $ly_filename if $Flag_Generate_Score;

# lilypond is noisy by default
my ( $stdout, $stderr, $status ) = capture {
    system @Lilypond_Cmd, $ly_filename;
};
if ( $status != 0 ) {
    print STDERR $stderr;
    exit 1;
}
print STDERR $stderr if $Flag_Verbose;

bin/scalemogrifier  view on Meta::CPAN

  aeolian amdorian dorian hminor hunminor ionian locrian lydian
  major minor mixolydian mminor phrygian

=head1 DESCRIPTION

Generates notes of arbitrary scales (subsets of the Western 12-tone
chromatic system) from a specified starting note in a specified
direction and so forth from other options.

The output is in lilypond absolute format. The default scale is The
Major Scale, but that's easy to adjust to say C Minor:

  $ scalemogrifier --minor --flats

By default, scales loop back to the starting note. If this is not the
case, suffix C<nl> to a custom interval series:

  $ scalemogrifier --intervals=c,cis,dis,e,g,nl --length=15
  c cis dis e g gis ais b d' dis' f' fis' a' ais' c''

The output is based on the assumption that C<c> equals 0. The output

bin/vov  view on Meta::CPAN

########################################################################
#
# SUBROUTINES

# Given root scale degree plus a chord factor, returns an array
# reference of scale degrees of the chord elements up to the
# chord factor.
sub build_triad_degrees {
    my ( $root_sd, $factor ) = @_;
    if ( defined $factor ) {
        $factor =~ tr/0-9//cd;    # so can say "5th" or "7th" or the like
        if ( $factor < 1 or $factor > $MAX_CHORD_FACTOR or $factor % 2 == 0 ) {
            croak "factor must be odd number between 1 and $MAX_CHORD_FACTOR inclusive";
        }
    } else {
        $factor = $DEFAULT_CHORD_FACTOR;
    }

    if ( !defined $root_sd or $root_sd < 0 or $root_sd >= $MAX_SCALE_DEGREE ) {
        croak "root scale degree must be 0 to "
          . ( $MAX_SCALE_DEGREE - 1 )



( run in 1.667 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )