NAME

Peta::Vorbis::Encode::MDCT - Vorbis' MDCT through an FFT

VERSION

version 0.2610180

SYNOPSIS

my $mdct = Peta::Vorbis::Encode::MDCT->new(2048, $scale);
my $w    = Peta::Vorbis::Encode::MDCT::window(2048);
my $x    = $mdct->transform(\@samples, $w);    # 1024 coefficients
my ($l, $r) = $mdct->transform_all([ \@left, \@right ], $w);

DESCRIPTION

The modified DCT of Vorbis I, as a DCT-IV through a complex FFT of a quarter of the block, its coefficients scaled by $scale. Peta::Vorbis::Encode::MDCT::PDL computes the same with PDL::FFT.

METHODS

new

new($n, $scale = 1): the transform of blocks of $n samples.

transform, transform_all

transform(\@x, $w): the $n / 2 coefficients of a block of $n samples, windowed with $w; transform_all(\@channels, $w): those of each channel's block, one array reference each.

FUNCTIONS

window

window($n, $left = $n, $right = $n): the window of a block of $n, its slopes sin(pi/2 sin^2((t + 1/2) / n pi)) as wide as the blocks it laps on each side (narrower next to short blocks).

pre_angles, post_angles

The angles of the DCT-IV's pre- and post-rotations for a block of $n, $n / 4 of each.

AUTHOR

PetaMem s.r.o. <info@petamem.com>

COPYRIGHT

Copyright (c) 2026 PetaMem s.r.o.

LICENSE

This package is free software, dual-licensed under the Artistic License 2.0 and the BSD 2-Clause License. See the LICENSE file of the distribution.