Math::SegmentedEnvelope

Create/manage/evaluate segmented (curved) envelope
Download

Math::SegmentedEnvelope Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Egor Korablev
  • Publisher web site:
  • http://search.cpan.org/~egor/

Math::SegmentedEnvelope Tags


Math::SegmentedEnvelope Description

Math::SegmentedEnvelope is a Perl module that gives abstraction of segmeneted envelope. You can create, modify and make static evaluators, which is faster than object method at calling.SYNOPSIS my $e = Math::SegmentedEnvelope->new; # creates random envelope with total duration = 1 $e->segments; # number of segments $e->levels(map $_ * 3, $e->levels); # alter levels $e->durs(map $_ * (rand(0.5) + 0.5), $e->durs); # alter segments durations $e->curves(map $_ + 1, $e->curves); # alter curves $e->level( # alter start level of first segment and set it value to end level of last segment $self->segments, $e->level(0, $self->level(0) - 1) ); $e->curve(0, 3); # set curvative for first segment $e->dur(0, 0.2); # set duration of first segment, so overall duration will changed $e->duration; # get it $e->normalize_duration; # scale segment durs so envelope duration will be 1or my $e = Math::SegmentedEnvelope->new( # creates custom adsr envelope # def => , # levels , # segment duration # segment curvative, 0 for flat, 1 for linear and other for curved ], is_morph => 1, # default is 0, smooth envelope with default value morpher inside segment # morpher => sub { ... } # provide custom morpher which will recieve values from 0 to 1, and should return values from 0 to 1 for non-breaking envelope is_hold => 0, # default is 0, will return boundary levels for positions out of envelope duration is_fold_over => 1, # default is 0, will fold envelope instead of wraping for positions out of envelope duration is_wrap_neg => 1, # default is 0, will wrap envelope insted of fold for negative positions ); $e->at(rand); # outputs value at random position $e->table(1024); # returns list of values(lookup table) for current envelope with specified size my $s = $e->static; # creates static evaluator with current envelope parameters (coderef) $s->(rand); # outputs value at random position, but ~ 50% fasterProduct's homepage


Math::SegmentedEnvelope Related Software