Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > 84be44a975a14e30324bf67a8bd97626 > files > 6

libsndfile1-devel-1.0.4-1mdk.ppc.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>

<HEAD>
	<TITLE>
	libsndfile : Frequently Asked Questsions.
	</TITLE>
	<META NAME="Author"      CONTENT="Erik de Castro Lopo (erikd AT zip DOT com DOT au)">
	<META NAME="Version"     CONTENT="Version 1.0.4">
	<!-- Another version at the bottom of the page.  -->
	<META NAME="Description" CONTENT="The libsndfile FAQ.">
	<META NAME="Keywords"    CONTENT="WAV AIFF AU libsndfile sound audio dsp Linux">
	<LINK REL=StyleSheet HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
</HEAD>

<BODY TEXT="#FFFFFF" BGCOLOR="#000000" LINK="#5050FF" VLINK="#5050FF" ALINK="#FF00FF">

<H1><B>libsndfile : Frequently Asked Questsions.</B></H1>
<P>
<A HREF="#Q001">Q1 : On Linux, sf_open returns weird info about files. Why?</A><BR>
<A HREF="#Q002">Q2 : In version 0 the SF_INFO struct had a pcmbitwidth field
		but version 1 does not. Why?</A><BR>
<A HREF="#Q003">Q3 : Compiling is really slow on MacOSX. Why?</A><BR>
<A HREF="#Q004">Q4 : When trying to compile libsndfile on Solaris I get a "bad 
		substitution" error during linking. What can I do to fix this?</A><BR>
<A HREF="#Q005">Q5 : Why doesn't libsndfile do interleaving/de-interleaving?</A><BR>
<A HREF="#Q006">Q6 : What's the best format for storing temporary files?</A><BR>
<HR>

<!-- ========================================================================= -->
<A NAME="Q001"></A>
<H2><BR><B>Q1 : On Linux, sf_open returns weird info about files. Why?</B></H2>
<P>
	This simple call to sf_open :
</P>
<PRE>
        file = sf_open (filename, SFM_READ, &amp;sfinfo) ;

        printf ("srate    : %d\n", sfinfo.samplerate) ;
        printf ("frames   : %d\n", sfinfo.frames) ;
        printf ("channels : %d\n", sfinfo.channels) ;
        printf ("format   : %d\n", sfinfo.format) ;
        printf ("sections : %d\n", sfinfo.sections);
        printf ("seekable : %d\n", sfinfo.seekable) ;
</PRE>
<P>
returns this weird info:
</P>
<PRE>
        srate     : 0
        frames    : 1445760
        channels  : 44100
        format    : 2
        sections  : 65538
        seekable  : 1

</PRE>
<H2><B>Answer</B></H2>
<P>
This is only a problem on Linux and other 32 bit OSes (possibly 32 bit Solaris) 
which require special compiler command line options to allow access to files 
greater than 2 Gig in size.
<A HREF="pkgconfig.html">These instructions</A> should show you a way around this
problem.
</P>

<!-- ========================================================================= -->
<A NAME="Q002"></A>
<H2><BR><B>Q2 : In version 0 the SF_INFO struct had a pcmbitwidth field
		but version 1 does not. Why?</B></H2>
<P>
	This was dropped for a number of reasons:
</P>
<UL>
	<LI> pcmbitwidth makes little sense on compressed or floating point formats
	<LI> with the new API you really don't need to know it
</UL>
<P>
As documented 
    <A HREF="http://www.zip.com.au/~erikd/libsndfile/api.html#note1">here</A>
there is now a well defined behaviour which ensures that no matter what the
bit width of the source file, the scaling always does something sensible. 
This makes it safe to read 8, 16, 24 and 32 bit PCM files using sf_read_short()
and always have the optimal behaviour.
</P>

<!-- ========================================================================= -->
<A NAME="Q003"></A>
<H2><BR><B>Q3 : Compiling is really slow on MacOSX. Why?</B></H2>
<P>
When you configure and compile libsndfile, it uses the Bourne shell for a number
of tasks (ie configure script and libtool). 
However, Apple has decided to ship their system with a really crappy Bourne shell.
</P>
<P>
To fix this I suggest that you install the GNU Bash shell, rename /bin/sh to 
/bin/sh.old and make a softlink from /bin/sh to the bash shell.
Bash is designed to behave as a Bourne shell when is is called as /bin/sh.
</P>
<P>
When I did this on my iBook running MacOSX, compile times dropped from 13 mintes to 3
minutes.
</P>

<!-- ========================================================================= -->
<A NAME="Q004"></A>
<H2><BR><B>Q4 : When trying to compile libsndfile on Solaris I get a "bad 
		substitution" error on linking. Why?</B></H2>
<P>
It seems that the Solaris Bourne shell disagrees with GNU libtool. 
</P>
<P>
To fix this I suggest that you install the GNU Bash shell, rename /bin/sh to 
/bin/sh.old and make a softlink from /bin/sh to the bash shell.
Bash is designed to behave as a Bourne shell when is is called as /bin/sh.
</P>

<!-- ========================================================================= -->
<A NAME="Q005"></A>
<H2><BR><B>Q5 : Why doesn't libsndfile do interleaving/de-interleaving?</B></H2>
<P>
This problem is bigger then it may seem at first.
For a stereo file, it might be desirable to read out either the left or the
right channel or supply two spearate mono channels and write it to a stereo 
file.
This particular problem is trival and can easily be done in the application
program.
</P>
<P>
With files of more than 2 channels the picture is much more complex.
For instance, you may wish to read channels 1 and 2 of a 4 channel file as an
interleaved pair (or as two separate mono channels). 
The possiblities are endless.
</P>
<P>
Any interleaver/de-interleaver which gets added to libsndfile but be able to
handle the simple cases as well as more complex cases.
This means that this feature will not be added any time soon.
</P>

<!-- ========================================================================= -->
<A NAME="Q006"></A>
<H2><BR><B>Q6 : What's the best format for storing temporary files?</B></H2>

<P>
When you want to store temporary data there are a number of requirements; 
</P>
<UL>
	<LI> A simple, easy to parse header.
	<LI> The format must provide the fastest possible read and write rates (ie 
		avoid conversions and encoding/decoding).
	<LI> The file format must be reasonably common and playable by most players.
	<LI> Able to store data in either endian-ness.
</UL>
<P>
The format which best means these requirements is AU, which allows data to be 
stored in any one of short, int, float and double (among others).
</P>
<P>
For instance, if an application uses float data internally, it temporary files 
should use a format of (SF_ENDIAN_CPU | SF_FORMAT_AU | SF_FORMAT_FLOAT) which
will store big endian float data in big endian CPUs and little float endian data 
on little endian CPUs.
Reading and writing this format will not require any conversions or byte swapping
regardless of the host CPU.
</P>

<!-- ========================================================================= -->


<HR>
<P>
	The libsndfile home page is here : 
		<A HREF="http://www.zip.com.au/~erikd/libsndfile/">
			http://www.zip.com.au/~erikd/libsndfile/</A>.
<BR>
Version : 1.0.4
</P>

</BODY>
</HTML>