Changeset 22121 for lang/perl/Music-AutoPhrase
- Timestamp:
- 10/26/08 01:10:54 (5 years ago)
- Location:
- lang/perl/Music-AutoPhrase/trunk
- Files:
-
- 3 added
- 5 modified
-
MANIFEST (modified) (1 diff)
-
lib/Music/AutoPhrase.pm (modified) (1 diff)
-
lib/Music/AutoPhrase/BeatPattern.pm (modified) (2 diffs)
-
lib/Music/AutoPhrase/Note.pm (modified) (2 diffs)
-
lib/Music/AutoPhrase/NoteSelector (added)
-
lib/Music/AutoPhrase/NoteSelector.pm (modified) (3 diffs)
-
lib/Music/AutoPhrase/NoteSelector/Simple.pm (added)
-
t/30_selector_simple.t (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Music-AutoPhrase/trunk/MANIFEST
r21910 r22121 4 4 README 5 5 lib/Music/AutoPhrase.pm 6 lib/Music/AutoPhrase/Track.pm 7 lib/Music/AutoPhrase/BeatPattern.pm 8 lib/Music/AutoPhrase/NoteSelector.pm 9 lib/Music/AutoPhrase/Note.pm 10 lib/Music/AutoPhrase/NoteSelector/Simple.pm 6 11 lib/Music/AutoPhrase/Channel.pm 7 lib/Music/AutoPhrase/Track.pm8 12 lib/Music/AutoPhrase/Code.pm 9 lib/Music/AutoPhrase/ BeatPattern.pm13 lib/Music/AutoPhrase/Constants.pm 10 14 t/00_load.t 11 15 t/10_code.t 16 t/10_constants.t 12 17 t/11_beatpattern.t 18 t/12_channel.t 19 t/13_selector_base.t 20 t/14_note.t 21 t/30_selector_simple.t 22 -
lang/perl/Music-AutoPhrase/trunk/lib/Music/AutoPhrase.pm
r21910 r22121 6 6 our $VERSION = '0.01'; 7 7 8 =head1 NAME 9 10 Music::AutoPhrase - library for "code-base" music composition 11 12 =head1 SYNOPSIS 13 14 =head1 DESCRIPTION 15 16 =cut 17 8 18 1; 9 19 -
lang/perl/Music-AutoPhrase/trunk/lib/Music/AutoPhrase/BeatPattern.pm
r22091 r22121 81 81 foreach $char (@$beat_array) { 82 82 if ($is_first) { 83 push @cnt_array, $char; 83 84 $is_first = 0; 84 85 next; … … 94 95 } 95 96 push @dur_array, ($dur + 1) if $dur; 96 push @cnt_array, $char if $dur ;97 push @cnt_array, $char if $dur && defined $char; 97 98 98 99 # push last bit 99 100 if ($beat_array->[-1] =~ /$on_regexp/) { 100 101 push @dur_array, 1; 101 push @cnt_array, $char ;102 push @cnt_array, $char if defined $char; 102 103 } 103 104 -
lang/perl/Music-AutoPhrase/trunk/lib/Music/AutoPhrase/Note.pm
r22091 r22121 20 20 is_valid_note_num 21 21 is_valid_duration 22 note_uniq 22 23 /; 23 24 … … 45 46 return 1 if $duration > 0 && $duration <= BEAT_LENGTH; 46 47 return; 48 } 49 50 sub note_uniq { 51 my @notes = @_; 52 53 my (@buff, %seen); 54 foreach my $note (@notes) { 55 my $str = $note->as_string(); 56 next if defined $seen{$str}; 57 $seen{$str} = 1; 58 59 push @buff, $note; 60 } 61 return @buff; 47 62 } 48 63 -
lang/perl/Music-AutoPhrase/trunk/lib/Music/AutoPhrase/NoteSelector.pm
r22091 r22121 17 17 18 18 sub extract { 19 my ($self, $codes, $ bp) = @_;19 my ($self, $codes, $octav_range, $bp) = @_; 20 20 21 21 if (ref($codes) ne 'ARRAY') { … … 37 37 my $count = shift @count; 38 38 39 push @notes, $self->pickup($code, $dur, $count); 39 push @notes, [$self->select_note( 40 $code, $octav_range, $dur, $count)]; 40 41 $cursor += $dur; 41 42 } … … 43 44 } 44 45 46 sub pickup { 47 die "you must define pickup() in your subclass"; 48 } 45 49 46 50 1;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)