Tools::FadesSection: User Contributed Perl Documentation (3)Updated: 1999-01-04 |
Tools::FadesSection: User Contributed Perl Documentation (3)Updated: 1999-01-04 |
use Audio::Tools::Fades;
my $up_to = 5;
my @names = qw( in out );
my $volume = 1;
my $fades = new Audio::Tools::Fades;
foreach my $type ( qw( linear exp invexp trig invtrig ) ) {
for my $direction ( 0, 1 ) {
my $fade = $fades -> fade( $up_to, $direction, $type );
print "fade $names[$direction] type: $type;\n\t";
for my $sample ( 0 .. $up_to ) {
printf ' %2d->%2.2f', $sample, &$fade( $sample, $volume );
}
print "\n";
}
}
Audio::Mix
my $fades = new Audio::Tools::Fades;
my $fade = $fades -> fade( $length, $direction, $type );
for my $sample ( 0 .. $length ) {
printf ' %2d->%2.2f', $sample, &$fade( $sample, 1 );
}
print "\n";
Where;
$length = length of fade
$direction = 0 for in, 1 for out
$type is one of;
linear = smooth gradient
exp = exponential (gets loud quickly)
invexp = inverse exponential (gets loud slowly)
trig = trigonomic, roughly in between linear & exp
invtrig = inverse trigonomic