PDL-Audio
view release on metacpan or search on metacpan
bin/pdlaudio-birds view on Meta::CPAN
[1.04,0.1,2100,1700,0.15,[1,0,0,100],[0,0,1,75,0,100]],
[1.15,0.05,5700,400,0.25,[0,0,1,100],[0,0,1,25,1,75,0,100]],
[1.25,0.25,2000,900,0.2,[0,0,0.7,3,0,6,0.75,9,0,12,0.8,15,0.05,18,0.85,21,0.1,24,0.9,27,0.1,30,1,33,0.1,36,1,39,0.1,42,1,45,0.1,48,1,51,0.1,54,1,57,0.1,60,1,63,0.1,66,1,69,0.1,72,1,75,0.1,78,1,81,0.1,84,1,87,0,90,0.95,93,0,96,0.9,100],[0,0,1,25...
[1.52,0.05,5600,400,0.15,[0,0,1,50,0.2,100],[0,0,1,25,1,75,0,100]],
[1.6,0.04,3900,1100,0.15,[0,0,1,100],[0,0,1,25,1,75,0,100]],
[1.66,0.01,1900,100,0.1,[0,0,1,100],[0,0,1,50,0,100]],
[1.69,0.01,3600,300,0.1,[0,0,1,100],[0,0,1,50,0,100]],
[1.71,0.03,3900,1000,0.15,[0,0,1,100],[0,0,1,50,0,100]],
[1.74,0.02,5000,100,0.2,[0,0,1,100],[0,0,1,50,0,100]],
[1.76,0.01,1900,100,0.1,[0,0,1,100],[0,0,1,50,0,100]],
[1.78,0.01,3600,300,0.1,[0,0,1,100],[0,0,1,50,0,100]],
[1.8,0.03,3900,1000,0.15,[0,0,1,100],[0,0,1,50,0,100]],
[1.83,0.02,5000,100,0.2,[0,0,1,100],[0,0,1,50,0,100]],
[1.85,0.01,1900,100,0.1,[0,0,1,100],[0,0,1,50,0,100]],
[1.87,0.01,3600,300,0.1,[0,0,1,100],[0,0,1,50,0,100]],
[1.89,0.03,3900,1000,0.15,[0,0,1,100],[0,0,1,50,0,100]],
[1.92,0.02,5000,100,0.2,[0,0,1,100],[0,0,1,50,0,100]],
[1.94,0.01,1900,100,0.1,[0,0,1,100],[0,0,1,50,0,100]],
[1.96,0.01,3600,300,0.1,[0,0,1,100],[0,0,1,50,0,100]],
[1.98,0.03,3900,1000,0.15,[0,0,1,100],[0,0,1,50,0,100]],
[2.01,0.02,5000,100,0.2,[0,0,1,100],[0,0,1,50,0,100]],
[2.03,0.01,1900,100,0.1,[0,0,1,100],[0,0,1,50,0,100]],
[2.05,0.01,3600,300,0.1,[0,0,1,100],[0,0,1,50,0,100]],
[2.07,0.03,3900,1000,0.15,[0,0,1,100],[0,0,1,50,0,100]],
[2.1,0.02,5000,100,0.2,[0,0,1,100],[0,0,1,50,0,100]],
[2.13,0.01,1900,100,0.1,[0,0,1,100],[0,0,1,50,0,100]],
[2.16,0.03,3800,300,0.1,[0,0,1,100],[0,0,1,25,1,75,0,100]],
],
'black-chinned-sparrow' => [
[0.6,0.2,4200,100,0.1,[0,0,1,100],[0,0,1,25,1,75,0,100]],
[1,0.09,3800,2000,0.1,[0,0,0.2,30,1,100],[0,0,1,25,1,75,0,100]],
[1.25,0.08,3900,1700,0.12,[0,0,0.2,30,1,100],[0,0,1,25,1,75,0,100]],
[1.4,0.08,3600,2300,0.13,[0,0,1,100],[0,0,1,25,1,75,0,100]],
[1.5,0.11,3100,2800,0.14,[0,0,1,100],[0,0,1,25,1,75,0,100]],
[1.65,0.07,2900,2700,0.15,[0,0,1,100],[0,0,1,25,1,75,0,100]],
[1.74,0.07,2900,2700,0.15,[0,0,1,100],[0,0,1,25,1,75,0,100]],
[1.82,0.07,3000,2300,0.13,[0,0,1,100],[0,0,1,25,1,75,0,100]],
[1.89,0.07,3200,2000,0.1,[0,0,1,100],[0,0,1,25,1,75,0,100]],
[1.97,0.05,3200,1500,0.1,[0,0,1,100],[0,0,1,25,1,75,0,100]],
[2.04,0.04,3400,1000,0.07,[0,0,1,100],[0,0,1,25,1,75,0,100]],
[2.1,0.03,3600,700,0.05,[0,0,1,100],[0,0,1,25,1,75,0,100]],
[2.15,0.03,3800,300,0.05,[0,0,1,100],[0,0,1,25,1,75,0,100]],
[2.19,0.02,3900,100,0.03,[0,0,1,100],[0,0,1,25,1,75,0,100]],
[2.22,0.01,3900,100,0.01,[0,0,1,100],[0,0,1,25,1,75,0,100]],
[2.24,0.01,3900,100,0.01,[0,0,1,100],[0,0,1,25,1,75,0,100]],
],
'various-gull-cries-from-end-of-colony-5' => [
[0.25,0.8,1180,1180,0.08,[0,0,1,5,0.5,10,0.4,90,0,100],[0,0,1,25,1,75,0,100],[1,0.1,2,1,3,0.1,4,0.01,5,0.09,6,0.01,7,0.01]],
[1.5,0.9,1180,1180,0.07,[0,0,1,5,0.5,10,0.4,90,0,100],[0,0,1,25,1,75,0,100],[1,0.1,2,1,3,0.1,4,0.01,5,0.09,6,0.01,7,0.01]],
[2.75,1,1050,1050,0.08,[0,0,1,5,0.5,10,0.4,90,0,100],[0,0,1,25,1,75,0,100],[1,0.1,2,1,3,0.1,4,0.01,5,0.09,6,0.01,7,0.01]],
[4.8,0.05,1180,1180,0.06,[0,0,1,10,0.5,20,0.6,40,0.5,60,0,100],[0,0,1,25,1,75,0,100],[1,0.1,2,1,3,0.1,4,0.01,5,0.09,6,0.01,7,0.01]],
[4.95,0.1,1180,1180,0.08,[0,0,1,10,0.5,20,0.6,40,0.5,60,0,100],[0,0,1,25,1,75,0,100],[1,0.1,2,1,3,0.1,4,0.01,5,0.09,6,0.01,7,0.01]],
[5.15,0.1,1180,1180,0.09,[0,0,1,10,0.5,20,0.6,40,0.5,60,0,100],[0,0,1,25,1,75,0,100],[1,0.1,2,1,3,0.1,4,0.01,5,0.09,6,0.01,7,0.01]],
[5.35,0.1,1180,1180,0.1,[0,0,1,10,0.5,30,0.5,80,0,100],[0,0,1,25,1,75,0,100],[1,0.1,2,1,3,0.1,4,0.01,5,0.09,6,0.01,7,0.01]],
[5.45,0.4,1050,1050,0.1,[0,0,1,5,0.5,10,0.4,90,0,100],[0,0,1,25,1,75,0,100],[1,0.1,2,1,3,0.1,4,0.01,5,0.09,6,0.01,7,0.01]],
[6.25,0.8,1050,1050,0.1,[0,0,1,5,0.5,10,0.4,90,0,100],[0,0,1,25,1,75,0,100],[1,0.1,2,1,3,0.1,4,0.01,5,0.09,6,0.01,7,0.01]],
[7.45,1.8,1050,1050,0.1,[0,0,1,5,0.5,10,0.4,90,0,100],[0,0,1,25,1,75,0,100],[1,0.1,2,1,3,0.1,4,0.01,5,0.09,6,0.01,7,0.01]],
],
};
sub hz(){ 44100 }
sub bird {
my ($dur, $freq, $skew, $amp, $freqenv, $ampenv, $partials) = @_;
$freqenv = gen_env $dur, @$freqenv;
$ampenv = gen_env $dur, @$ampenv;
my $os = gen_oscil $dur, $freq, 0, $freqenv*$skew;#*PDL::Audio::PI2;
$os = pdl($partials)->partials2polynomial(1)->polynomial($os) if defined $partials;
$os*$ampenv;
}
sub shuffle($) { # (x y x y ... => ((x y) (x y) ...
my $xy = pdl $_[0]; [$xy->slice("1:-1:2"), $xy->slice("0:-1:2")];
}
sub gen_bird {
my @mix;
for (@{+shift}) {
my ($beg, $dur, $freq, $skew, $amp, $freqenv, $ampenv, $partials) = @$_;
$partials = pdl($partials)->slice("1:-1:2") if $partials;
push @mix, ($beg*hz, bird(hz*$dur, $freq/hz, $skew/hz, $amp, shuffle $freqenv, shuffle $ampenv, $partials));
PDL::Graphics::PGPLOT::line ($mix[-1]) if $PGPLOT;
}
audiomix @mix;
}
$| = 1;
for (keys %$birds) {
print $_;
$chirp = (gen_bird $birds->{$_})->cut_leading_silence(0);
PDL::Graphics::PGPLOT::line ($chirp) if $PGPLOT;
print "\n";
scale2short($chirp)->playaudio(rate => hz);
}
( run in 1.110 second using v1.01-cache-2.11-cpan-b301d465b3d )