Audio
view release on metacpan or search on metacpan
Data/Data.pm view on Meta::CPAN
Returns a list of two values representing the limits of the values
between the two times if $end_time isn't specified it defaults to
the duration of the object, and if start time isn't specified it defaults
to zero.
=item $copy = $audio->clone
Creates copy of data carrying over sample rate and complex-ness of data.
=item $slice = $audio->timerange($start_time,$end_time);
Returns a time-slice between specified times.
=item $audio->Load($fh)
Reads Sun/NeXT .au data from the perl file handle (which should
have C<binmode()> applied to it.)
This will eventually change - to allow it to load other formats
and perhaps to return list of Audio::Data objects to represnt
Data/Data.xs view on Meta::CPAN
CODE:
{
SV *result = Nullsv;
Audio *rau = Audio_new(aTHX_ &result,au->rate,au->flags,0,AUDIO_CLASS(ST(0)));
Audio_append_sv(aTHX_ rau, ST(0));
ST(0) = result;
XSRETURN(1);
}
void
Audio_timerange(Audio *au, float t0, float t1)
CODE:
{
SV *result = Nullsv;
UV samples = Audio_samples(au);
UV start = au->rate*t0;
UV end = au->rate*t1+0.5;
Audio *rau = Audio_new(aTHX_ &result,au->rate,au->flags,end-start,AUDIO_CLASS(ST(0)));
if (start < samples)
{
float *d = AUDIO_DATA(rau);
Tk/Scope.pm view on Meta::CPAN
}
sub audio
{
my ($sc,$t1,$t2,@tr) = @_;
(@tr) = keys %{$sc->{trace}} unless @tr;
my @result;
foreach my $tr (@tr)
{
my $data = $sc->{trace}{$tr}->timerange($t1,$t2);
return $data unless wantarray;
push @result,$data;
}
return @result;
}
sub Redisplay
{
my ($sc,$why) = @_;
delete $sc->{redisplay};
$au->length($FFT_SIZE);
my $filter = Audio::Filter::FIR->new(rate => $rate);
$filter->data(@a);
$filter->[0] = 1;
$filter->length(2*$n+1);
my $response = Audio::Data->new(rate => $rate);
$response .= $filter->process($au);
my $dur = $response->duration/2;
$voice->configure(-start => 0, -end => $dur, -xmax => $dur, -yscale => undef);
$voice->traceconfigure($t_inv,-data => $response->timerange($dur,2*$dur));
# my $fresp = $response->fft($FFT_SIZE);
# $fresp->length($FFT_SIZE/2);
# $xfrm->traceconfigure($t_aux,-data => $fresp, -state => 'normal');
}
sub impulse
{
my $lpc = shift;
my $rate = $lpc->rate;
my @a = $lpc->data;
( run in 1.030 second using v1.01-cache-2.11-cpan-49f99fa48dc )