From: Jerry Avins on
Richard Dobson wrote:
> Jerry Avins wrote:
>> Richard Dobson wrote:
>>
>>> It is a ~lot~ less work, and a whole lot safer, just to use an
>>> established library to do the job.
>>
>> Yes. I stand corrected and abashed, but the OP still needs to know
>> what a .wav file is -- in particular, _his_ .wav file. He can use
>> libsndfile to read the header. (Do you think he knows about headers?)
>>
>> Jerry
>
>
> The only essential point to make in answering that question is that a
> WAVE (or AIFF) file does not have a fixed-length header. The OP shoudl
> disregard any suggestion to the contrary. You can't take a short cut and
> say 'the audio starts at byte 34' or whatever. Well, you could, just, in
> writing a file, but not in reading one. There are unfortunately many
> examples (including many self-styled "documentation" pages) on the net
> where that assumption is made, implicitly or explicitly (the original
> matlab implementation of "wavread" suffered just this problem, among
> other things). I long ago lost count of the number of unix programs
> especially that broke simply because I gave them a WAVE file with a
> longer header than the theoretical minimum.
>
> All other things being equal, there are only two primary types of
> programmer who should really commit the time and effort to delve into
> the minutiae of such file formats - writers of soundfile handling
> libraries such as Eric with libsndfile (which as I am sure he will
> confirm has taken years of work to reach its present extremely
> efficient, accurate and comprehensive state), and people who design file
> formats (and thus need a custom soundfile library they can freely
> "hack"); which is what I have done from time to time (e.g. for phase
> vocoder analysis files, and for Ambisonic B-Format).

All true. When I write that aaronde needs to know what a .wav file is, I
don'r mean the details you enumerate. I mean its format, including
header (which I suspect is a surprise to him) and a series of integers
whose size and format the header describes. I hope he's still reading.
There's a lot he needs to learn from you and Erik.

Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
From: glen herrmannsfeldt on
Jerry Avins <jya(a)ieee.org> wrote:
(snip)

> Yes. I stand corrected and abashed, but the OP still needs to know what
> a .wav file is -- in particular, _his_ .wav file. He can use libsndfile
> to read the header. (Do you think he knows about headers?)

Some time ago I wrote a program to read WAV files, including
extracting the data from the header. It seems, though, that what
most do is just skip the appropriate number of bytes. (Programs
like cdrecord.) I have one that computes, among others, the peak
and RMS values. I thought about posting it but never did.

-- glen
From: Randy Yates on
Erik de Castro Lopo <erikd(a)mega-nerd.com> writes:
> [...]

Erik,

Didn't libsndfile just recently win some type of award or recognition?

In any case, thanks for a very useful library. I use it in my spectral
analysis tool.
--
Randy Yates % "Bird, on the wing,
Digital Signal Labs % goes floating by
mailto://yates(a)ieee.org % but there's a teardrop in his eye..."
http://www.digitalsignallabs.com % 'One Summer Dream', *Face The Music*, ELO
From: aaronde on
>Richard Dobson wrote:
>> Jerry Avins wrote:
>>> Richard Dobson wrote:
>>>
>>>> It is a ~lot~ less work, and a whole lot safer, just to use an
>>>> established library to do the job.
>>>
>>> Yes. I stand corrected and abashed, but the OP still needs to know
>>> what a .wav file is -- in particular, _his_ .wav file. He can use
>>> libsndfile to read the header. (Do you think he knows about headers?)
>>>
>>> Jerry
>>
>>
>> The only essential point to make in answering that question is that a
>> WAVE (or AIFF) file does not have a fixed-length header. The OP shoudl

>> disregard any suggestion to the contrary. You can't take a short cut
and
>> say 'the audio starts at byte 34' or whatever. Well, you could, just,
in
>> writing a file, but not in reading one. There are unfortunately many
>> examples (including many self-styled "documentation" pages) on the net

>> where that assumption is made, implicitly or explicitly (the original
>> matlab implementation of "wavread" suffered just this problem, among
>> other things). I long ago lost count of the number of unix programs
>> especially that broke simply because I gave them a WAVE file with a
>> longer header than the theoretical minimum.
>>
>> All other things being equal, there are only two primary types of
>> programmer who should really commit the time and effort to delve into
>> the minutiae of such file formats - writers of soundfile handling
>> libraries such as Eric with libsndfile (which as I am sure he will
>> confirm has taken years of work to reach its present extremely
>> efficient, accurate and comprehensive state), and people who design
file
>> formats (and thus need a custom soundfile library they can freely
>> "hack"); which is what I have done from time to time (e.g. for phase
>> vocoder analysis files, and for Ambisonic B-Format).
>
>All true. When I write that aaronde needs to know what a .wav file is, I

>don'r mean the details you enumerate. I mean its format, including
>header (which I suspect is a surprise to him) and a series of integers
>whose size and format the header describes. I hope he's still reading.
>There's a lot he needs to learn from you and Erik.
>
>Jerry
>--
>Engineering is the art of making what you want from things you can get.
>�����������������������������������������������������������������������
>

Yeah still reading.... thanks for the info guys really helped
From: Erik de Castro Lopo on
Randy Yates wrote:

> Didn't libsndfile just recently win some type of award or recognition?

If it did, nobody told me :-).

Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/