Package: libaudiofile0 Version: 0.2.6-6 Severity: normal Depending on the size of the WAV file, audiofile is not able to re-read the just created WAV file. I believe this is due to an invalid header.
Please see the attached program which is derived from test/writewave.c. Note that I'm no expert w.r.t. to WAV files or audiofile. Please let me know if I do not use audiofile in a correct way. $ ./bug test.wav 33554434 Audio File Library: WAVE header ended unexpectedly [error 62] $ ./bug test.wav 33554438 Audio File Library: file missing data -- read 16777219 frames, should be 16777220 [error 5] $ ./bug test.wav 67108866 Audio File Library: WAVE header ended unexpectedly [error 62] $ ./bug test.wav 67108868 Audio File Library: WAVE header ended unexpectedly [error 62] $ ./bug test.wav 67108870 Audio File Library: file missing data -- read 33554435 frames, should be 33554436 [error 5] $ Note that the given numbers are just a few bytes larger than powers of two. shninfo reports "inconsistent header", flac complains about too less samples. This problem also affects normalize-audio (bug #442433 lead to the discovery of this bug). As you can see in #442433 the problem can lead to data loss, hence you might want to consider to raise the severity to important. Kind regards, Joachim -- System Information: Debian Release: 4.0 APT prefers stable APT policy: (800, 'stable'), (750, 'testing'), (200, 'unstable'), (50, 'experimental') Architecture: amd64 (x86_64) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.20-jr3-enterprise-e Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Versions of packages libaudiofile0 depends on: ii libc6 2.6-2 GNU C Library: Shared libraries libaudiofile0 recommends no packages. -- no debconf information
/* Audio File Library Copyright 1998-1999, Michael Pruett <[EMAIL PROTECTED]> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ /* writewave.c This program tests the validity of the MS RIFF Wave format reading and writing code. */ #include <stdlib.h> #include <unistd.h> #include <stdio.h> #ifdef __USE_SGI_HEADERS__ #include <dmedia/audiofile.h> #else #include <audiofile.h> #endif char* TEST_FILE; #define BUFFER_SIZE (512*1024) void cleanup (void) { #ifndef DEBUG unlink(TEST_FILE); #endif } void ensure (int condition, const char *message) { if (!condition) { printf("%s.\n", message); cleanup(); exit(EXIT_FAILURE); } } int main (int argc, char **argv) { AFfilehandle file; AFfilesetup setup; u_int16_t samples[BUFFER_SIZE], samples2[BUFFER_SIZE]; int i, n; int sampleFormat, sampleWidth; int framesRead, framesWritten; for (i=0; i<BUFFER_SIZE; i++) samples[i]=i; ensure (argc == 1+2, "wrong numbers of parameters"); TEST_FILE = argv[1]; n = atoi(argv[2]); ensure (n % 2 == 0, "number of byte must be even"); n = n / 2; setup = afNewFileSetup(); afInitFileFormat(setup, AF_FILE_WAVE); afInitChannels(setup, AF_DEFAULT_TRACK, 1); afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); file = afOpenFile(TEST_FILE, "w", setup); ensure(file != AF_NULL_FILEHANDLE, "unable to open file for writing"); i = BUFFER_SIZE; while (n > 0) { if (n < BUFFER_SIZE) i = n; framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, samples, i); ensure(framesWritten == i, "number of frames written does not match number of frames requested"); n = n-i; } ensure(afCloseFile(file) == 0, "error closing file"); afFreeFileSetup(setup); file = afOpenFile(TEST_FILE, "r", NULL); ensure(file != AF_NULL_FILEHANDLE, "unable to open file for reading"); ensure(afGetFileFormat(file, NULL) == AF_FILE_WAVE, "test file not created as Wave"); afGetSampleFormat(file, AF_DEFAULT_TRACK, &sampleFormat, &sampleWidth); ensure(sampleFormat == AF_SAMPFMT_TWOSCOMP, "test file not two's complement"); ensure(sampleWidth == 16, "test file sample format is not 16-bit"); ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 1, "test file doesn't have exactly one channel"); ensure(afGetByteOrder(file, AF_DEFAULT_TRACK) == AF_BYTEORDER_LITTLEENDIAN, "test file not little-endian"); i = 0; framesRead = afReadFrames(file, AF_DEFAULT_TRACK, samples2, BUFFER_SIZE); while (framesRead > 0) { /* int j; for (j = 0; j < framesRead; j++) { if (samples2[j] != samples[j]) printf("i=%d, j=%d\n", i, j); ensure(samples2[j] == samples[j], "data written to file doesn't match data read from file"); } */ framesRead = afReadFrames(file, AF_DEFAULT_TRACK, samples2, BUFFER_SIZE); i = i+1; } ensure(afCloseFile(file) == 0, "error closing file"); cleanup(); exit(0); }