NAME
Peta::MP3::Encode::Psy - how much noise a granule's bands can take
VERSION
version 0.2610180
SYNOPSIS
my $psy = Peta::MP3::Encode::Psy->new(44100);
my $allowed = $psy->allowed($xr, $block_type); # per band (and window)
my ($early, $late) = $psy->attack(\@left, \@right); # a granule's samples
DESCRIPTION
A simple psychoacoustic model on the granule's own frequency lines: the bands' energies spread over the Bark scale, an offset below them, the threshold of hearing in quiet as the floor; and an attack detector that says where short blocks are needed.
METHODS
new
new($rate): a model for a sample rate, with no granule before.
allowed
allowed($xr, $type): the noise each band of a granule's lines may take: one per long band; in a short block one per band and window (3 b + w).
attack
Whether a granule's samples (one array per channel) have an attack: two answers, early in the granule (its first 192 samples: short granule k's own) and later (the next granule's, as the filterbank delays the sound). Called once per granule, in order.
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.