Subject: | off by one max value in Audio::Wav::Write usage example |
Date: | Sat, 1 May 2010 08:05:16 -0700 (PDT) |
To: | bug-Audio-Wav [...] rt.cpan.org |
From: | Sergei Steshenko <sergstesh [...] yahoo.com> |
Hello,
looking at
http://search.cpan.org/~brianski/Audio-Wav-0.11/Wav/Write.pm
I see:
my $max_no = ( 2 ** $bits_sample ) / 2;
.
Well, it should really be
my $max_no = ( 2 ** $bits_sample ) / 2 - 1;
- this is because for, say, 16 bit WAV file/signed integer the range is
-32768 .. 32767, so that '32767' rather than 32768 is the reason for
subtracting 1.
Thanks,
Sergei.