NAME
Peta::Vorbis::Encode - Ogg Vorbis encoder
VERSION
version 0.2610180
SYNOPSIS
use Peta::Vorbis::Encode;
my $ogg = Peta::Vorbis::Encode->new(rate => 48000, channels => 2, quality => 5);
print $fh $ogg->encode(\@left, \@right); # samples -1 .. 1, as many as you like
print $fh $ogg->finish;
DESCRIPTION
Encodes samples into an Ogg Vorbis stream: a variable bitrate by quality (0 to 10), floor 1, residue 1 with this encoder's own codebooks, long blocks, and short ones around attacks.
METHODS
new
Peta::Vorbis::Encode->new(
rate => 44100,
channels => 2,
quality => 5, # 0 .. 10
mdct => 'auto', # perl, pdl, auto
serial => undef, # the Ogg stream's serial number; random by default
count => 0,
);
mdct auto uses PDL where it is installed: the same coefficients, faster. With count => 1 the encoder counts how often each codebook entry is written (see counts), which is how devbin/vorbis-train makes the weights.
encode
my $bytes = $ogg->encode(\@left, \@right);
Returns the pages these samples complete; the headers come with the first call.
finish
Returns the rest, the last page marking the end of the stream and the number of samples.
quality, packets, bytes, shorts
The quality; the audio packets, bytes and short blocks so far.
counts
With count => 1: how often each codebook's entries were written, by book.
mdct
Which MDCT the encoder uses: perl or pdl.
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.