Frequently Asked Questions
Q1 : Is it normal for the output of libsamplerate to be louder
than its input?
Q2 : On Unix/Linux/MacOSX, what is the best way of detecting
the presence and location of libsamplerate and its header file using
autoconf?
Q1 : Is it normal for the output of libsamplerate to be louder
than its input?
The output of libsamplerate will be roughly the same volume as the input.
However, even if the input is strictly in the range (-1.0, 1.0), it is still
possible for the output to contain peak values outside this range.
Consider four consecutive samples of [0.5 0.999 0.999 0.5].
If we are up sampling by a factor of two we need to insert samples between
each of the existing samples.
Its pretty obvious then, that the sample between the two 0.999 values should
and will be bigger than 0.999.
This means that anyone using libsamplerate should normalise its output before
doing things like saving the audio to a 16 bit WAV file.
Q2 : On Unix/Linux/MacOSX, what is the best way of detecting
the presence and location of libsamplerate and its header file using
autoconf?
libsamplrate uses the pkg-config (man pkg-config) method of registering itself
with the host system.
The best way of detecting its presence is using something like this in configure.ac
(or configure.in):
PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.0.15,
ac_cv_samplerate=1, ac_cv_samplerate=0)
AC_DEFINE_UNQUOTED([HAVE_SAMPLERATE],${ac_cv_samplerate},
[Set to 1 if you have libsamplerate.])
AC_SUBST(SAMPLERATE_CFLAGS)
AC_SUBST(SAMPLERATE_LIBS)
This will automatically set the SAMPLERATE_CFLAGS and SAMPLERATE_LIBS
variables which can be used in Makefile.am or Makefile.in like this:
SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
If you install libsamplerate from source, you will probably need to set the
PKG_CONFIG_PATH environment variable's suggested at the end of the
libsamplerate configure process. For instance on my system I get this:
-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-=-
Configuration summary :
Version : ..................... 0.1.0
Enable debugging : ............ no
Tools :
Compiler is GCC : ............. yes
GCC major version : ........... 3
Extra tools required for testing and examples :
Have FFTW : ................... yes
Have libsndfile : ............. yes
Have libefence : .............. no
Installation directories :
Library directory : ........... /usr/local/lib
Program directory : ........... /usr/local/bin
Pkgconfig directory : ......... /usr/local/lib/pkgconfig