ref: e7c07cb495961d368cffd591f63b5b0ff72d616c
parent: a8024fd6adcfe5456bea55e1ebd8f7e608c986da
author: cbagwell <cbagwell>
date: Tue Nov 13 22:31:25 EST 2001
Initial attempt at adding GSM internal to libst.
--- a/Makefile.gcc
+++ b/Makefile.gcc
@@ -107,14 +107,6 @@
#
# MEMMOVE_DEFINES = -DHAVE_MEMMOVE
-# If you have the GSM 6.10 libraries installed then uncomment the follow
-# 4 lines, and change to reflect your installation paths.
-#
-# GSM_PRE_LIBS = -L/usr/local/lib
-# GSM_POST_LIBS = -lgsm
-# GSM_INCLUDES = -I/usr/local/include/
-# GSM_DEFINES = -DHAVE_LIBGSM
-
# For sound support on machines that include the OSS sound driver
# (such as Linux) then uncomment the following line.
#
@@ -183,10 +175,10 @@
##############################################################################
-SOX_PRE_LIBS = $(GSM_PRE_LIBS)
-SOX_POST_LIBS = $(GSM_POST_LIBS) $(MATHLIB)
-SOX_INCLUDES = $(GSM_INCLUDES)
-SOX_DEFINES = $(GSM_DEFINES) $(PLAYER_DEFINES) \
+SOX_PRE_LIBS =
+SOX_POST_LIBS = $(MATHLIB)
+SOX_INCLUDES =
+SOX_DEFINES = $(PLAYER_DEFINES) \
$(GETOPT_DEFINES) $(BYTESWAP_DEFINES) $(RAND_DEFINES) $(STRERR_DEFINES) \
$(MEMMOVE_DEFINES) $(DOS_DEFINES) $(NEXT_DEFINES) $(MISC_DEFINES)
--- a/README
+++ b/README
@@ -1,7 +1,7 @@
- SoX: Sound eXchange
+SoX: Sound eXchange
+-------------------
-
-SoX (also known as Sound eXchange) translates sound samples between different
+SoX (also known as Sound eXchange) translates sound files between different
file formats, and optionally applies various sound effects.
SoX is intended as the Swiss Army knife of sound processing tools. It
@@ -59,7 +59,7 @@
o Add masking noise to a signal
o Apply a phaser effect
o Convert from stereo to mono
- o Change sampling rates using several different algorithms.A
+ o Change sampling rates using several different algorithms. A
'resample' and 'poyphase' effect use high-grade signal rate
changes using real signal theory!
o Apply a reverb effect
@@ -78,17 +78,10 @@
History:
-This is release 12.17, Patchlevel 2 of the Sound Tools.
-SoX was originally written and maintained by Lance Norskog but
-unfortunetly he has stopped maintaining it since 1995. I, Chris
-Bagwell (cbagwell@users.sourceforge.net), have started maintaining it since
-1996 to the present.
+This is release 12.17.3 of SoX and its companion library Sound Tools.
+SoX was originally written and maintained by Lance Norskog but is
+currently mantained by Chris Bagwell (cbagwell@users.sourceforge.net).
-Caveats:
-
-Technically, SoX is made up of a sound file processing library called libst
-and SoX is a program implemented using this library.
-
Installing:
Unless your using a precompiled binary version, you will need to compile
@@ -95,13 +88,16 @@
SoX as described in the INSTALL file. Please read that file for further
instructions.
-Now, read sox.txt and soxexam.txt. This gives a background on how
-SoX deals with sound files and how to convert this format
-to that format, and apply various effects.
+SoX is distributed with two text files named sox.txt and soxexam.txt.
+These files give a background on how SoX deals with sound files and
+what command line options are available to convert a sound file to
+another file format and how to apply sound effects.
SoX has an auto-detect feature that attempts to figure out
-the nature of an unmarked sound sample. It works very well.
-This feature is used if you specify '-t auto' for the file type.
+the nature of an sound file. It does this by looking for 'magic values'
+in the header of the audio file. If it is unable to detect the format
+of the sound file then the user must use command line options to
+inform SoX.
I hope to inspire the creation of a common base of sound processing
tools for computer multimedia work, similar to the PBM toolkit for
--- a/configure
+++ b/configure
@@ -1,6 +1,7 @@
#! /bin/sh
-# From configure.in configure.in 1.1
+# From configure.in configure.in 1.2
+
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.13
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
@@ -19,10 +20,8 @@
ac_help="$ac_help
--enable-fast-alaw Use fast alaw compression (+32K memory)"
ac_help="$ac_help
- --with-gsmlib Location of GSM 6.10 library (=dir)"
+ --enable-gsm Enable internal GSM support"
ac_help="$ac_help
- --with-gsminc Location of GSM 6.10 headers (=dir)"
-ac_help="$ac_help
--with-alsa-dsp Force support for /dev/snd/pcmABXY (ALSA)"
ac_help="$ac_help
--with-oss-dsp Force support for /dev/dsp (OSS)"
@@ -565,24 +564,13 @@
fi
-# Check whether --with-gsmlib or --without-gsmlib was given.
-if test "${with_gsmlib+set}" = set; then
- withval="$with_gsmlib"
- gsmlib="$withval"
-else
- gsmlib=auto
+# Check whether --enable-gsm or --disable-gsm was given.
+if test "${enable_gsm+set}" = set; then
+ enableval="$enable_gsm"
+ :
fi
-# Check whether --with-gsminc or --without-gsminc was given.
-if test "${with_gsminc+set}" = set; then
- withval="$with_gsminc"
- gsminc="$withval"
-else
- gsminc=auto
-fi
-
-
# Check whether --with-alsa_dsp or --without-alsa_dsp was given.
if test "${with_alsa_dsp+set}" = set; then
withval="$with_alsa_dsp"
@@ -628,11 +616,10 @@
fi
-
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:636: checking for $ac_word" >&5
+echo "configure:623: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -662,7 +649,7 @@
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:666: checking for $ac_word" >&5
+echo "configure:653: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -713,7 +700,7 @@
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:717: checking for $ac_word" >&5
+echo "configure:704: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -745,7 +732,7 @@
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:749: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:736: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -756,12 +743,12 @@
cat > conftest.$ac_ext << EOF
-#line 760 "configure"
+#line 747 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -787,12 +774,12 @@
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:791: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:778: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:796: checking whether we are using GNU C" >&5
+echo "configure:783: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -801,7 +788,7 @@
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:805: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:792: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -820,7 +807,7 @@
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:824: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:811: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -854,7 +841,7 @@
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:858: checking for $ac_word" >&5
+echo "configure:845: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -912,7 +899,7 @@
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:916: checking for a BSD compatible install" >&5
+echo "configure:903: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -964,8 +951,29 @@
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:956: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ rm -f conftestdata
+if ln -s X conftestdata 2>/dev/null
+then
+ rm -f conftestdata
+ ac_cv_prog_LN_S="ln -s"
+else
+ ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:969: checking how to run the C preprocessor" >&5
+echo "configure:977: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -980,13 +988,13 @@
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 984 "configure"
+#line 992 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:990: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:998: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -997,13 +1005,13 @@
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1001 "configure"
+#line 1009 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1007: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1015: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1014,13 +1022,13 @@
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 1018 "configure"
+#line 1026 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1024: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1032: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1044,53 +1052,12 @@
fi
echo "$ac_t""$CPP" 1>&6
-echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:1049: checking for inline" >&5
-if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_cv_c_inline=no
-for ac_kw in inline __inline__ __inline; do
- cat > conftest.$ac_ext <<EOF
-#line 1056 "configure"
-#include "confdefs.h"
-
-int main() {
-} $ac_kw foo() {
-; return 0; }
-EOF
-if { (eval echo configure:1063: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_c_inline=$ac_kw; break
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-done
-
-fi
-
-echo "$ac_t""$ac_cv_c_inline" 1>&6
-case "$ac_cv_c_inline" in
- inline | yes) ;;
- no) cat >> confdefs.h <<\EOF
-#define inline
-EOF
- ;;
- *) cat >> confdefs.h <<EOF
-#define inline $ac_cv_c_inline
-EOF
- ;;
-esac
-
-
for ac_prog in sed
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1094: checking for $ac_word" >&5
+echo "configure:1061: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_SED'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1121,7 +1088,6 @@
-
# Do some error checking and defaulting for the host and target type.
# The inputs are:
# configure --host=HOST --target=TARGET --build=BUILD NONOPT
@@ -1149,7 +1115,7 @@
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:1153: checking host system type" >&5
+echo "configure:1119: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -1170,7 +1136,7 @@
echo "$ac_t""$host" 1>&6
echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:1174: checking target system type" >&5
+echo "configure:1140: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@@ -1188,7 +1154,7 @@
echo "$ac_t""$target" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1192: checking build system type" >&5
+echo "configure:1158: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -1217,20 +1183,158 @@
LDFLAGS="$LDFLAGS -mno-cygwin"
esac
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1188: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1193 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1201: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
-NEED_OSS=0
-NEED_SUNAU=0
-NEED_ALSA=0
-PLAY_SUPPORT=0
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1218 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1236 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1257 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:1268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+for ac_hdr in getopt.h fcntl.h limits.h malloc.h unistd.h byteswap.h sys/types.h inttypes.h stdint.h string.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1295: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1300 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1305: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
if test "$GCC" = yes
then
CFLAGS="$CFLAGS -Wall"
fi
-
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:1234: checking whether byte ordering is bigendian" >&5
+echo "configure:1338: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1237,7 +1341,7 @@
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
-#line 1241 "configure"
+#line 1345 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -1248,11 +1352,11 @@
#endif
; return 0; }
EOF
-if { (eval echo configure:1252: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF
-#line 1256 "configure"
+#line 1360 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -1263,7 +1367,7 @@
#endif
; return 0; }
EOF
-if { (eval echo configure:1267: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1371: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
@@ -1283,7 +1387,7 @@
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1287 "configure"
+#line 1391 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
@@ -1296,7 +1400,7 @@
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
-if { (eval echo configure:1300: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_bigendian=no
else
@@ -1319,184 +1423,348 @@
fi
-
-
-
-echo "checking if math library is required during link" 1>&6
-echo "configure:1327: checking if math library is required during link" >&5
-echo $ac_n "checking for pow""... $ac_c" 1>&6
-echo "configure:1329: checking for pow" >&5
-if eval "test \"`echo '$''{'ac_cv_func_pow'+set}'`\" = set"; then
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:1428: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1334 "configure"
+#line 1433 "configure"
#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char pow(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char pow();
int main() {
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_pow) || defined (__stub___pow)
-choke me
-#else
-pow();
-#endif
+/* Ultrix mips cc rejects this. */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this. */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this. */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in an arm
+ of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+ *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+}
+
; return 0; }
EOF
-if { (eval echo configure:1357: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1482: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- eval "ac_cv_func_pow=yes"
+ ac_cv_c_const=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- eval "ac_cv_func_pow=no"
+ ac_cv_c_const=no
fi
rm -f conftest*
fi
-if eval "test \"`echo '$ac_cv_func_'pow`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
-else
- echo "$ac_t""no" 1>&6
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+ cat >> confdefs.h <<\EOF
+#define const
+EOF
+
fi
-if test "$ac_cv_func_pow" = no
-then
- echo $ac_n "checking for pow in -lm""... $ac_c" 1>&6
-echo "configure:1379: checking for pow in -lm" >&5
-ac_lib_var=`echo m'_'pow | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:1503: checking for inline" >&5
+if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- ac_save_LIBS="$LIBS"
-LIBS="-lm $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1387 "configure"
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat > conftest.$ac_ext <<EOF
+#line 1510 "configure"
#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char pow();
int main() {
-pow()
+} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:1398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1517: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
+ ac_cv_c_inline=$ac_kw; break
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+
+fi
+
+echo "$ac_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
+ inline | yes) ;;
+ no) cat >> confdefs.h <<\EOF
+#define inline
+EOF
+ ;;
+ *) cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
+EOF
+ ;;
+esac
+
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:1543: checking for size_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1548 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
+ ac_cv_type_size_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_size_t=no
fi
rm -f conftest*
-LIBS="$ac_save_LIBS"
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
+echo "$ac_t""$ac_cv_type_size_t" 1>&6
+if test $ac_cv_type_size_t = no; then
+ cat >> confdefs.h <<\EOF
+#define size_t unsigned
EOF
- LIBS="-lm $LIBS"
+fi
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:1576: checking for Cygwin environment" >&5
+if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
else
- echo "$ac_t""no" 1>&6
-fi
+ cat > conftest.$ac_ext <<EOF
+#line 1581 "configure"
+#include "confdefs.h"
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:1592: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_cygwin=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_cygwin=no
fi
+rm -f conftest*
+rm -f conftest*
+fi
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:1609: checking for mingw32 environment" >&5
+if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1614 "configure"
+#include "confdefs.h"
-if test "$gsmlib" != auto && test "$gsmlib" != no
-then
- LIBS="$LIBS -L$gsmlib"
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:1621: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_mingw32=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_mingw32=no
fi
+rm -f conftest*
+rm -f conftest*
+fi
-ac_save_CPPFLAGS="$CPPFLAGS"
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
-if test "$gsminc" != auto && test "$gsminc" != no
-then
- CFLAGS="$CFLAGS -I$gsminc"
- ac_save_CPPFLAGS="$CPPFLAGS"
- if test \! -z "$gsminc" ; then
- CPPFLAGS="$CPPFLAGS -I$gsminc"
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:1640: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+ ac_cv_exeext=.exe
+else
+ rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.$ac_ext
+ ac_cv_exeext=
+ if { (eval echo configure:1650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj) ;;
+ *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ else
+ { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
fi
+ rm -f conftest*
+ test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
fi
+fi
-ac_safe=`echo "gsm.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for gsm.h""... $ac_c" 1>&6
-echo "configure:1446: checking for gsm.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+echo $ac_n "checking for object suffix""... $ac_c" 1>&6
+echo "configure:1671: checking for object suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
+ rm -f conftest*
+echo 'int i = 1;' > conftest.$ac_ext
+if { (eval echo configure:1677: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ for ac_file in conftest.*; do
+ case $ac_file in
+ *.c) ;;
+ *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
+ esac
+ done
+else
+ { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_objext" 1>&6
+OBJEXT=$ac_cv_objext
+ac_objext=$ac_cv_objext
+
+
+
+echo "checking if math library is required during link" 1>&6
+echo "configure:1697: checking if math library is required during link" >&5
+echo $ac_n "checking for pow""... $ac_c" 1>&6
+echo "configure:1699: checking for pow" >&5
+if eval "test \"`echo '$''{'ac_cv_func_pow'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
cat > conftest.$ac_ext <<EOF
-#line 1451 "configure"
+#line 1704 "configure"
#include "confdefs.h"
-#include <gsm.h>
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char pow(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pow();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_pow) || defined (__stub___pow)
+choke me
+#else
+pow();
+#endif
+
+; return 0; }
EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1456: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+if { (eval echo configure:1727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
+ eval "ac_cv_func_pow=yes"
else
- echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
+ eval "ac_cv_func_pow=no"
fi
rm -f conftest*
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+
+if eval "test \"`echo '$ac_cv_func_'pow`\" = yes"; then
echo "$ac_t""yes" 1>&6
- gsminc=yes
+ :
else
echo "$ac_t""no" 1>&6
-gsminc=no
fi
-if test "$gsminc" = yes
+if test "$ac_cv_func_pow" = no
then
- echo $ac_n "checking for gsm_create in -lgsm""... $ac_c" 1>&6
-echo "configure:1481: checking for gsm_create in -lgsm" >&5
-ac_lib_var=`echo gsm'_'gsm_create | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for pow in -lm""... $ac_c" 1>&6
+echo "configure:1749: checking for pow in -lm" >&5
+ac_lib_var=`echo m'_'pow | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
-LIBS="-lgsm $LIBS"
+LIBS="-lm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1489 "configure"
+#line 1757 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char gsm_create();
+char pow();
int main() {
-gsm_create()
+pow()
; return 0; }
EOF
-if { (eval echo configure:1500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1511,13 +1779,13 @@
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo gsm | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF
- LIBS="-lgsm $LIBS"
+ LIBS="-lm $LIBS"
else
echo "$ac_t""no" 1>&6
@@ -1524,10 +1792,15 @@
fi
fi
-CPPFLAGS="$ac_save_CPPFLAGS"
+NEED_OSS=0
+NEED_SUNAU=0
+NEED_ALSA=0
+GSM_SUPPORT=0
+PLAY_SUPPORT=0
+
if test "$ogg_vorbislib" != auto && test "$ogg_vorbislib" != no
then
LIBS="$LIBS -L$ogg_vorbislib"
@@ -1546,17 +1819,17 @@
ac_safe=`echo "vorbis/codec.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for vorbis/codec.h""... $ac_c" 1>&6
-echo "configure:1550: checking for vorbis/codec.h" >&5
+echo "configure:1823: checking for vorbis/codec.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1555 "configure"
+#line 1828 "configure"
#include "confdefs.h"
#include <vorbis/codec.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1560: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1581,7 +1854,7 @@
if test "$ogg_vorbisinc" = yes
then
echo $ac_n "checking for vorbis_analysis_init in -lvorbis""... $ac_c" 1>&6
-echo "configure:1585: checking for vorbis_analysis_init in -lvorbis" >&5
+echo "configure:1858: checking for vorbis_analysis_init in -lvorbis" >&5
ac_lib_var=`echo vorbis'_'vorbis_analysis_init | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1589,7 +1862,7 @@
ac_save_LIBS="$LIBS"
LIBS="-lvorbis $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1593 "configure"
+#line 1866 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1600,7 +1873,7 @@
vorbis_analysis_init()
; return 0; }
EOF
-if { (eval echo configure:1604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1628,57 +1901,15 @@
CPPFLAGS="$ac_save_CPPFLAGS"
-for ac_hdr in getopt.h unistd.h malloc.h byteswap.h sys/types.h inttypes.h stdint.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1636: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1641 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1646: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-
-
for ac_func in getopt strerror memmove rand
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1677: checking for $ac_func" >&5
+echo "configure:1908: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1682 "configure"
+#line 1913 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1701,7 +1932,7 @@
; return 0; }
EOF
-if { (eval echo configure:1705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1733,17 +1964,17 @@
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1737: checking for $ac_hdr" >&5
+echo "configure:1968: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1742 "configure"
+#line 1973 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1747: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1978: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1774,9 +2005,9 @@
if test "$alsa_dsp" = yes
then
echo $ac_n "checking for ALSA ioctl API""... $ac_c" 1>&6
-echo "configure:1778: checking for ALSA ioctl API" >&5
+echo "configure:2009: checking for ALSA ioctl API" >&5
cat > conftest.$ac_ext <<EOF
-#line 1780 "configure"
+#line 2011 "configure"
#include "confdefs.h"
#include <linux/asound.h>
@@ -1787,7 +2018,7 @@
; return 0; }
EOF
-if { (eval echo configure:1791: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2022: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
alsa_api_ver=oldapi
else
@@ -1810,17 +2041,17 @@
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1814: checking for $ac_hdr" >&5
+echo "configure:2045: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1819 "configure"
+#line 2050 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1824: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2055: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1861,17 +2092,17 @@
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1865: checking for $ac_hdr" >&5
+echo "configure:2096: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1870 "configure"
+#line 2101 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1875: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2106: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1919,8 +2150,13 @@
then
CFLAGS="$CFLAGS -DFAST_ALAW_CONVERSION"
fi
+if test "$enable_gsm" = yes
+then
+ CFLAGS="$CFLAGS -DENABLE_GSM"
+ LIBS="$LIBS -lgsm"
+ GSM_SUPPORT=1
+fi
-LIBS="-L. -lst $LIBS"
@@ -2041,7 +2277,7 @@
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
-trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "Makefile gsm/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@@ -2078,6 +2314,7 @@
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@LN_S@%$LN_S%g
s%@CPP@%$CPP%g
s%@SED@%$SED%g
s%@host@%$host%g
@@ -2095,9 +2332,12 @@
s%@build_cpu@%$build_cpu%g
s%@build_vendor@%$build_vendor%g
s%@build_os@%$build_os%g
+s%@EXEEXT@%$EXEEXT%g
+s%@OBJEXT@%$OBJEXT%g
s%@NEED_OSS@%$NEED_OSS%g
s%@NEED_SUNAU@%$NEED_SUNAU%g
s%@NEED_ALSA@%$NEED_ALSA%g
+s%@GSM_SUPPORT@%$GSM_SUPPORT%g
s%@PLAY_SUPPORT@%$PLAY_SUPPORT%g
CEOF
@@ -2140,7 +2380,7 @@
cat >> $CONFIG_STATUS <<EOF
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
+CONFIG_FILES=\${CONFIG_FILES-"Makefile gsm/Makefile"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
@@ -2213,6 +2453,7 @@
if test ! -f tests.sh; then cp ${srcdir}/tests.sh tests.sh; fi
+if test ! -f testall.sh; then cp ${srcdir}/testall.sh tests.sh; fi
if test ! -f monkey.au; then cp ${srcdir}/monkey.au monkey.au; fi
if test ! -f monkey.voc; then cp ${srcdir}/monkey.voc monkey.voc; fi
--- a/configure.in
+++ b/configure.in
@@ -3,9 +3,9 @@
dnl configure.in
dnl
-AC_REVISION([configure.in 1.1])
+AC_REVISION([configure.in 1.2])
+
AC_INIT(sox.c)
-dnl AC_CONFIG_HEADER(config.h)
dnl Parameters to configure
@@ -18,16 +18,9 @@
AC_ARG_ENABLE(fast_alaw,
[ --enable-fast-alaw Use fast alaw compression (+32K memory)])
-AC_ARG_WITH(gsmlib,
- [ --with-gsmlib Location of GSM 6.10 library (=dir)],
- [gsmlib="$withval"],
- [gsmlib=auto])
+AC_ARG_ENABLE(gsm,
+ [ --enable-gsm Enable internal GSM support])
-AC_ARG_WITH(gsminc,
- [ --with-gsminc Location of GSM 6.10 headers (=dir)],
- [gsminc="$withval"],
- [gsminc=auto])
-
AC_ARG_WITH(alsa_dsp,
[ --with-alsa-dsp Force support for /dev/snd/pcmABXY (ALSA)],
[alsa_dsp="$withval"],
@@ -54,17 +47,14 @@
[ogg_vorbisinc=auto])
dnl Checks for programs.
-
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_INSTALL
+AC_PROG_LN_S
AC_PROG_CPP
-AC_C_INLINE
-
AC_CHECK_PROGS(SED, sed)
dnl Set host type
-
AC_CANONICAL_SYSTEM
case "$target" in
@@ -73,13 +63,10 @@
LDFLAGS="$LDFLAGS -mno-cygwin"
esac
-dnl Initial values for exported symbols.
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS(getopt.h fcntl.h limits.h malloc.h unistd.h byteswap.h sys/types.h inttypes.h stdint.h string.h)
-NEED_OSS=0
-NEED_SUNAU=0
-NEED_ALSA=0
-PLAY_SUPPORT=0
-
dnl Extra CFLAGS if we have gcc
if test "$GCC" = yes
then
@@ -87,13 +74,16 @@
fi
dnl Check for system dependent features.
-
AC_C_BIGENDIAN
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_SIZE_T
+AC_EXEEXT
+AC_OBJEXT
dnl Checks for libraries.
dnl Check if math library is needed.
-
AC_CHECKING(if math library is required during link)
AC_CHECK_FUNC(pow)
if test "$ac_cv_func_pow" = no
@@ -101,35 +91,14 @@
AC_CHECK_LIB(m, pow)
fi
-dnl Test for GSM library.
+dnl Initial values for exported symbols.
-if test "$gsmlib" != auto && test "$gsmlib" != no
-then
- LIBS="$LIBS -L$gsmlib"
-fi
+NEED_OSS=0
+NEED_SUNAU=0
+NEED_ALSA=0
+GSM_SUPPORT=0
+PLAY_SUPPORT=0
-dnl Need to tell preprocess where to look for GSM include files
-dnl when they are not in system directories. Because of this make
-dnl a backup copy of the CPPFLAGS.
-ac_save_CPPFLAGS="$CPPFLAGS"
-
-if test "$gsminc" != auto && test "$gsminc" != no
-then
- CFLAGS="$CFLAGS -I$gsminc"
- ac_save_CPPFLAGS="$CPPFLAGS"
- if test \! -z "$gsminc" ; then
- CPPFLAGS="$CPPFLAGS -I$gsminc"
- fi
-fi
-
-AC_CHECK_HEADER(gsm.h, gsminc=yes, gsminc=no)
-if test "$gsminc" = yes
-then
- AC_CHECK_LIB(gsm, gsm_create)
-fi
-CPPFLAGS="$ac_save_CPPFLAGS"
-
-
dnl Test for Ogg Vorbis libraries.
if test "$ogg_vorbislib" != auto && test "$ogg_vorbislib" != no
@@ -160,10 +129,6 @@
fi
CPPFLAGS="$ac_save_CPPFLAGS"
-dnl Checks for header files.
-
-AC_CHECK_HEADERS(getopt.h unistd.h malloc.h byteswap.h sys/types.h inttypes.h stdint.h)
-
dnl Checks for library functions.
AC_CHECK_FUNCS(getopt strerror memmove rand)
@@ -231,19 +196,25 @@
then
CFLAGS="$CFLAGS -DFAST_ALAW_CONVERSION"
fi
+if test "$enable_gsm" = yes
+then
+ CFLAGS="$CFLAGS -DENABLE_GSM"
+ LIBS="$LIBS -lgsm"
+ GSM_SUPPORT=1
+fi
-LIBS="-L. -lst $LIBS"
-
AC_SUBST(NEED_OSS)
AC_SUBST(NEED_SUNAU)
AC_SUBST(NEED_ALSA)
+AC_SUBST(GSM_SUPPORT)
AC_SUBST(PLAY_SUPPORT)
dnl Generate output files...
-AC_OUTPUT([Makefile])
+AC_OUTPUT([Makefile gsm/Makefile])
if test ! -f tests.sh; then cp ${srcdir}/tests.sh tests.sh; fi
+if test ! -f testall.sh; then cp ${srcdir}/testall.sh tests.sh; fi
if test ! -f monkey.au; then cp ${srcdir}/monkey.au monkey.au; fi
if test ! -f monkey.voc; then cp ${srcdir}/monkey.voc monkey.voc; fi
--- a/sox.1
+++ b/sox.1
@@ -32,8 +32,8 @@
.P
.B Format options:
.br
- [ -t \fIfiletype\fR ] [ -r \fIrate\fR ] [ -s/-u/-U/-A/-a/-i/-g ]
- [ -b/-w/-l/-f/-d/-D ]
+ [ -t \fIfiletype\fR ] [ -r \fIrate\fR ] [ -s/-u/-U/-A/-a/-i/-g/-f ]
+ [ -b/-w/-l ]
[ -c \fIchannels\fR ] [ -x ] [ -e ]
.P
.B Effects:
@@ -209,16 +209,16 @@
sample rate changing effect is not specified then a default one will internally
be ran by sox using its default parameters.
.TP 10
-\fB-s/-u/-U/-A/-a/-i/-g\fR
+\fB-s/-u/-U/-A/-a/-i/-g/-f\fR
The sample data encoding is signed linear (2's complement),
unsigned linear, U-law (logarithmic), A-law (logarithmic),
-ADPCM, IMA_ADPCM, or GSM.
+ADPCM, IMA_ADPCM, GSM, or Floating-point.
.br
U-law (actually shorthand for mu-law) and A-law are the U.S. and
international standards for logarithmic telephone sound compression.
When uncompressed it has roughly the precision of 12-byte PCM audio.
.br
-ADPCM is form of sound compression that has a good
+ADPCM is a form of sound compression that has a good
compromise between good sound quality and fast encoding/decoding
time. It is used for telephone sound compression and places were
full fidelity is not as important. When uncompressed it has roughly
@@ -234,10 +234,8 @@
European countries and its gaining popularity because of its
quality. It usually is CPU intensive to work with GSM audio data.
.TP 10
-\fB-b/-w/-l/-f/-d\fR
-The sample data size is in bytes, 16-bit words, 32-bit longwords,
-32-bit floats or 64-bit double floats.
-Floats and double floats are in native machine format.
+\fB-b/-w/-l\fR
+The sample data size is in bytes, 16-bit words, or 32-bit long words.
.TP 10
\fB-x\fR
The sample data is in XINU format; that is,
--- a/sox.txt
+++ b/sox.txt
@@ -19,8 +19,9 @@
[ -h ] [ -p ] [ -v volume ] [ -V ]
Format options:
- [ -t filetype ] [ -r rate ] [ -s/-u/-U/-A/-a/-i/-g ]
- [ -b/-w/-l/-f/-d/-D ]
+ [ -t filetype ] [ -r rate ] [ -s/-u/-U/-A/-a/-i/-g/-f
+ ]
+ [ -b/-w/-l ]
[ -c channels ] [ -x ] [ -e ]
Effects:
@@ -60,9 +61,9 @@
resample [ -qs | -q | -ql ] [ rolloff [ beta ] ]
reverb gain-out reverb-time delay [ delay ... ]
reverse
- silence above_periods [ duration threshold[ d | % | s]
+ silence above_periods [ duration threshold[ d | % ]
[ below_periods duration
- threshold[ d | % | s ]]
+ threshold[ d | % ]]
speed [ -c ] factor
split
stat [ -s n ] [ -rms ] [ -v ] [ -d ]
@@ -128,15 +129,15 @@
Format options:
- Format options effect the audio samples that they immedi�
- ately preceed. If they are placed before the input file
- name then they effect the input data. If they are placed
- before the output file name then they will effect the out�
- put data. By taking advantage of this, you can override a
- input file's corrupted header or produce an output file
- that is totally different style then the input file. It
- is also how sox is informed about the format of raw input
- data.
+ Format options effect the audio samples that they
+ immediately preceed. If they are placed before the input
+ file name then they effect the input data. If they are
+ placed before the output file name then they will effect
+ the output data. By taking advantage of this, you can
+ override a input file's corrupted header or produce an
+ output file that is totally different style then the input
+ file. It is also how sox is informed about the format of
+ raw input data.
-t filetype
gives the type of the sound sample file. Useful
@@ -153,17 +154,17 @@
specified then a default one will internally be
ran by sox using its default parameters.
- -s/-u/-U/-A/-a/-i/-g
+ -s/-u/-U/-A/-a/-i/-g/-f
The sample data encoding is signed linear (2's
complement), unsigned linear, U-law (logarith�
- mic), A-law (logarithmic), ADPCM, IMA_ADPCM, or
- GSM.
+ mic), A-law (logarithmic), ADPCM, IMA_ADPCM,
+ GSM, or Floating-point.
U-law (actually shorthand for mu-law) and A-law
are the U.S. and international standards for
logarithmic telephone sound compression. When
uncompressed it has roughly the precision of
12-byte PCM audio.
- ADPCM is form of sound compression that has a
+ ADPCM is a form of sound compression that has a
good compromise between good sound quality and
fast encoding/decoding time. It is used for
telephone sound compression and places were full
@@ -183,11 +184,8 @@
popularity because of its quality. It usually
is CPU intensive to work with GSM audio data.
- -b/-w/-l/-f/-d/-D
- The sample data size is in bytes, 16-bit words,
- 32-bit longwords, 32-bit floats, 64-bit double
- floats, or 80-bit IEEE floats. Floats and dou�
- ble floats are in native machine format.
+ -b/-w/-l The sample data size is in bytes, 16-bit words,
+ or 32-bit long words.
-x The sample data is in XINU format; that is, it
comes from a machine with the opposite word
@@ -194,24 +192,23 @@
order than yours and must be swapped according
to the word-size given above. Only 16-bit and
32-bit integer data may be swapped. Machine-
- format floating-point data is not portable.
- IEEE floats are a fixed, portable format.
+ format floating-point data is not portable.
-c channels
- The number of sound channels in the data file.
- This may be 1, 2, or 4; for mono, stereo, or
- quad sound data. To cause the output file to
- have a different number of channels than the
- input file, include this option with the output
+ The number of sound channels in the data file.
+ This may be 1, 2, or 4; for mono, stereo, or
+ quad sound data. To cause the output file to
+ have a different number of channels than the
+ input file, include this option with the output
file options. If the input and output file have
- a different number of channels then the avg
- effect must be used. If the avg effect is not
+ a different number of channels then the avg
+ effect must be used. If the avg effect is not
specified on the command line it will be invoked
internally with default parameters.
- -e When used after the input filename (so that it
- applies to the output file) it allows you to
- avoid giving an output filename and will not
+ -e When used after the input filename (so that it
+ applies to the output file) it allows you to
+ avoid giving an output filename and will not
produce an output file. It will apply any spec�
ified effects to the input file. This is mainly
useful with the stat effect but can be used with
@@ -221,198 +218,197 @@
-h Print version number and usage information.
- -p Run in preview mode and run fast. This will
+ -p Run in preview mode and run fast. This will
somewhat speed up sox when the output format has
- a different number of channels and a different
+ a different number of channels and a different
rate than the input file. Currently, this
defaults to using the rate effect instead of the
resample effect for sample rate changes.
-v volume Change amplitude (floating point); less than 1.0
- decreases, greater than 1.0 increases. May use
- a negative number to invert the phase of the
- audio data. It is interesting to note that we
+ decreases, greater than 1.0 increases. May use
+ a negative number to invert the phase of the
+ audio data. It is interesting to note that we
percieve volume logarithmically but this adjusts
the amplitude linearly.
- Note: see the stat effect for information on
- finding the maximum value that can be used with
- this option without causing audio data be be
+ Note: see the stat effect for information on
+ finding the maximum value that can be used with
+ this option without causing audio data be be
clipped.
- -V Print a description of processing phases. Use�
+ -V Print a description of processing phases. Use�
ful for figuring out exactly how sox is mangling
your sound samples.
FILE TYPES
- SoX attempts to determine the file type of input files
- automatically by looking at the header of the audio file.
- When it is unable to detect the file type or if its an
+ SoX attempts to determine the file type of input files
+ automatically by looking at the header of the audio file.
+ When it is unable to detect the file type or if its an
output file then it uses the file extension of the file to
- determine what type of file format handler to use. This
- can be overridden by specifying the "-t" option on the
+ determine what type of file format handler to use. This
+ can be overridden by specifying the "-t" option on the
command line.
- The input and output files may be read from standard in
- and out. This is done by specifying '-' as the filename.
+ The input and output files may be read from standard in
+ and out. This is done by specifying '-' as the filename.
- File formats which have headers are checked, if that
- header doesn't seem right, the program exits with an
+ File formats which have headers are checked, if that
+ header doesn't seem right, the program exits with an
appropriate message.
The following file formats are supported:
- .8svx Amiga 8SVX musical instrument description for�
+ .8svx Amiga 8SVX musical instrument description for�
mat.
- .aiff AIFF files used on Apple IIc/IIgs and SGI.
- Note: the AIFF format supports only one SSND
+ .aiff AIFF files used on Apple IIc/IIgs and SGI.
+ Note: the AIFF format supports only one SSND
chunk. It does not support multiple sound
- chunks, or the 8SVX musical instrument descrip�
+ chunks, or the 8SVX musical instrument descrip�
tion format. AIFF files are multimedia archives
- and can have multiple audio and picture chunks.
- You may need a separate archiver to work with
+ and can have multiple audio and picture chunks.
+ You may need a separate archiver to work with
them.
.au SUN Microsystems AU files. There are apparently
- many types of .au files; DEC has invented its
- own with a different magic number and word
+ many types of .au files; DEC has invented its
+ own with a different magic number and word
order. The .au handler can read these files but
- will not write them. Some .au files have valid
- AU headers and some do not. The latter are
- probably original SUN u-law 8000 hz samples.
- These can be dealt with using the .ul format
+ will not write them. Some .au files have valid
+ AU headers and some do not. The latter are
+ probably original SUN u-law 8000 hz samples.
+ These can be dealt with using the .ul format
(see below).
.avr Audio Visual Research
- The AVR format is produced by a number of com�
+ The AVR format is produced by a number of com�
mercial packages on the Mac.
.cdr CD-R
- CD-R files are used in mastering music on Com�
- pact Disks. The audio data on a CD-R disk is a
- raw audio file with a format of stereo 16-bit
+ CD-R files are used in mastering music on Com�
+ pact Disks. The audio data on a CD-R disk is a
+ raw audio file with a format of stereo 16-bit
signed samples at a 44khz sample rate. There is
- a special blocking/padding oddity at the end of
- the audio file and is why it needs its own han�
+ a special blocking/padding oddity at the end of
+ the audio file and is why it needs its own han�
dler.
.cvs Continuously Variable Slope Delta modulation
- Used to compress speech audio for applications
+ Used to compress speech audio for applications
such as voice mail.
.dat Text Data files
- These files contain a textual representation of
- the sample data. There is one line at the
+ These files contain a textual representation of
+ the sample data. There is one line at the
beginning that contains the sample rate. Subse�
- quent lines contain two numeric data items: the
+ quent lines contain two numeric data items: the
time since the beginning of the first sample and
the sample value. Values are normalized so that
- the maximum and minimum are 1.00 and -1.00.
- This file format can be used to create data
- files for external programs such as FFT analyz�
- ers or graph routines. SoX can also convert a
- file in this format back into one of the other
+ the maximum and minimum are 1.00 and -1.00.
+ This file format can be used to create data
+ files for external programs such as FFT analyz�
+ ers or graph routines. SoX can also convert a
+ file in this format back into one of the other
file formats.
.gsm GSM 06.10 Lossy Speech Compression
- A standard for compressing speech which is used
- in the Global Standard for Mobil telecommunica�
- tions (GSM). Its good for its purpose, shrink�
- ing audio data size, but it will introduce lots
- of noise when a given sound sample is encoded
+ A standard for compressing speech which is used
+ in the Global Standard for Mobil telecommunica�
+ tions (GSM). Its good for its purpose, shrink�
+ ing audio data size, but it will introduce lots
+ of noise when a given sound sample is encoded
and decoded multiple times. This format is used
- by some voice mail applications. It is rather
+ by some voice mail applications. It is rather
CPU intensive.
GSM in sox is optional and requires access to an
- external GSM library. To see if there is sup�
- port for gsm run sox -h and look for it under
+ external GSM library. To see if there is sup�
+ port for gsm run sox -h and look for it under
the list of supported file formats.
- .hcom Macintosh HCOM files. These are (apparently)
- Mac FSSD files with some variant of Huffman com�
- pression. The Macintosh has wacky file formats
- and this format handler apparently doesn't han�
- dle all the ones it should. Mac users will need
- your usual arsenal of file converters to deal
- with an HCOM file under Unix or DOS.
+ .hcom Macintosh HCOM files. These are (apparently)
+ Mac FSSD files with some variant of Huffman
+ compression. The Macintosh has wacky file for�
+ mats and this format handler apparently doesn't
+ handle all the ones it should. Mac users will
+ need your usual arsenal of file converters to
+ deal with an HCOM file under Unix or DOS.
.maud An Amiga format
An IFF-conform sound file type, registered by MS
- MacroSystem Computer GmbH, published along with
- the "Toccata" sound-card on the Amiga. Allows
- 8bit linear, 16bit linear, A-Law, u-law in mono
+ MacroSystem Computer GmbH, published along with
+ the "Toccata" sound-card on the Amiga. Allows
+ 8bit linear, 16bit linear, A-Law, u-law in mono
and stereo.
- .nul Null file handler. This is a fake file hander
- that act as if its reading a stream of 0's from
- a while or fake writing output to a file. This
+ .nul Null file handler. This is a fake file hander
+ that act as if its reading a stream of 0's from
+ a while or fake writing output to a file. This
is not a very useful file handler in most cases.
- It might be useful in some scripts were you do
- not want to read or write from a real file but
- would like to specify a filename for consis�
+ It might be useful in some scripts were you do
+ not want to read or write from a real file but
+ would like to specify a filename for consis�
tency.
.ogg Ogg Vorbis Compressed Audio.
Ogg Vorbis is a open, patent-free codec designed
- for compressing music and streaming audio. It
- is similar to MP3, VQF, AAC, and other lossy
+ for compressing music and streaming audio. It
+ is similar to MP3, VQF, AAC, and other lossy
formats. sox can decode all types of Ogg Vorbis
- files, but can only encode at 128 kbps. Decod�
- ing is somewhat CPU intensive and encoding is
+ files, but can only encode at 128 kbps. Decod�
+ ing is somewhat CPU intensive and encoding is
very CPU intensive.
- Ogg Vorbis in sox is optional and requires
+ Ogg Vorbis in sox is optional and requires
access to external Ogg Vorbis libraries. To see
- if there is support for Ogg Vorbis run sox -h
+ if there is support for Ogg Vorbis run sox -h
and look for it under the list of supported file
formats as "vorbis".
ossdsp OSS /dev/dsp device driver
This is a pseudo-file type and can be optionally
- compiled into Sox. Run sox -h to see if you
- have support for this file type. When this
- driver is used it allows you to open up the OSS
- /dev/dsp file and configure it to use the same
- data format as passed in to /fBSoX. It works
- for both playing and recording sound samples.
- When playing sound files it attempts to set up
- the OSS driver to use the same format as the
- input file. It is suggested to always override
- the output values to use the highest quality
+ compiled into Sox. Run sox -h to see if you
+ have support for this file type. When this
+ driver is used it allows you to open up the OSS
+ /dev/dsp file and configure it to use the same
+ data format as passed in to /fBSoX. It works
+ for both playing and recording sound samples.
+ When playing sound files it attempts to set up
+ the OSS driver to use the same format as the
+ input file. It is suggested to always override
+ the output values to use the highest quality
samples your sound card can handle. Example: -t
ossdsp -w -s /dev/dsp
.sf IRCAM Sound Files.
- Sound Files are used by academic music software
- such as the CSound package, and the MixView
+ Sound Files are used by academic music software
+ such as the CSound package, and the MixView
sound sample editor.
.sph
- SPHERE (SPeech HEader Resources) is a file for�
+ SPHERE (SPeech HEader Resources) is a file for�
mat defined by NIST (National Institute of Stan�
- dards and Technology) and is used with speech
- audio. SoX can read these files when they con�
- tain ulaw and PCM data. It will ignore any
- header information that says the data is
- compressed using shorten compression and will
- treat the data as either ulaw or PCM. This will
- allow SoX and the command line shorten program
- to be ran together using pipes to uncompress the
- data and then pass the result to SoX for pro�
- cessing.
+ dards and Technology) and is used with speech
+ audio. SoX can read these files when they con�
+ tain ulaw and PCM data. It will ignore any
+ header information that says the data is com�
+ pressed using shorten compression and will treat
+ the data as either ulaw or PCM. This will allow
+ SoX and the command line shorten program to be
+ ran together using pipes to uncompress the data
+ and then pass the result to SoX for processing.
.smp Turtle Beach SampleVision files.
- SMP files are for use with the PC-DOS package
- SampleVision by Turtle Beach Softworks. This
- package is for communication to several MIDI
- samplers. All sample rates are supported by the
- package, although not all are supported by the
- samplers themselves. Currently loop points are
+ SMP files are for use with the PC-DOS package
+ SampleVision by Turtle Beach Softworks. This
+ package is for communication to several MIDI
+ samplers. All sample rates are supported by the
+ package, although not all are supported by the
+ samplers themselves. Currently loop points are
ignored.
.snd
- Under DOS this file format is the same as the
- .sndt format. Under all other platforms it is
+ Under DOS this file format is the same as the
+ .sndt format. Under all other platforms it is
the same as the .au format.
.sndt SoundTool files.
@@ -420,132 +416,132 @@
sunau Sun /dev/audio device driver
This is a pseudo-file type and can be optionally
- compiled into Sox. Run sox -h to see if you
- have support for this file type. When this
- driver is used it allows you to open up a Sun
+ compiled into Sox. Run sox -h to see if you
+ have support for this file type. When this
+ driver is used it allows you to open up a Sun
/dev/audio file and configure it to use the same
- data type as passed in to Sox. It works for
- both playing and recording sound samples. When
- playing sound files it attempts to set up the
+ data type as passed in to Sox. It works for
+ both playing and recording sound samples. When
+ playing sound files it attempts to set up the
audio driver to use the same format as the input
- file. It is suggested to always override the
+ file. It is suggested to always override the
output values to use the highest quality samples
- your hardware can handle. Example: -t sunau -w
+ your hardware can handle. Example: -t sunau -w
-s /dev/audio or -t sunau -U -c 1 /dev/audio for
older sun equipment.
.txw Yamaha TX-16W sampler.
- A file format from a Yamaha sampling keyboard
- which wrote IBM-PC format 3.5" floppies. Han�
+ A file format from a Yamaha sampling keyboard
+ which wrote IBM-PC format 3.5" floppies. Han�
dles reading of files which do not have the sam�
- ple rate field set to one of the expected by
- looking at some other bytes in the attack/loop
- length fields, and defaulting to 33kHz if the
+ ple rate field set to one of the expected by
+ looking at some other bytes in the attack/loop
+ length fields, and defaulting to 33kHz if the
sample rate is still unknown.
.vms More info to come.
- Used to compress speech audio for applications
+ Used to compress speech audio for applications
such as voice mail.
.voc Sound Blaster VOC files.
- VOC files are multi-part and contain silence
- parts, looping, and different sample rates for
- different chunks. On input, the silence parts
- are filled out, loops are rejected, and sample
- data with a new sample rate is rejected.
- Silence with a different sample rate is gener�
- ated appropriately. On output, silence is not
+ VOC files are multi-part and contain silence
+ parts, looping, and different sample rates for
+ different chunks. On input, the silence parts
+ are filled out, loops are rejected, and sample
+ data with a new sample rate is rejected.
+ Silence with a different sample rate is gener�
+ ated appropriately. On output, silence is not
detected, nor are impossible sample rates.
vorbis See .ogg format.
.wav Microsoft .WAV RIFF files.
- These appear to be very similar to IFF files,
- but not the same. They are the native sound
+ These appear to be very similar to IFF files,
+ but not the same. They are the native sound
file format of Windows. (Obviously, Windows was
- of such incredible importance to the computer
- industry that it just had to have its own sound
+ of such incredible importance to the computer
+ industry that it just had to have its own sound
file format.) Normally .wav files have all for�
- matting information in their headers, and so do
- not need any format options specified for an
- input file. If any are, they will override the
- file header, and you will be warned to this
+ matting information in their headers, and so do
+ not need any format options specified for an
+ input file. If any are, they will override the
+ file header, and you will be warned to this
effect. You had better know what you are doing!
- Output format options will cause a format con�
- version, and the .wav will written appropri�
- ately. Sox currently can read PCM, ULAW, ALAW,
- MS ADPCM, and IMA (or DVI) ADPCM. It can write
+ Output format options will cause a format con�
+ version, and the .wav will written appropri�
+ ately. Sox currently can read PCM, ULAW, ALAW,
+ MS ADPCM, and IMA (or DVI) ADPCM. It can write
all of these formats including (NEW!) the ADPCM
encoding.
.wve Psion 8-bit alaw
- These are 8-bit a-law 8khz sound files used on
+ These are 8-bit a-law 8khz sound files used on
the Psion palmtop portable computer.
.raw Raw files (no header).
- The sample rate, size (byte, word, etc), and
+ The sample rate, size (byte, word, etc), and
encoding (signed, unsigned, etc.) of the sample
- file must be given. The number of channels
+ file must be given. The number of channels
defaults to 1.
.ub, .sb, .uw, .sw, .ul, .al, .sl
- These are several suffices which serve as a
- shorthand for raw files with a given size and
- encoding. Thus, ub, sb, uw, sw, ul and sl cor�
- respond to "unsigned byte", "signed byte",
- "unsigned word", "signed word", "ulaw" (byte),
- "alaw" (byte), and "signed long". The sample
- rate defaults to 8000 hz if not explicitly set,
- and the number of channels (as always) defaults
- to 1. There are lots of Sparc samples floating
- around in u-law format with no header and fixed
- at a sample rate of 8000 hz. (Certain sound
+ These are several suffices which serve as a
+ shorthand for raw files with a given size and
+ encoding. Thus, ub, sb, uw, sw, ul and sl cor�
+ respond to "unsigned byte", "signed byte",
+ "unsigned word", "signed word", "ulaw" (byte),
+ "alaw" (byte), and "signed long". The sample
+ rate defaults to 8000 hz if not explicitly set,
+ and the number of channels (as always) defaults
+ to 1. There are lots of Sparc samples floating
+ around in u-law format with no header and fixed
+ at a sample rate of 8000 hz. (Certain sound
management software cheerfully ignores the head�
- ers.) Similarly, most Mac sound files are in
+ ers.) Similarly, most Mac sound files are in
unsigned byte format with a sample rate of 11025
or 22050 hz.
- .auto This is a ``meta-type'': specifying this type
- for an input file triggers some code that tries
- to guess the real type by looking for magic
- words in the header. If the type can't be
- guessed, the program exits with an error mes�
- sage. The input must be a plain file, not a
+ .auto This is a ``meta-type'': specifying this type
+ for an input file triggers some code that tries
+ to guess the real type by looking for magic
+ words in the header. If the type can't be
+ guessed, the program exits with an error mes�
+ sage. The input must be a plain file, not a
pipe. This type can't be used for output files.
EFFECTS
Multiple effects may be applied to the audio data by spec�
- ifying them one after another at the end of the command
+ ifying them one after another at the end of the command
line.
avg [ -l | -r | -f | -b | n,n,...,n ]
- Reduce the number of channels by averaging the
- samples, or duplicate channels to increase the
- number of channels. This effect is automati�
- cally used when the number of input channels
+ Reduce the number of channels by averaging the
+ samples, or duplicate channels to increase the
+ number of channels. This effect is automati�
+ cally used when the number of input channels
differ from the number of output channels. When
- reducing the number of channels it is possible
- to manually specify the avg effect and use the
- -l, -r, -f, or -b options to select only the
- left, right, front, or back channel(s) for the
- output instead of averaging the channels. The
- -f and -b options maintain left/right stereo
+ reducing the number of channels it is possible
+ to manually specify the avg effect and use the
+ -l, -r, -f, or -b options to select only the
+ left, right, front, or back channel(s) for the
+ output instead of averaging the channels. The
+ -f and -b options maintain left/right stereo
separation; use the avg effect twice to select a
single channel.
The avg effect can also be invoked with up to 16
double-precision numbers, which specify the pro�
- portion of each input channel that is to be
- mixed into each output channel. In two-channel
+ portion of each input channel that is to be
+ mixed into each output channel. In two-channel
mode, 4 numbers are given: l->l, l->r, r->l, and
- r->r, respectively. In four-channel mode, the
- first 4 numbers give the proportions for the
- left-front output channel, as follows: lf->lf,
+ r->r, respectively. In four-channel mode, the
+ first 4 numbers give the proportions for the
+ left-front output channel, as follows: lf->lf,
rf->lf, lb->lf, and rb->rf. The next 4 give the
right-front output in the same order, then left-
back and right-back.
- It is also possible to use the 16 numbers to
+ It is also possible to use the 16 numbers to
expand or reduce the channel count; just specify
0 for unused channels. Finally, if fewer than 4
numbers are given, certain special abbreviations
@@ -552,24 +548,24 @@
may be invoked; see the source code for details.
band [ -n ] center [ width ]
- Apply a band-pass filter. The frequency
+ Apply a band-pass filter. The frequency
response drops logarithmically around the center
- frequency. The width gives the slope of the
- drop. The frequencies at center + width and
- center - width will be half of their original
+ frequency. The width gives the slope of the
+ drop. The frequencies at center + width and
+ center - width will be half of their original
amplitudes. Band defaults to a mode oriented to
pitched signals, i.e. voice, singing, or instru�
- mental music. The -n (for noise) option uses
- the alternate mode for un-pitched signals.
- Warning: -n introduces a power-gain of about
- 11dB in the filter, so beware of output clip�
+ mental music. The -n (for noise) option uses
+ the alternate mode for un-pitched signals.
+ Warning: -n introduces a power-gain of about
+ 11dB in the filter, so beware of output clip�
ping. Band introduces noise in the shape of the
filter, i.e. peaking at the center frequency and
- settling around it. See filter for a bandpass
+ settling around it. See filter for a bandpass
effect with steeper shoulders.
bandpass frequency bandwidth
- Butterworth bandpass filter. Description coming
+ Butterworth bandpass filter. Description coming
soon!
bandreject frequency bandwidth
@@ -579,10 +575,10 @@
chorus gain-in gain-out delay decay speed depth
-s | -t [ delay decay speed depth -s | -t ... ]
- Add a chorus to a sound sample. Each quadtuple
- delay/decay/speed/depth gives the delay in mil�
- liseconds and the decay (relative to gain-in)
- with a modulation speed in Hz using depth in
+ Add a chorus to a sound sample. Each quadtuple
+ delay/decay/speed/depth gives the delay in mil�
+ liseconds and the decay (relative to gain-in)
+ with a modulation speed in Hz using depth in
milliseconds. The modulation is either sinodial
(-s) or triangular (-t). Gain-out is the volume
of the output.
@@ -592,85 +588,85 @@
in-dB1,out-dB1[,in-dB2,out-dB2...]
[gain [initial-volume [delay ] ] ]
- Compand (compress or expand) the dynamic range
- of a sample. The attack and decay time specify
- the integration time over which the absolute
- value of the input signal is integrated to
+ Compand (compress or expand) the dynamic range
+ of a sample. The attack and decay time specify
+ the integration time over which the absolute
+ value of the input signal is integrated to
determine its volume; attacks refer to increases
- in volume and decays refer to decreases. Where
- more than one pair of attack/decay parameters
- are specified, each channel is treated sepa�
- rately and the number of pairs must agree with
+ in volume and decays refer to decreases. Where
+ more than one pair of attack/decay parameters
+ are specified, each channel is treated sepa�
+ rately and the number of pairs must agree with
the number of input channels. The second param�
- eter is a list of points on the compander's
- transfer function specified in dB relative to
+ eter is a list of points on the compander's
+ transfer function specified in dB relative to
the maximum possible signal amplitude. The
- input values must be in a strictly increasing
+ input values must be in a strictly increasing
order but the transfer function does not have to
be monotonically rising. The special value -inf
- may be used to indicate that the input volume
- should be associated output volume. The points
+ may be used to indicate that the input volume
+ should be associated output volume. The points
-inf,-inf and 0,0 are assumed; the latter may be
overridden, but the former may not.
The third (optional) parameter is a postprocess�
- ing gain in dB which is applied after the com�
- pression has taken place; the fourth (optional)
+ ing gain in dB which is applied after the com�
+ pression has taken place; the fourth (optional)
parameter is an initial volume to be assumed for
- each channel when the effect starts. This per�
- mits the user to supply a nominal level ini�
- tially, so that, for example, a very large gain
- is not applied to initial signal levels before
- the companding action has begun to operate: it
- is quite probable that in such an event, the
- output would be severely clipped while the com�
+ each channel when the effect starts. This per�
+ mits the user to supply a nominal level ini�
+ tially, so that, for example, a very large gain
+ is not applied to initial signal levels before
+ the companding action has begun to operate: it
+ is quite probable that in such an event, the
+ output would be severely clipped while the com�
pander gain properly adjusts itself.
- The fifth (optional) parameter is a delay in
- seconds. The input signal is analyzed immedi�
+ The fifth (optional) parameter is a delay in
+ seconds. The input signal is analyzed immedi�
ately to control the compander, but it is
delayed before being fed to the volume adjuster.
- Specifying a delay approximately equal to the
- attack/decay times allows the compander to
- effectively operate in a "predictive" rather
+ Specifying a delay approximately equal to the
+ attack/decay times allows the compander to
+ effectively operate in a "predictive" rather
than a reactive mode.
copy Copy the input file to the output file. This is
- the default effect if both files have the same
+ the default effect if both files have the same
sampling rate.
dcshift shift [ limitergain ]
- DC Shift the audio data, with basic linear
- amplitudate formula. This is most useful if
- your audio data tends to not be centered around
- a value of 0. Shifting it back will allow you
+ DC Shift the audio data, with basic linear
+ amplitudate formula. This is most useful if
+ your audio data tends to not be centered around
+ a value of 0. Shifting it back will allow you
to get the most volume adjustments without clip�
ping audio data.
- The first option is the dcshift value. It is a
- floating point number that indicates the amount
+ The first option is the dcshift value. It is a
+ floating point number that indicates the amount
to shift.
- An option limtergain value can be specified as
+ An option limtergain value can be specified as
well. It should have a value much less then 1.0
and is used only on peaks to prevent clipping.
- deemph Apply a treble attenuation shelving filter to
+ deemph Apply a treble attenuation shelving filter to
samples in audio cd format. The frequency
- response of pre-emphasized recordings is recti�
- fied. The filtering is defined in the standard
+ response of pre-emphasized recordings is recti�
+ fied. The filtering is defined in the standard
document ISO 908.
- earwax Makes sound easier to listen to on headphones.
+ earwax Makes sound easier to listen to on headphones.
Adds audio-cues to samples in audio cd format so
- that when listened to on headphones the stereo
- image is moved from inside your head (standard
- for headphones) to outside and in front of the
+ that when listened to on headphones the stereo
+ image is moved from inside your head (standard
+ for headphones) to outside and in front of the
listener (standard for speakers). See
- www.geocities.com/beinges for a full explana�
+ www.geocities.com/beinges for a full explana�
tion.
echo gain-in gain-out delay decay [ delay decay ... ]
Add echoing to a sound sample. Each delay/decay
- part gives the delay in milliseconds and the
+ part gives the delay in milliseconds and the
decay (relative to gain-in) of that echo. Gain-
out is the volume of the output.
@@ -677,7 +673,7 @@
echos gain-in gain-out delay decay [ delay decay ... ]
Add a sequence of echos to a sound sample. Each
delay/decay part gives the delay in milliseconds
- and the decay (relative to gain-in) of that
+ and the decay (relative to gain-in) of that
echo. Gain-out is the volume of the output.
fade [ type ] fade-in-length
@@ -686,63 +682,63 @@
Add a fade effect to the beginning, end, or both
of the audio data.
- For fade-ins, this starts from the first sample
+ For fade-ins, this starts from the first sample
and ramps the volume of the audio from 0 to full
- volume over fade-in-length seconds. Specify 0
+ volume over fade-in-length seconds. Specify 0
seconds if no fade-in is wanted.
- For fade-outs, the audio data will be truncated
- at the stop-time and the volume will be ramped
+ For fade-outs, the audio data will be truncated
+ at the stop-time and the volume will be ramped
from full volume down to 0 starting at fade-out-
- length seconds before the stop-time. No fade-
+ length seconds before the stop-time. No fade-
out is performed if these options are not speci�
fied.
- All times can be specified in either periods of
- time or sample counts. To specify time periods
+ All times can be specified in either periods of
+ time or sample counts. To specify time periods
use the format hh:mm:ss.frac format. To specify
- using sample counts, specify the number of sam�
- ples and append the letter 's' to the sample
+ using sample counts, specify the number of sam�
+ ples and append the letter 's' to the sample
count (for example 8000s).
- An optional type can be specified to change the
- type of envelope. Choices are q for quarter of
- a sinewave, h for half a sinewave, t for linear
- slope, l for logarithmic, and p for inverted
+ An optional type can be specified to change the
+ type of envelope. Choices are q for quarter of
+ a sinewave, h for half a sinewave, t for linear
+ slope, l for logarithmic, and p for inverted
parabola. The default is a linear slope.
filter [ low ]-[ high ] [ window-len [ beta ] ]
Apply a Sinc-windowed lowpass, highpass, or
- bandpass filter of given window length to the
- signal. low refers to the frequency of the
- lower 6dB corner of the filter. high refers to
- the frequency of the upper 6dB corner of the
+ bandpass filter of given window length to the
+ signal. low refers to the frequency of the
+ lower 6dB corner of the filter. high refers to
+ the frequency of the upper 6dB corner of the
filter.
- A lowpass filter is obtained by leaving low
- unspecified, or 0. A highpass filter is
- obtained by leaving high unspecified, or 0, or
- greater than or equal to the Nyquist frequency.
+ A lowpass filter is obtained by leaving low
+ unspecified, or 0. A highpass filter is
+ obtained by leaving high unspecified, or 0, or
+ greater than or equal to the Nyquist frequency.
The window-len, if unspecified, defaults to 128.
- Longer windows give a sharper cutoff, smaller
+ Longer windows give a sharper cutoff, smaller
windows a more gradual cutoff.
- The beta, if unspecified, defaults to 16. This
- selects a Kaiser window. You can select a Nut�
- tall window by specifying anything <= 2.0 here.
- For more discussion of beta, look under the
- resample effect.
+ The beta, if unspecified, defaults to 16. This
+ selects a Kaiser window. You can select a
+ Nuttall window by specifying anything <= 2.0
+ here. For more discussion of beta, look under
+ the resample effect.
flanger gain-in gain-out delay decay speed < -s | -t >
- Add a flanger to a sound sample. Each triple
- delay/decay/speed gives the delay in millisec�
- onds and the decay (relative to gain-in) with a
+ Add a flanger to a sound sample. Each triple
+ delay/decay/speed gives the delay in millisec�
+ onds and the decay (relative to gain-in) with a
modulation speed in Hz. The modulation is
- either sinodial (-s) or triangular (-t). Gain-
+ either sinodial (-s) or triangular (-t). Gain-
out is the volume of the output.
highp frequency
- Apply a single pole recursive high-pass filter.
+ Apply a single pole recursive high-pass filter.
The frequency response drops logarithmically
with I frequency in the middle of the drop. The
slope of the filter is quite gentle. See filter
@@ -749,75 +745,75 @@
for a highpass effect with sharper cutoff.
highpass frequency
- Butterworth highpass filter. Description com�
+ Butterworth highpass filter. Description com�
ming soon!
lowp frequency
- Apply a single pole recursive low-pass filter.
+ Apply a single pole recursive low-pass filter.
The frequency response drops logarithmically
- with frequency in the middle of the drop. The
+ with frequency in the middle of the drop. The
slope of the filter is quite gentle. See filter
for a lowpass effect with sharper cutoff.
lowpass frequency
- Butterworth lowpass filter. Description coming
+ Butterworth lowpass filter. Description coming
soon!
map Display a list of loops in a sample, and miscel�
laneous loop info.
- mask Add "masking noise" to signal. This effect
- deliberately adds white noise to a sound in
- order to mask quantization effects, created by
- the process of playing a sound digitally. It
- tends to mask buzzing voices, for example. It
- adds 1/2 bit of noise to the sound file at the
+ mask Add "masking noise" to signal. This effect
+ deliberately adds white noise to a sound in
+ order to mask quantization effects, created by
+ the process of playing a sound digitally. It
+ tends to mask buzzing voices, for example. It
+ adds 1/2 bit of noise to the sound file at the
output bit depth.
pan direction
- Pan the sound of an audio file from one channel
+ Pan the sound of an audio file from one channel
to another. This is done by changing the volume
- of the input channels so that it fades out on
- one channel and fades-in on another. If the
- number of input channels is different then the
+ of the input channels so that it fades out on
+ one channel and fades-in on another. If the
+ number of input channels is different then the
number of output channels then this effect tries
- to intelligently handle this. For instance, if
+ to intelligently handle this. For instance, if
the input contains 1 channel and the output con�
- tains 2 channels, then it will create the miss�
- ing channel itself. The direction is a value
- from -1.0 to 1.0. -1.0 represents far left and
- 1.0 represents far right. Numbers in between
+ tains 2 channels, then it will create the miss�
+ ing channel itself. The direction is a value
+ from -1.0 to 1.0. -1.0 represents far left and
+ 1.0 represents far right. Numbers in between
will start the pan effect without totally muting
the opposite channel.
phaser gain-in gain-out delay decay speed < -s | -t >
- Add a phaser to a sound sample. Each triple
- delay/decay/speed gives the delay in millisec�
- onds and the decay (relative to gain-in) with a
+ Add a phaser to a sound sample. Each triple
+ delay/decay/speed gives the delay in millisec�
+ onds and the decay (relative to gain-in) with a
modulation speed in Hz. The modulation is
- either sinodial (-s) or triangular (-t). The
+ either sinodial (-s) or triangular (-t). The
decay should be less than 0.5 to avoid feedback.
Gain-out is the volume of the output.
pick [ -1 | -2 | -3 | -4 | -l | -r ]
- Select the left or right channel of a stereo
- sample, or one of four channels in a quadro�
- phonic sample. The -l and -r options represent
- either the left or right channel. It is
- required that you use the -c 1 command line
+ Select the left or right channel of a stereo
+ sample, or one of four channels in a quadro�
+ phonic sample. The -l and -r options represent
+ either the left or right channel. It is
+ required that you use the -c 1 command line
option in order to force the output file to con�
tain only 1 channel.
pitch shift [ width interpole fade ]
- Change the pitch of file without affecting its
+ Change the pitch of file without affecting its
duration by cross-fading shifted samples. shift
is given in cents. Use a positive value to shift
- to treble, negative value to shift to bass.
- Default shift is 0. width of window is in ms.
- Default width is 20ms. Try 30ms to lower pitch,
- and 10ms to raise pitch. interpole option, can
+ to treble, negative value to shift to bass.
+ Default shift is 0. width of window is in ms.
+ Default width is 20ms. Try 30ms to lower pitch,
+ and 10ms to raise pitch. interpole option, can
be "cubic" or "linear". Default is "cubic". The
- fade option, can be "cos", "hamming", "linear"
+ fade option, can be "cos", "hamming", "linear"
or "trapezoid". Default is "cos".
polyphase [ -w < nut / ham > ]
@@ -826,47 +822,47 @@
[ -cutoff # ]
Translate input sampling rate to output sampling
- rate via polyphase interpolation, a DSP algo�
- rithm. This method is slow and uses lots of
+ rate via polyphase interpolation, a DSP algo�
+ rithm. This method is slow and uses lots of
RAM, but gives much better results than rate.
- -w < nut / ham > : select either a Nuttal (~90
- dB stopband) or Hamming (~43 dB stopband) win�
+ -w < nut / ham > : select either a Nuttal (~90
+ dB stopband) or Hamming (~43 dB stopband) win�
dow. Default is nut.
- -width long / short / # : specify the (approxi�
- mate) width of the filter. long is 1024 sam�
- ples; short is 128 samples. Alternatively, an
+ -width long / short / # : specify the (approxi�
+ mate) width of the filter. long is 1024 sam�
+ ples; short is 128 samples. Alternatively, an
exact number can be used. Default is long. The
- short option is not recommended, as it produces
+ short option is not recommended, as it produces
poor quality results.
- -cutoff # : specify the filter cutoff frequency
- in terms of fraction of frequency bandwidth,
- also know as the Nyquist frequency. Please see
- the resample effect for further information on
- Nyquist frequency. If upsampling, then this is
- the fraction of the original signal that should
- go through. If downsampling, this is the frac�
- tion of the signal left after downsampling.
+ -cutoff # : specify the filter cutoff frequency
+ in terms of fraction of frequency bandwidth,
+ also know as the Nyquist frequency. Please see
+ the resample effect for further information on
+ Nyquist frequency. If upsampling, then this is
+ the fraction of the original signal that should
+ go through. If downsampling, this is the frac�
+ tion of the signal left after downsampling.
Default is 0.95. Remember that this is a float.
rate Translate input sampling rate to output sampling
- rate via linear interpolation to the Least Com�
+ rate via linear interpolation to the Least Com�
mon Multiple of the two sampling rates. This is
- the default effect if the two files have
- different sampling rates and the preview options
- was specified. This is fast but noisy: the
- spectrum of the original sound will be shifted
- upwards and duplicated faintly when up-translat�
- ing by a multiple.
+ the default effect if the two files have differ�
+ ent sampling rates and the preview options was
+ specified. This is fast but noisy: the spectrum
+ of the original sound will be shifted upwards
+ and duplicated faintly when up-translating by a
+ multiple.
- Lerp-ing is acceptable for cheap 8-bit sound
- hardware, but for CD-quality sound you should
- instead use either resample or polyphase. If
+ Lerp-ing is acceptable for cheap 8-bit sound
+ hardware, but for CD-quality sound you should
+ instead use either resample or polyphase. If
you are wondering which rate changing effects to
- use, you will want to read a detailed analysis
+ use, you will want to read a detailed analysis
of all of them at http://eakaw2.et.tu-dres�
den.de/~wilde/resample/resample.html
@@ -873,26 +869,26 @@
resample [ -qs | -q | -ql ] [ rolloff [ beta ] ]
Translate input sampling rate to output sampling
rate via simulated analog filtration. This
- method is slower than rate, but gives much bet�
+ method is slower than rate, but gives much bet�
ter results.
By default, linear interpolation is used, with a
- window width about 45 samples at the lower of
- the two rate. This gives an accuracy of about
- 16 bits, but insufficient stopband rejection in
- the case that you want to have rolloff greater
+ window width about 45 samples at the lower of
+ the two rate. This gives an accuracy of about
+ 16 bits, but insufficient stopband rejection in
+ the case that you want to have rolloff greater
than about 0.80 of the Nyquist frequency.
- The -q* options will change the default values
- for rolloff and beta as well as use quadratic
- interpolation of filter coefficients, resulting
+ The -q* options will change the default values
+ for rolloff and beta as well as use quadratic
+ interpolation of filter coefficients, resulting
in about 24 bits precision. The -qs, -q, or -ql
- options specify increased accuracy at the cost
- of lower execution speed. It is optional to
- specify rolloff and beta parameters when using
+ options specify increased accuracy at the cost
+ of lower execution speed. It is optional to
+ specify rolloff and beta parameters when using
the -q* options.
- Following is a table of the reasonable defaults
+ Following is a table of the reasonable defaults
which are built-in to sox:
Option Window rolloff beta interpolation
@@ -904,78 +900,78 @@
------ ------ ------- ---- -------------
-qs, -q, or -ql use window lengths of 45, 75, or
- 149 samples, respectively, at the lower sample-
+ 149 samples, respectively, at the lower sample-
rate of the two files. This means progressively
- sharper stop-band rejection, at proportionally
+ sharper stop-band rejection, at proportionally
slower execution times.
- rolloff refers to the cut-off frequency of the
- low pass filter and is given in terms of the
- Nyquist frequency for the lower sample rate.
- rolloff therefore should be something between
+ rolloff refers to the cut-off frequency of the
+ low pass filter and is given in terms of the
+ Nyquist frequency for the lower sample rate.
+ rolloff therefore should be something between
0.0 and 1.0, in practice 0.8-0.95. The defaults
are indicated above.
The Nyquist frequency is equal to (sample rate /
- 2). Logically, this is because the A/D con�
- verter needs at least 2 samples to detect 1
- cycle at the Nyquist frequency. Frequencies
- higher then the Nyquist will actually appear as
- lower frequencies to the A/D converter and is
+ 2). Logically, this is because the A/D con�
+ verter needs at least 2 samples to detect 1
+ cycle at the Nyquist frequency. Frequencies
+ higher then the Nyquist will actually appear as
+ lower frequencies to the A/D converter and is
called aliasing. Normally, A/D converts run the
- signal through a highpass filter first to avoid
+ signal through a highpass filter first to avoid
these problems.
- Similar problems will happen in software when
- reducing the sample rate of an audio file (fre�
- quencies above the new Nyquist frequency can be
- aliased to lower frequencies). Therefore, a
- good resample effect will remove all frequency
+ Similar problems will happen in software when
+ reducing the sample rate of an audio file (fre�
+ quencies above the new Nyquist frequency can be
+ aliased to lower frequencies). Therefore, a
+ good resample effect will remove all frequency
information above the new Nyquist frequency.
- The rolloff refers to how close to the Nyquist
+ The rolloff refers to how close to the Nyquist
frequency this cutoff is, with closer being bet�
- ter. When increasing the sample rate of an
+ ter. When increasing the sample rate of an
audio file you would not expect to have any fre�
- quencies exist that are past the original
- Nyquist frequency. Because of resampling prop�
- erties, it is common to have alaising data cre�
- ated that is above the old Nyquist frequency.
- In that case the rolloff refers to how close to
+ quencies exist that are past the original
+ Nyquist frequency. Because of resampling prop�
+ erties, it is common to have alaising data cre�
+ ated that is above the old Nyquist frequency.
+ In that case the rolloff refers to how close to
the original Nyquist frequency to use a highpass
- filter to remove this false data, with closer
+ filter to remove this false data, with closer
also being better.
The beta parameter determines the type of filter
- window used. Any value greater than 2.0 is the
+ window used. Any value greater than 2.0 is the
beta for a Kaiser window. Beta <= 2.0 selects a
- Nuttall window. If unspecified, the default is
+ Nuttall window. If unspecified, the default is
a Kaiser window with beta 16.
In the case of Kaiser window (beta > 2.0), lower
- betas produce a somewhat faster transition from
- passband to stopband, at the cost of noticeable
- artifacts. A beta of 16 is the default, beta
- less than 10 is not recommended. If you want a
- sharper cutoff, don't use low beta's, use a
+ betas produce a somewhat faster transition from
+ passband to stopband, at the cost of noticeable
+ artifacts. A beta of 16 is the default, beta
+ less than 10 is not recommended. If you want a
+ sharper cutoff, don't use low beta's, use a
longer sample window. A Nuttall window is
- selected by specifying any 'beta' <= 2, and the
- Nuttall window has somewhat steeper cutoff than
- the default Kaiser window. You will probably
- not need to use the beta parameter at all,
- unless you are just curious about comparing the
+ selected by specifying any 'beta' <= 2, and the
+ Nuttall window has somewhat steeper cutoff than
+ the default Kaiser window. You will probably
+ not need to use the beta parameter at all,
+ unless you are just curious about comparing the
effects of Nuttall vs. Kaiser windows.
This is the default effect if the two files have
- different sampling rates. Default parameters
+ different sampling rates. Default parameters
are, as indicated above, Kaiser window of length
45, rolloff 0.80, beta 16, linear interpolation.
- NOTE: -qs is only slightly slower, but more
+ NOTE: -qs is only slightly slower, but more
accurate for 16-bit or higher precision.
- NOTE: In many cases of up-sampling, no interpo�
- lation is needed, as exact filter coefficients
+ NOTE: In many cases of up-sampling, no interpo�
+ lation is needed, as exact filter coefficients
can be computed in a reasonable amount of space.
To be precise, this is done when
@@ -985,211 +981,211 @@
reverb gain-out delay [ delay ... ]
Add reverberation to a sound sample. Each delay
- is given in milliseconds and its feedback is
- depending on the reverb-time in milliseconds.
- Each delay should be in the range of half to
+ is given in milliseconds and its feedback is
+ depending on the reverb-time in milliseconds.
+ Each delay should be in the range of half to
quarter of reverb-time to get a realistic rever�
beration. Gain-out is the volume of the output.
- reverse Reverse the sound sample completely. Included
+ reverse Reverse the sound sample completely. Included
for finding Satanic subliminals.
- silence above_periods [ duration threshold[ d | % | s]
+ silence above_periods [ duration threshold[ d | % ]
[ below_periods duration
- threshold[ d | % | s ]]
- Removes silence from the beginning or end of a
- sound file. Silence is anything below a speci�
+ threshold[ d | % ]]
+ Removes silence from the beginning or end of a
+ sound file. Silence is anything below a speci�
fied threshold.
- When trimming silence from the beginning of a
+ When trimming silence from the beginning of a
sound file, you specify a duration of audio that
- is above a given silence threshold before audio
- data is processed. You can also specify the
- count of periods of none silence you want to
- detect before processing audio data. Specify a
+ is above a given silence threshold before audio
+ data is processed. You can also specify the
+ count of periods of none silence you want to
+ detect before processing audio data. Specify a
period of 0 if you do not want to trim data from
the front of the sound file.
When optionally trimming silence form the end of
- a sound file, you specify the duration of audio
- that must be below a given threshold before
- stopping to process audio data. A count of
- periods that occur below the threshold may also
+ a sound file, you specify the duration of audio
+ that must be below a given threshold before
+ stopping to process audio data. A count of
+ periods that occur below the threshold may also
be speficied. If this options are not specified
- then data is not trimmed from the end of the
+ then data is not trimmed from the end of the
audio file.
- Duration counts may be in the format of time,
- hh.mm.ss.frac, or in the exact count of samples.
- Threshold may be suffixed with d, %, or s to
- indicated the value is in decibels, percent, or
- an exact signed long interger sample value. A
- value of '0s' will look for total silence.
+ Duration counts may be in the format of time,
+ hh:mm:ss.frac, or in the exact count of samples.
+ Threshold may be suffixed with d, or % to indi�
+ cated the value is in decibels or a percentage
+ of max value of the sample value. A value of
+ '0%' will look for total silence.
speed [ -c ] factor
- Speed up or down the sound, as a magnetic tape
+ Speed up or down the sound, as a magnetic tape
with a speed control. It affects both pitch and
- time. A factor of 1.0 means no change, and is
+ time. A factor of 1.0 means no change, and is
the default. 2.0 doubles speed, thus time
- length is cut by a half and pitch is one octave
- higher. 0.5 halves speed thus time length dou�
- bles and pitch is one octave lower. If the
+ length is cut by a half and pitch is one octave
+ higher. 0.5 halves speed thus time length dou�
+ bles and pitch is one octave lower. If the
optional -c parameter is used then the factor is
specified in "cents".
split Turn a mono sample into a stereo sample by copy�
- ing the input channel to the left and right
+ ing the input channel to the left and right
channels.
stat [ -s n ] [-rms ] [ -v ] [ -d ]
- Do a statistical check on the input file, and
+ Do a statistical check on the input file, and
print results on the standard error file. Audio
- data is passed unmodified from input to output
+ data is passed unmodified from input to output
file unless used along with the -e option.
The "Volume Adjustment:" field in the statistics
- gives you the argument to the -v number which
+ gives you the argument to the -v number which
will make the sample as loud as possible without
clipping.
The option -v will print out the "Volume Adjust�
- ment:" field's value only and return. This
- could be of use in scripts to auto convert the
+ ment:" field's value only and return. This
+ could be of use in scripts to auto convert the
volume.
- The -s n option is used to scale the input data
- by a given factor. The default value of n is
- the max value of a signed long variable
+ The -s n option is used to scale the input data
+ by a given factor. The default value of n is
+ the max value of a signed long variable
(0x7fffffff). Internal effects always work with
- signed long PCM data and so the value should
+ signed long PCM data and so the value should
relate to this fact.
- The -rms option will convert all output average
+ The -rms option will convert all output average
values to root mean square format.
There is also an optional parameter -d that will
- print out a hex dump of the sound file from the
- internal buffer that is in 32-bit signed PCM
- data. This is mainly only of use in tracking
- down endian problems that creep in to sox on
+ print out a hex dump of the sound file from the
+ internal buffer that is in 32-bit signed PCM
+ data. This is mainly only of use in tracking
+ down endian problems that creep in to sox on
cross-platform versions.
stretch factor [window fade shift fading]
- Time stretch file by a given factor. Change
+ Time stretch file by a given factor. Change
duration without affecting the pitch. factor of
- stretching: >1.0 lengthen, <1.0 shorten dura�
- tion. window size is in ms. Default is 20ms.
- The fade option, can be "lin". shift ratio, in
- [0.0 1.0]. Default depends on stretch factor.
- 1.0 to shorten, 0.8 to lengthen. The fading
- ratio, in [0.0 0.5]. The amount of a fade's
+ stretching: >1.0 lengthen, <1.0 shorten dura�
+ tion. window size is in ms. Default is 20ms.
+ The fade option, can be "lin". shift ratio, in
+ [0.0 1.0]. Default depends on stretch factor.
+ 1.0 to shorten, 0.8 to lengthen. The fading
+ ratio, in [0.0 0.5]. The amount of a fade's
default depends on factor and shift.
swap [ 1 2 | 1 2 3 4 ]
Swap channels in multi-channel sound files.
- Optionally, you may specify the channel order
- you would like the output in. This defaults to
+ Optionally, you may specify the channel order
+ you would like the output in. This defaults to
output channel 2 and then 1 for stereo and 2, 1,
- 4, 3 for quad-channels. An interesting feature
- is that you may duplicate a given channel by
- overwriting another. This is done by repeating
- an output channel on the command line. For
- example, swap 2 2 will overwrite channel 1 with
- channel 2's data; creating a stereo file with
+ 4, 3 for quad-channels. An interesting feature
+ is that you may duplicate a given channel by
+ overwriting another. This is done by repeating
+ an output channel on the command line. For
+ example, swap 2 2 will overwrite channel 1 with
+ channel 2's data; creating a stereo file with
both channels containing the same audio data.
synth [ length ] type mix [ freq [ -freq2 ]
[ off ] [ ph ] [ p1 ] [ p2 ] [ p3 ]
- The synth effect will generate various types of
- audio data. Although this effect is used to
+ The synth effect will generate various types of
+ audio data. Although this effect is used to
generate audio data, an input file must be spec�
- ified. The length of the input audio file
- determines the length of the output audio file.
- <length> length in sec or hh:mm:ss.frac,
+ ified. The length of the input audio file
+ determines the length of the output audio file.
+ <length> length in sec or hh:mm:ss.frac,
0=inputlength, default=0
<type> is sine, square, triangle, sawtooth,
trapetz, exp, whitenoise, pinknoise, brownnoise,
default=sine
<mix> is create, mix, amod, default=create
- <freq> frequency at beginning in Hz, not used
+ <freq> frequency at beginning in Hz, not used
for noise..
- <freq2> frequency at end in Hz, not used for
+ <freq2> frequency at end in Hz, not used for
noise.. <freq/2> can be given as %%n, where 'n'
- is the number of half notes in respect to A
+ is the number of half notes in respect to A
(440Hz)
- <off> Bias (DC-offset) of signal in percent,
+ <off> Bias (DC-offset) of signal in percent,
default=0
<ph> phase shift 0..100 shift phase 0..2*Pi, not
used for noise..
- <p1> square: Ton/Toff, triangle+trapetz: rising
+ <p1> square: Ton/Toff, triangle+trapetz: rising
slope time (0..100)
<p2> trapetz: ON time (0..100)
<p3> trapetz: falling slope position (0..100)
trim start [ length ]
- Trim can trim off unwanted audio data from the
+ Trim can trim off unwanted audio data from the
beginning and end of the audio file. Audio sam�
ples are not sent to the output stream until the
start location is reached.
- The optional length parameter tells the number
- of samples to output after the start sample and
- is used to trim off the back side of the audio
- data. Using a value of 0 for the start parame�
- ter will allow trimming off the back side only.
- Both options can be specified using either an
- amount of time and an exact count of samples.
- The format for specifying lengths in time is
+ The optional length parameter tells the number
+ of samples to output after the start sample and
+ is used to trim off the back side of the audio
+ data. Using a value of 0 for the start parame�
+ ter will allow trimming off the back side only.
+ Both options can be specified using either an
+ amount of time and an exact count of samples.
+ The format for specifying lengths in time is
hh:mm:ss.frac. A start value of 1:30.5 will not
- start until 1 minute, thirty and 1/2 seconds
- into the audio data. The format for specifying
- sample counts is the number of samples with the
- letter 's' appended to it. A value of 8000s
- will wait until 8000 samples are read before
+ start until 1 minute, thirty and 1/2 seconds
+ into the audio data. The format for specifying
+ sample counts is the number of samples with the
+ letter 's' appended to it. A value of 8000s
+ will wait until 8000 samples are read before
starting to process audio data.
vibro speed [ depth ]
- Add the world-famous Fender Vibro-Champ sound
+ Add the world-famous Fender Vibro-Champ sound
effect to a sound sample by using a sine wave as
the volume knob. Speed gives the Hertz value of
- the wave. This must be under 30. Depth gives
- the amount the volume is cut into by the sine
- wave, ranging 0.0 to 1.0 and defaulting to 0.5.
+ the wave. This must be under 30. Depth gives
+ the amount the volume is cut into by the sine
+ wave, ranging 0.0 to 1.0 and defaulting to 0.5.
vol gain [ type [ limitergain ] ]
- The vol effect is much like the command line
- option -v. It allows you to adjust the volume
- of an input file and allows you to specify the
- adjustment in relation to amplitude, power, or
- dB. If type is not specified then it defaults
+ The vol effect is much like the command line
+ option -v. It allows you to adjust the volume
+ of an input file and allows you to specify the
+ adjustment in relation to amplitude, power, or
+ dB. If type is not specified then it defaults
to amplitude.
- When type is amplitude then a linear change of
- the amplitude is performed based on the gain.
- Therefore, a value of 1.0 will keep the volume
- the same, 0.0 to < 1.0 will cause the volume to
+ When type is amplitude then a linear change of
+ the amplitude is performed based on the gain.
+ Therefore, a value of 1.0 will keep the volume
+ the same, 0.0 to < 1.0 will cause the volume to
decrease and values of > 1.0 will cause the vol�
- ume to increase. Beware of clipping audio data
- when the gain is greater then 1.0. A negative
- value performs the same adjustment while also
+ ume to increase. Beware of clipping audio data
+ when the gain is greater then 1.0. A negative
+ value performs the same adjustment while also
changing the phase.
- When type is power then a value of 1.0 also
+ When type is power then a value of 1.0 also
means no change in volume.
- When type is dB the amplitude is changed loga�
- rithmically. 0.0 is constant while +6 doubles
+ When type is dB the amplitude is changed loga�
+ rithmically. 0.0 is constant while +6 doubles
the amplitude.
- An optional limitergain value can be specified
- and should be a value much less then 1.0 (ie
- 0.05 or 0.02) and is used only on peaks to pre�
- vent clipping. Not specifying this parameter
- will cause no limiter to be used. In verbose
+ An optional limitergain value can be specified
+ and should be a value much less then 1.0 (ie
+ 0.05 or 0.02) and is used only on peaks to pre�
+ vent clipping. Not specifying this parameter
+ will cause no limiter to be used. In verbose
mode, this effect will display the percentage of
audio data that needed to be limited.
BUGS
- The syntax is horrific. Thats the breaks when trying to
+ The syntax is horrific. Thats the breaks when trying to
handle all things from the command line.
- Please report any bugs found in this version of sox to
+ Please report any bugs found in this version of sox to
Chris Bagwell (cbagwell@sprynet.com)
FILES
@@ -1197,10 +1193,10 @@
play(1), rec(1), soxexam(1)
NOTICES
- The version of Sox that accompanies this manual page is
+ The version of Sox that accompanies this manual page is
support by Chris Bagwell (cbagwell@users.sourceforge.net).
- Please refer any questions regarding it to this address.
- You may obtain the latest version at the the web site
+ Please refer any questions regarding it to this address.
+ You may obtain the latest version at the the web site
http://sox.sourceforge.net/
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -20,12 +20,15 @@
SED = @SED@
TAR = tar
RM = rm -f
+LN_S = @LN_S@
# Build macros.
CFLAGS = @CFLAGS@ @DEFS@ -I$(srcdir)
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
+LDFLAGS = -L. -Lgsm @LDFLAGS@
+LIBS = -lst @LIBS@
+EXEEXT = @EXEEXT@
+OBJEXT = @OBJEXT@
# Install directories
@@ -39,6 +42,7 @@
NEED_OSS = @NEED_OSS@
NEED_SUNAU = @NEED_SUNAU@
NEED_ALSA = @NEED_ALSA@
+GSM_SUPPORT = @GSM_SUPPORT@
PLAY_SUPPORT = @PLAY_SUPPORT@
# Objects.
@@ -65,18 +69,20 @@
LIBOBJS = $(FOBJ) $(EOBJ) handlers.o libst.o misc.o util.o getopt.o $(EXTRAOBJS)
+GSM_0 =
+GSM_1 = libgsm
PLAY_0 =
PLAY_1 = play
all: sox soxmix $(PLAY_$(PLAY_SUPPORT))
-sox: libst.a sox.o
+sox: libst.a $(GSM_$(GSM_SUPPORT)) sox.o
$(CC) $(LDFLAGS) -o sox sox.o $(LIBS)
soxmix.o: sox.c
$(CC) $(CFLAGS) -DSOXMIX -c -o soxmix.o $<
-soxmix: libst.a soxmix.o
+soxmix: libst.a $(GSM_$(GSM_SUPPORT)) soxmix.o
$(CC) $(LDFLAGS) -o soxmix soxmix.o $(LIBS)
play: play.in
@@ -86,6 +92,9 @@
$(AR) libst.a $(LIBOBJS)
$(RANLIB) libst.a
+libgsm:
+ cd gsm && $(MAKE)
+
man: $(srcdir)/sox.1 $(srcdir)/soxexam.1 $(srcdir)/libst.3
nroff -man $(srcdir)/sox.1 | col -b > sox.txt
nroff -man $(srcdir)/soxexam.1 | col -b > soxexam.txt
@@ -108,8 +117,8 @@
$(srcdir)/mkinstalldirs $(BINDIR)
$(INSTALL) -c -m 755 play $(BINDIR)
$(INSTALL) -c -m 644 $(srcdir)/play.1 $(MANDIR)/man1
- ln -s $(BINDIR)/play $(BINDIR)/rec
- ln -s $(MANDIR)/man1/play.1 $(MANDIR)/man1/rec.1
+ $(LN_S) $(BINDIR)/play $(BINDIR)/rec
+ $(LN_S) $(MANDIR)/man1/play.1 $(MANDIR)/man1/rec.1
install-lib: libst.a
$(srcdir)/mkinstalldirs $(LIBDIR)/man1
@@ -122,9 +131,11 @@
clean:
$(RM) *.o
+ cd gsm && $(RM) *.o
distclean:
$(RM) *~ *.o *.raw *.sf core sox soxmix libst.a play
+ cd gsm && $(RM) *~ *.o core libgsm.a Makefile
$(RM) config.cache config.log config.status config.h Makefile
tar:
--- a/src/gsm.c
+++ b/src/gsm.c
@@ -1,4 +1,4 @@
-#if defined(HAVE_LIBGSM)
+#if defined(ENABLE_GSM)
/*
* Copyright 1991, 1992, 1993 Guido van Rossum And Sundry Contributors.
* This source code is freely redistributable and may be used for
@@ -28,7 +28,7 @@
*/
#include "st_i.h"
-#include "gsm.h"
+#include "gsm/gsm.h"
#include <errno.h>
#define MAXCHANS 16
@@ -226,4 +226,4 @@
return st_gsmstopread(ft); /* destroy handles and free buffers */
}
-#endif /* HAVE_LIBGSM */
+#endif /* ENABLE_GSM */
--- /dev/null
+++ b/src/gsm/Makefile.in
@@ -1,0 +1,58 @@
+#
+# Makefile.in
+#
+# Processed by configure into a Makefile. We assume the environment in
+# which we are running is a POSIX'y environment. Thus, all of the standard
+# POSIX tools are available.
+#
+
+SHELL = /bin/sh
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+
+# Shell commands.
+
+CC = @CC@
+RANLIB = @RANLIB@
+AR = ar r
+RM = rm -f
+
+# Build macros.
+
+CFLAGS = @CFLAGS@ @DEFS@ -I$(top_srcdir)/gsm
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+EXEEXT = @EXEEXT@
+OBJEXT = @OBJEXT@
+
+# Objects.
+
+GSM_OBJECTS = add.o \
+ code.o \
+ decode.o \
+ lpc.o \
+ preprocess.o \
+ rpe.o \
+ gsm_destroy.o \
+ gsm_decode.o \
+ gsm_encode.o \
+ gsm_create.o \
+ short_term.o
+
+
+LIBOBJS = $(GSM_OBJECTS)
+
+all: libgsm.a
+
+libgsm.a: $(LIBOBJS)
+ $(AR) libgsm.a $(LIBOBJS)
+ $(RANLIB) libgsm.a
+
+clean:
+ $(RM) *.o
+
+distclean:
+ $(RM) *~ *.o core
+ $(RM) Makefile
--- /dev/null
+++ b/src/gsm/add.c
@@ -1,0 +1,234 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/src/gsm/Attic/add.c,v 1.1 2001/11/14 03:31:26 cbagwell Exp $ */
+
+/*
+ * See private.h for the more commonly used macro versions.
+ */
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "private.h"
+#include "gsm.h"
+
+#define saturate(x) \
+ ((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
+
+word gsm_add (word a, word b)
+{
+ longword sum = (longword)a + (longword)b;
+ return saturate(sum);
+}
+
+word gsm_sub (word a, word b)
+{
+ longword diff = (longword)a - (longword)b;
+ return saturate(diff);
+}
+
+word gsm_mult (word a, word b)
+{
+ if (a == MIN_WORD && b == MIN_WORD) return MAX_WORD;
+ else return SASR( (longword)a * (longword)b, 15 );
+}
+
+word gsm_mult_r (word a, word b)
+{
+ if (b == MIN_WORD && a == MIN_WORD) return MAX_WORD;
+ else {
+ longword prod = (longword)a * (longword)b + 16384;
+ prod >>= 15;
+ return prod & 0xFFFF;
+ }
+}
+
+word gsm_abs (word a)
+{
+ return a < 0 ? (a == MIN_WORD ? MAX_WORD : -a) : a;
+}
+
+longword gsm_L_mult (word a, word b)
+{
+ assert( a != MIN_WORD || b != MIN_WORD );
+ return ((longword)a * (longword)b) << 1;
+}
+
+longword gsm_L_add (longword a, longword b)
+{
+ if (a < 0) {
+ if (b >= 0) return a + b;
+ else {
+ ulongword A = (ulongword)-(a + 1) + (ulongword)-(b + 1);
+ return A >= MAX_LONGWORD ? MIN_LONGWORD :-(longword)A-2;
+ }
+ }
+ else if (b <= 0) return a + b;
+ else {
+ ulongword A = (ulongword)a + (ulongword)b;
+ return A > MAX_LONGWORD ? MAX_LONGWORD : A;
+ }
+}
+
+longword gsm_L_sub (longword a, longword b)
+{
+ if (a >= 0) {
+ if (b >= 0) return a - b;
+ else {
+ /* a>=0, b<0 */
+
+ ulongword A = (ulongword)a + -(b + 1);
+ return A >= MAX_LONGWORD ? MAX_LONGWORD : (A + 1);
+ }
+ }
+ else if (b <= 0) return a - b;
+ else {
+ /* a<0, b>0 */
+
+ ulongword A = (ulongword)-(a + 1) + b;
+ return A >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)A - 1;
+ }
+}
+
+static unsigned char const bitoff[ 256 ] = {
+ 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+word gsm_norm (longword a )
+/*
+ * the number of left shifts needed to normalize the 32 bit
+ * variable L_var1 for positive values on the interval
+ *
+ * with minimum of
+ * minimum of 1073741824 (01000000000000000000000000000000) and
+ * maximum of 2147483647 (01111111111111111111111111111111)
+ *
+ *
+ * and for negative values on the interval with
+ * minimum of -2147483648 (-10000000000000000000000000000000) and
+ * maximum of -1073741824 ( -1000000000000000000000000000000).
+ *
+ * in order to normalize the result, the following
+ * operation must be done: L_norm_var1 = L_var1 << norm( L_var1 );
+ *
+ * (That's 'ffs', only from the left, not the right..)
+ */
+{
+ assert(a != 0);
+
+ if (a < 0) {
+ if (a <= -1073741824) return 0;
+ a = ~a;
+ }
+
+ return a & 0xffff0000
+ ? ( a & 0xff000000
+ ? -1 + bitoff[ 0xFF & (a >> 24) ]
+ : 7 + bitoff[ 0xFF & (a >> 16) ] )
+ : ( a & 0xff00
+ ? 15 + bitoff[ 0xFF & (a >> 8) ]
+ : 23 + bitoff[ 0xFF & a ] );
+}
+
+longword gsm_L_asl (longword a, int n)
+{
+ if (n >= 32) return 0;
+ if (n <= -32) return -(a < 0);
+ if (n < 0) return gsm_L_asr(a, -n);
+ return a << n;
+}
+
+word gsm_asl (word a, int n)
+{
+ if (n >= 16) return 0;
+ if (n <= -16) return -(a < 0);
+ if (n < 0) return gsm_asr(a, -n);
+ return a << n;
+}
+
+longword gsm_L_asr (longword a, int n)
+{
+ if (n >= 32) return -(a < 0);
+ if (n <= -32) return 0;
+ if (n < 0) return a << -n;
+
+# ifdef SASR
+ return a >> n;
+# else
+ if (a >= 0) return a >> n;
+ else return -(longword)( -(ulongword)a >> n );
+# endif
+}
+
+word gsm_asr (word a, int n)
+{
+ if (n >= 16) return -(a < 0);
+ if (n <= -16) return 0;
+ if (n < 0) return a << -n;
+
+# ifdef SASR
+ return a >> n;
+# else
+ if (a >= 0) return a >> n;
+ else return -(word)( -(uword)a >> n );
+# endif
+}
+
+/*
+ * (From p. 46, end of section 4.2.5)
+ *
+ * NOTE: The following lines gives [sic] one correct implementation
+ * of the div(num, denum) arithmetic operation. Compute div
+ * which is the integer division of num by denum: with denum
+ * >= num > 0
+ */
+
+word gsm_div (word num, word denum)
+{
+ longword L_num = num;
+ longword L_denum = denum;
+ word div = 0;
+ int k = 15;
+
+ /* The parameter num sometimes becomes zero.
+ * Although this is explicitly guarded against in 4.2.5,
+ * we assume that the result should then be zero as well.
+ */
+
+ /* assert(num != 0); */
+
+ assert(num >= 0 && denum >= num);
+ if (num == 0)
+ return 0;
+
+ while (k--) {
+ div <<= 1;
+ L_num <<= 1;
+
+ if (L_num >= L_denum) {
+ L_num -= L_denum;
+ div++;
+ }
+ }
+
+ return div;
+}
--- /dev/null
+++ b/src/gsm/code.c
@@ -1,0 +1,91 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/src/gsm/Attic/code.c,v 1.1 2001/11/14 03:31:26 cbagwell Exp $ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "private.h"
+#include "gsm.h"
+
+/*
+ * 4.2 FIXED POINT IMPLEMENTATION OF THE RPE-LTP CODER
+ */
+
+void Gsm_Coder (
+
+ struct gsm_state * S,
+
+ word * s, /* [0..159] samples IN */
+
+/*
+ * The RPE-LTD coder works on a frame by frame basis. The length of
+ * the frame is equal to 160 samples. Some computations are done
+ * once per frame to produce at the output of the coder the
+ * LARc[1..8] parameters which are the coded LAR coefficients and
+ * also to realize the inverse filtering operation for the entire
+ * frame (160 samples of signal d[0..159]). These parts produce at
+ * the output of the coder:
+ */
+
+ word * LARc, /* [0..7] LAR coefficients OUT */
+
+/*
+ * Procedure 4.2.11 to 4.2.18 are to be executed four times per
+ * frame. That means once for each sub-segment RPE-LTP analysis of
+ * 40 samples. These parts produce at the output of the coder:
+ */
+
+ word * Nc, /* [0..3] LTP lag OUT */
+ word * bc, /* [0..3] coded LTP gain OUT */
+ word * Mc, /* [0..3] RPE grid selection OUT */
+ word * xmaxc,/* [0..3] Coded maximum amplitude OUT */
+ word * xMc /* [13*4] normalized RPE samples OUT */
+)
+{
+ int k;
+ word * dp = S->dp0 + 120; /* [ -120...-1 ] */
+ word * dpp = dp; /* [ 0...39 ] */
+
+ static word e[50];
+
+ word so[160];
+
+ Gsm_Preprocess (S, s, so);
+ Gsm_LPC_Analysis (S, so, LARc);
+ Gsm_Short_Term_Analysis_Filter (S, LARc, so);
+
+ for (k = 0; k <= 3; k++, xMc += 13) {
+
+ Gsm_Long_Term_Predictor ( S,
+ so+k*40, /* d [0..39] IN */
+ dp, /* dp [-120..-1] IN */
+ e + 5, /* e [0..39] OUT */
+ dpp, /* dpp [0..39] OUT */
+ Nc++,
+ bc++);
+
+ Gsm_RPE_Encoding ( S,
+ e + 5, /* e ][0..39][ IN/OUT */
+ xmaxc++, Mc++, xMc );
+ /*
+ * Gsm_Update_of_reconstructed_short_time_residual_signal
+ * ( dpp, e + 5, dp );
+ */
+
+ { register int i;
+ register longword ltmp;
+ for (i = 0; i <= 39; i++)
+ dp[ i ] = GSM_ADD( e[5 + i], dpp[i] );
+ }
+ dp += 40;
+ dpp += 40;
+
+ }
+ (void)memcpy( (char *)S->dp0, (char *)(S->dp0 + 160),
+ 120 * sizeof(*S->dp0) );
+}
--- /dev/null
+++ b/src/gsm/decode.c
@@ -1,0 +1,62 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/src/gsm/Attic/decode.c,v 1.1 2001/11/14 03:31:26 cbagwell Exp $ */
+
+#include <stdio.h>
+
+#include "private.h"
+#include "gsm.h"
+
+/*
+ * 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER
+ */
+
+static void Postprocessing (
+ struct gsm_state * S,
+ register word * s)
+{
+ register int k;
+ register word msr = S->msr;
+ register longword ltmp; /* for GSM_ADD */
+ register word tmp;
+
+ for (k = 160; k--; s++) {
+ tmp = GSM_MULT_R( msr, 28180 );
+ msr = GSM_ADD(*s, tmp); /* Deemphasis */
+ *s = GSM_ADD(msr, msr) & 0xFFF8; /* Truncation & Upscaling */
+ }
+ S->msr = msr;
+}
+
+void Gsm_Decoder (
+ struct gsm_state * S,
+
+ word * LARcr, /* [0..7] IN */
+
+ word * Ncr, /* [0..3] IN */
+ word * bcr, /* [0..3] IN */
+ word * Mcr, /* [0..3] IN */
+ word * xmaxcr, /* [0..3] IN */
+ word * xMcr, /* [0..13*4] IN */
+
+ word * s) /* [0..159] OUT */
+{
+ int j, k;
+ word erp[40], wt[160];
+ word * drp = S->dp0 + 120;
+
+ for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) {
+
+ Gsm_RPE_Decoding( S, *xmaxcr, *Mcr, xMcr, erp );
+ Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp );
+
+ for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ];
+ }
+
+ Gsm_Short_Term_Synthesis_Filter( S, LARcr, wt, s );
+ Postprocessing(S, s);
+}
--- /dev/null
+++ b/src/gsm/gsm.h
@@ -1,0 +1,71 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/*$Header: /cvsroot/sox/sox/src/gsm/Attic/gsm.h,v 1.1 2001/11/14 03:31:26 cbagwell Exp $*/
+
+#ifndef GSM_H
+#define GSM_H
+
+#ifdef __cplusplus
+# define NeedFunctionPrototypes 1
+#endif
+
+#if __STDC__
+# define NeedFunctionPrototypes 1
+#endif
+
+#ifdef _NO_PROTO
+# undef NeedFunctionPrototypes
+#endif
+
+#ifdef NeedFunctionPrototypes
+# include <stdio.h> /* for FILE * */
+#endif
+
+#undef GSM_P
+#if NeedFunctionPrototypes
+# define GSM_P( protos ) protos
+#else
+# define GSM_P( protos ) ( /* protos */ )
+#endif
+
+/*
+ * Interface
+ */
+
+typedef struct gsm_state * gsm;
+typedef short gsm_signal; /* signed 16 bit */
+typedef unsigned char gsm_byte;
+typedef gsm_byte gsm_frame[33]; /* 33 * 8 bits */
+
+#define GSM_MAGIC 0xD /* 13 kbit/s RPE-LTP */
+
+#define GSM_PATCHLEVEL 10
+#define GSM_MINOR 0
+#define GSM_MAJOR 1
+
+#define GSM_OPT_VERBOSE 1
+#define GSM_OPT_FAST 2
+#define GSM_OPT_LTP_CUT 3
+#define GSM_OPT_WAV49 4
+#define GSM_OPT_FRAME_INDEX 5
+#define GSM_OPT_FRAME_CHAIN 6
+
+extern gsm gsm_create GSM_P((void));
+extern void gsm_destroy GSM_P((gsm));
+
+extern int gsm_print GSM_P((FILE *, gsm, gsm_byte *));
+extern int gsm_option GSM_P((gsm, int, int *));
+
+extern void gsm_encode GSM_P((gsm, gsm_signal *, gsm_byte *));
+extern int gsm_decode GSM_P((gsm, gsm_byte *, gsm_signal *));
+
+extern int gsm_explode GSM_P((gsm, gsm_byte *, gsm_signal *));
+extern void gsm_implode GSM_P((gsm, gsm_signal *, gsm_byte *));
+
+#undef GSM_P
+
+#endif /* GSM_H */
--- /dev/null
+++ b/src/gsm/gsm_create.c
@@ -1,0 +1,27 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+static char const ident[] = "$Header: /cvsroot/sox/sox/src/gsm/Attic/gsm_create.c,v 1.1 2001/11/14 03:31:26 cbagwell Exp $";
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gsm.h"
+#include "private.h"
+
+gsm gsm_create ()
+{
+ gsm r;
+
+ r = (gsm)malloc(sizeof(struct gsm_state));
+ if (!r) return r;
+
+ memset((char *)r, 0, sizeof(*r));
+ r->nrp = 40;
+
+ return r;
+}
--- /dev/null
+++ b/src/gsm/gsm_decode.c
@@ -1,0 +1,360 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/src/gsm/Attic/gsm_decode.c,v 1.1 2001/11/14 03:31:26 cbagwell Exp $ */
+
+#include "private.h"
+
+#include "gsm.h"
+
+int gsm_decode (gsm s, gsm_byte * c, gsm_signal * target)
+{
+ word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4];
+
+#ifdef WAV49
+ if (s->wav_fmt) {
+
+ uword sr = 0;
+
+ s->frame_index = !s->frame_index;
+ if (s->frame_index) {
+
+ sr = *c++;
+ LARc[0] = sr & 0x3f; sr >>= 6;
+ sr |= (uword)*c++ << 2;
+ LARc[1] = sr & 0x3f; sr >>= 6;
+ sr |= (uword)*c++ << 4;
+ LARc[2] = sr & 0x1f; sr >>= 5;
+ LARc[3] = sr & 0x1f; sr >>= 5;
+ sr |= (uword)*c++ << 2;
+ LARc[4] = sr & 0xf; sr >>= 4;
+ LARc[5] = sr & 0xf; sr >>= 4;
+ sr |= (uword)*c++ << 2; /* 5 */
+ LARc[6] = sr & 0x7; sr >>= 3;
+ LARc[7] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 4;
+ Nc[0] = sr & 0x7f; sr >>= 7;
+ bc[0] = sr & 0x3; sr >>= 2;
+ Mc[0] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 1;
+ xmaxc[0] = sr & 0x3f; sr >>= 6;
+ xmc[0] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[1] = sr & 0x7; sr >>= 3;
+ xmc[2] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[3] = sr & 0x7; sr >>= 3;
+ xmc[4] = sr & 0x7; sr >>= 3;
+ xmc[5] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1; /* 10 */
+ xmc[6] = sr & 0x7; sr >>= 3;
+ xmc[7] = sr & 0x7; sr >>= 3;
+ xmc[8] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[9] = sr & 0x7; sr >>= 3;
+ xmc[10] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[11] = sr & 0x7; sr >>= 3;
+ xmc[12] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 4;
+ Nc[1] = sr & 0x7f; sr >>= 7;
+ bc[1] = sr & 0x3; sr >>= 2;
+ Mc[1] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 1;
+ xmaxc[1] = sr & 0x3f; sr >>= 6;
+ xmc[13] = sr & 0x7; sr >>= 3;
+ sr = *c++; /* 15 */
+ xmc[14] = sr & 0x7; sr >>= 3;
+ xmc[15] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[16] = sr & 0x7; sr >>= 3;
+ xmc[17] = sr & 0x7; sr >>= 3;
+ xmc[18] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[19] = sr & 0x7; sr >>= 3;
+ xmc[20] = sr & 0x7; sr >>= 3;
+ xmc[21] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[22] = sr & 0x7; sr >>= 3;
+ xmc[23] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[24] = sr & 0x7; sr >>= 3;
+ xmc[25] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 4; /* 20 */
+ Nc[2] = sr & 0x7f; sr >>= 7;
+ bc[2] = sr & 0x3; sr >>= 2;
+ Mc[2] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 1;
+ xmaxc[2] = sr & 0x3f; sr >>= 6;
+ xmc[26] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[27] = sr & 0x7; sr >>= 3;
+ xmc[28] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[29] = sr & 0x7; sr >>= 3;
+ xmc[30] = sr & 0x7; sr >>= 3;
+ xmc[31] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[32] = sr & 0x7; sr >>= 3;
+ xmc[33] = sr & 0x7; sr >>= 3;
+ xmc[34] = sr & 0x7; sr >>= 3;
+ sr = *c++; /* 25 */
+ xmc[35] = sr & 0x7; sr >>= 3;
+ xmc[36] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[37] = sr & 0x7; sr >>= 3;
+ xmc[38] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 4;
+ Nc[3] = sr & 0x7f; sr >>= 7;
+ bc[3] = sr & 0x3; sr >>= 2;
+ Mc[3] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 1;
+ xmaxc[3] = sr & 0x3f; sr >>= 6;
+ xmc[39] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[40] = sr & 0x7; sr >>= 3;
+ xmc[41] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2; /* 30 */
+ xmc[42] = sr & 0x7; sr >>= 3;
+ xmc[43] = sr & 0x7; sr >>= 3;
+ xmc[44] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[45] = sr & 0x7; sr >>= 3;
+ xmc[46] = sr & 0x7; sr >>= 3;
+ xmc[47] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[48] = sr & 0x7; sr >>= 3;
+ xmc[49] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[50] = sr & 0x7; sr >>= 3;
+ xmc[51] = sr & 0x7; sr >>= 3;
+
+ s->frame_chain = sr & 0xf;
+ }
+ else {
+ sr = s->frame_chain;
+ sr |= (uword)*c++ << 4; /* 1 */
+ LARc[0] = sr & 0x3f; sr >>= 6;
+ LARc[1] = sr & 0x3f; sr >>= 6;
+ sr = *c++;
+ LARc[2] = sr & 0x1f; sr >>= 5;
+ sr |= (uword)*c++ << 3;
+ LARc[3] = sr & 0x1f; sr >>= 5;
+ LARc[4] = sr & 0xf; sr >>= 4;
+ sr |= (uword)*c++ << 2;
+ LARc[5] = sr & 0xf; sr >>= 4;
+ LARc[6] = sr & 0x7; sr >>= 3;
+ LARc[7] = sr & 0x7; sr >>= 3;
+ sr = *c++; /* 5 */
+ Nc[0] = sr & 0x7f; sr >>= 7;
+ sr |= (uword)*c++ << 1;
+ bc[0] = sr & 0x3; sr >>= 2;
+ Mc[0] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 5;
+ xmaxc[0] = sr & 0x3f; sr >>= 6;
+ xmc[0] = sr & 0x7; sr >>= 3;
+ xmc[1] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[2] = sr & 0x7; sr >>= 3;
+ xmc[3] = sr & 0x7; sr >>= 3;
+ xmc[4] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[5] = sr & 0x7; sr >>= 3;
+ xmc[6] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2; /* 10 */
+ xmc[7] = sr & 0x7; sr >>= 3;
+ xmc[8] = sr & 0x7; sr >>= 3;
+ xmc[9] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[10] = sr & 0x7; sr >>= 3;
+ xmc[11] = sr & 0x7; sr >>= 3;
+ xmc[12] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ Nc[1] = sr & 0x7f; sr >>= 7;
+ sr |= (uword)*c++ << 1;
+ bc[1] = sr & 0x3; sr >>= 2;
+ Mc[1] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 5;
+ xmaxc[1] = sr & 0x3f; sr >>= 6;
+ xmc[13] = sr & 0x7; sr >>= 3;
+ xmc[14] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1; /* 15 */
+ xmc[15] = sr & 0x7; sr >>= 3;
+ xmc[16] = sr & 0x7; sr >>= 3;
+ xmc[17] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[18] = sr & 0x7; sr >>= 3;
+ xmc[19] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[20] = sr & 0x7; sr >>= 3;
+ xmc[21] = sr & 0x7; sr >>= 3;
+ xmc[22] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[23] = sr & 0x7; sr >>= 3;
+ xmc[24] = sr & 0x7; sr >>= 3;
+ xmc[25] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ Nc[2] = sr & 0x7f; sr >>= 7;
+ sr |= (uword)*c++ << 1; /* 20 */
+ bc[2] = sr & 0x3; sr >>= 2;
+ Mc[2] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 5;
+ xmaxc[2] = sr & 0x3f; sr >>= 6;
+ xmc[26] = sr & 0x7; sr >>= 3;
+ xmc[27] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[28] = sr & 0x7; sr >>= 3;
+ xmc[29] = sr & 0x7; sr >>= 3;
+ xmc[30] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[31] = sr & 0x7; sr >>= 3;
+ xmc[32] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[33] = sr & 0x7; sr >>= 3;
+ xmc[34] = sr & 0x7; sr >>= 3;
+ xmc[35] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1; /* 25 */
+ xmc[36] = sr & 0x7; sr >>= 3;
+ xmc[37] = sr & 0x7; sr >>= 3;
+ xmc[38] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ Nc[3] = sr & 0x7f; sr >>= 7;
+ sr |= (uword)*c++ << 1;
+ bc[3] = sr & 0x3; sr >>= 2;
+ Mc[3] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 5;
+ xmaxc[3] = sr & 0x3f; sr >>= 6;
+ xmc[39] = sr & 0x7; sr >>= 3;
+ xmc[40] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[41] = sr & 0x7; sr >>= 3;
+ xmc[42] = sr & 0x7; sr >>= 3;
+ xmc[43] = sr & 0x7; sr >>= 3;
+ sr = *c++; /* 30 */
+ xmc[44] = sr & 0x7; sr >>= 3;
+ xmc[45] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[46] = sr & 0x7; sr >>= 3;
+ xmc[47] = sr & 0x7; sr >>= 3;
+ xmc[48] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[49] = sr & 0x7; sr >>= 3;
+ xmc[50] = sr & 0x7; sr >>= 3;
+ xmc[51] = sr & 0x7; sr >>= 3;
+ }
+ }
+ else
+#endif
+ {
+ /* GSM_MAGIC = (*c >> 4) & 0xF; */
+
+ if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1;
+
+ LARc[0] = (*c++ & 0xF) << 2; /* 1 */
+ LARc[0] |= (*c >> 6) & 0x3;
+ LARc[1] = *c++ & 0x3F;
+ LARc[2] = (*c >> 3) & 0x1F;
+ LARc[3] = (*c++ & 0x7) << 2;
+ LARc[3] |= (*c >> 6) & 0x3;
+ LARc[4] = (*c >> 2) & 0xF;
+ LARc[5] = (*c++ & 0x3) << 2;
+ LARc[5] |= (*c >> 6) & 0x3;
+ LARc[6] = (*c >> 3) & 0x7;
+ LARc[7] = *c++ & 0x7;
+ Nc[0] = (*c >> 1) & 0x7F;
+ bc[0] = (*c++ & 0x1) << 1;
+ bc[0] |= (*c >> 7) & 0x1;
+ Mc[0] = (*c >> 5) & 0x3;
+ xmaxc[0] = (*c++ & 0x1F) << 1;
+ xmaxc[0] |= (*c >> 7) & 0x1;
+ xmc[0] = (*c >> 4) & 0x7;
+ xmc[1] = (*c >> 1) & 0x7;
+ xmc[2] = (*c++ & 0x1) << 2;
+ xmc[2] |= (*c >> 6) & 0x3;
+ xmc[3] = (*c >> 3) & 0x7;
+ xmc[4] = *c++ & 0x7;
+ xmc[5] = (*c >> 5) & 0x7;
+ xmc[6] = (*c >> 2) & 0x7;
+ xmc[7] = (*c++ & 0x3) << 1; /* 10 */
+ xmc[7] |= (*c >> 7) & 0x1;
+ xmc[8] = (*c >> 4) & 0x7;
+ xmc[9] = (*c >> 1) & 0x7;
+ xmc[10] = (*c++ & 0x1) << 2;
+ xmc[10] |= (*c >> 6) & 0x3;
+ xmc[11] = (*c >> 3) & 0x7;
+ xmc[12] = *c++ & 0x7;
+ Nc[1] = (*c >> 1) & 0x7F;
+ bc[1] = (*c++ & 0x1) << 1;
+ bc[1] |= (*c >> 7) & 0x1;
+ Mc[1] = (*c >> 5) & 0x3;
+ xmaxc[1] = (*c++ & 0x1F) << 1;
+ xmaxc[1] |= (*c >> 7) & 0x1;
+ xmc[13] = (*c >> 4) & 0x7;
+ xmc[14] = (*c >> 1) & 0x7;
+ xmc[15] = (*c++ & 0x1) << 2;
+ xmc[15] |= (*c >> 6) & 0x3;
+ xmc[16] = (*c >> 3) & 0x7;
+ xmc[17] = *c++ & 0x7;
+ xmc[18] = (*c >> 5) & 0x7;
+ xmc[19] = (*c >> 2) & 0x7;
+ xmc[20] = (*c++ & 0x3) << 1;
+ xmc[20] |= (*c >> 7) & 0x1;
+ xmc[21] = (*c >> 4) & 0x7;
+ xmc[22] = (*c >> 1) & 0x7;
+ xmc[23] = (*c++ & 0x1) << 2;
+ xmc[23] |= (*c >> 6) & 0x3;
+ xmc[24] = (*c >> 3) & 0x7;
+ xmc[25] = *c++ & 0x7;
+ Nc[2] = (*c >> 1) & 0x7F;
+ bc[2] = (*c++ & 0x1) << 1; /* 20 */
+ bc[2] |= (*c >> 7) & 0x1;
+ Mc[2] = (*c >> 5) & 0x3;
+ xmaxc[2] = (*c++ & 0x1F) << 1;
+ xmaxc[2] |= (*c >> 7) & 0x1;
+ xmc[26] = (*c >> 4) & 0x7;
+ xmc[27] = (*c >> 1) & 0x7;
+ xmc[28] = (*c++ & 0x1) << 2;
+ xmc[28] |= (*c >> 6) & 0x3;
+ xmc[29] = (*c >> 3) & 0x7;
+ xmc[30] = *c++ & 0x7;
+ xmc[31] = (*c >> 5) & 0x7;
+ xmc[32] = (*c >> 2) & 0x7;
+ xmc[33] = (*c++ & 0x3) << 1;
+ xmc[33] |= (*c >> 7) & 0x1;
+ xmc[34] = (*c >> 4) & 0x7;
+ xmc[35] = (*c >> 1) & 0x7;
+ xmc[36] = (*c++ & 0x1) << 2;
+ xmc[36] |= (*c >> 6) & 0x3;
+ xmc[37] = (*c >> 3) & 0x7;
+ xmc[38] = *c++ & 0x7;
+ Nc[3] = (*c >> 1) & 0x7F;
+ bc[3] = (*c++ & 0x1) << 1;
+ bc[3] |= (*c >> 7) & 0x1;
+ Mc[3] = (*c >> 5) & 0x3;
+ xmaxc[3] = (*c++ & 0x1F) << 1;
+ xmaxc[3] |= (*c >> 7) & 0x1;
+ xmc[39] = (*c >> 4) & 0x7;
+ xmc[40] = (*c >> 1) & 0x7;
+ xmc[41] = (*c++ & 0x1) << 2;
+ xmc[41] |= (*c >> 6) & 0x3;
+ xmc[42] = (*c >> 3) & 0x7;
+ xmc[43] = *c++ & 0x7; /* 30 */
+ xmc[44] = (*c >> 5) & 0x7;
+ xmc[45] = (*c >> 2) & 0x7;
+ xmc[46] = (*c++ & 0x3) << 1;
+ xmc[46] |= (*c >> 7) & 0x1;
+ xmc[47] = (*c >> 4) & 0x7;
+ xmc[48] = (*c >> 1) & 0x7;
+ xmc[49] = (*c++ & 0x1) << 2;
+ xmc[49] |= (*c >> 6) & 0x3;
+ xmc[50] = (*c >> 3) & 0x7;
+ xmc[51] = *c & 0x7; /* 33 */
+ }
+
+ Gsm_Decoder(s, LARc, Nc, bc, Mc, xmaxc, xmc, target);
+
+ return 0;
+}
--- /dev/null
+++ b/src/gsm/gsm_destroy.c
@@ -1,0 +1,16 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/src/gsm/Attic/gsm_destroy.c,v 1.1 2001/11/14 03:31:26 cbagwell Exp $ */
+
+#include "gsm.h"
+
+# include <stdlib.h>
+
+void gsm_destroy (gsm S)
+{
+ if (S) free((char *)S);
+}
--- /dev/null
+++ b/src/gsm/gsm_encode.c
@@ -1,0 +1,450 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/src/gsm/Attic/gsm_encode.c,v 1.1 2001/11/14 03:31:26 cbagwell Exp $ */
+
+#include "private.h"
+#include "gsm.h"
+
+void gsm_encode (gsm s, gsm_signal * source, gsm_byte * c)
+{
+ word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4];
+
+ Gsm_Coder(s, source, LARc, Nc, bc, Mc, xmaxc, xmc);
+
+
+ /* variable size
+
+ GSM_MAGIC 4
+
+ LARc[0] 6
+ LARc[1] 6
+ LARc[2] 5
+ LARc[3] 5
+ LARc[4] 4
+ LARc[5] 4
+ LARc[6] 3
+ LARc[7] 3
+
+ Nc[0] 7
+ bc[0] 2
+ Mc[0] 2
+ xmaxc[0] 6
+ xmc[0] 3
+ xmc[1] 3
+ xmc[2] 3
+ xmc[3] 3
+ xmc[4] 3
+ xmc[5] 3
+ xmc[6] 3
+ xmc[7] 3
+ xmc[8] 3
+ xmc[9] 3
+ xmc[10] 3
+ xmc[11] 3
+ xmc[12] 3
+
+ Nc[1] 7
+ bc[1] 2
+ Mc[1] 2
+ xmaxc[1] 6
+ xmc[13] 3
+ xmc[14] 3
+ xmc[15] 3
+ xmc[16] 3
+ xmc[17] 3
+ xmc[18] 3
+ xmc[19] 3
+ xmc[20] 3
+ xmc[21] 3
+ xmc[22] 3
+ xmc[23] 3
+ xmc[24] 3
+ xmc[25] 3
+
+ Nc[2] 7
+ bc[2] 2
+ Mc[2] 2
+ xmaxc[2] 6
+ xmc[26] 3
+ xmc[27] 3
+ xmc[28] 3
+ xmc[29] 3
+ xmc[30] 3
+ xmc[31] 3
+ xmc[32] 3
+ xmc[33] 3
+ xmc[34] 3
+ xmc[35] 3
+ xmc[36] 3
+ xmc[37] 3
+ xmc[38] 3
+
+ Nc[3] 7
+ bc[3] 2
+ Mc[3] 2
+ xmaxc[3] 6
+ xmc[39] 3
+ xmc[40] 3
+ xmc[41] 3
+ xmc[42] 3
+ xmc[43] 3
+ xmc[44] 3
+ xmc[45] 3
+ xmc[46] 3
+ xmc[47] 3
+ xmc[48] 3
+ xmc[49] 3
+ xmc[50] 3
+ xmc[51] 3
+ */
+
+#ifdef WAV49
+
+ if (s->wav_fmt) {
+ s->frame_index = !s->frame_index;
+ if (s->frame_index) {
+
+ uword sr;
+
+ sr = 0;
+ sr = sr >> 6 | LARc[0] << 10;
+ sr = sr >> 6 | LARc[1] << 10;
+ *c++ = sr >> 4;
+ sr = sr >> 5 | LARc[2] << 11;
+ *c++ = sr >> 7;
+ sr = sr >> 5 | LARc[3] << 11;
+ sr = sr >> 4 | LARc[4] << 12;
+ *c++ = sr >> 6;
+ sr = sr >> 4 | LARc[5] << 12;
+ sr = sr >> 3 | LARc[6] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | LARc[7] << 13;
+ sr = sr >> 7 | Nc[0] << 9;
+ *c++ = sr >> 5;
+ sr = sr >> 2 | bc[0] << 14;
+ sr = sr >> 2 | Mc[0] << 14;
+ sr = sr >> 6 | xmaxc[0] << 10;
+ *c++ = sr >> 3;
+ sr = sr >> 3 | xmc[0] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[1] << 13;
+ sr = sr >> 3 | xmc[2] << 13;
+ sr = sr >> 3 | xmc[3] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[4] << 13;
+ sr = sr >> 3 | xmc[5] << 13;
+ sr = sr >> 3 | xmc[6] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[7] << 13;
+ sr = sr >> 3 | xmc[8] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[9] << 13;
+ sr = sr >> 3 | xmc[10] << 13;
+ sr = sr >> 3 | xmc[11] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[12] << 13;
+ sr = sr >> 7 | Nc[1] << 9;
+ *c++ = sr >> 5;
+ sr = sr >> 2 | bc[1] << 14;
+ sr = sr >> 2 | Mc[1] << 14;
+ sr = sr >> 6 | xmaxc[1] << 10;
+ *c++ = sr >> 3;
+ sr = sr >> 3 | xmc[13] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[14] << 13;
+ sr = sr >> 3 | xmc[15] << 13;
+ sr = sr >> 3 | xmc[16] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[17] << 13;
+ sr = sr >> 3 | xmc[18] << 13;
+ sr = sr >> 3 | xmc[19] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[20] << 13;
+ sr = sr >> 3 | xmc[21] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[22] << 13;
+ sr = sr >> 3 | xmc[23] << 13;
+ sr = sr >> 3 | xmc[24] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[25] << 13;
+ sr = sr >> 7 | Nc[2] << 9;
+ *c++ = sr >> 5;
+ sr = sr >> 2 | bc[2] << 14;
+ sr = sr >> 2 | Mc[2] << 14;
+ sr = sr >> 6 | xmaxc[2] << 10;
+ *c++ = sr >> 3;
+ sr = sr >> 3 | xmc[26] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[27] << 13;
+ sr = sr >> 3 | xmc[28] << 13;
+ sr = sr >> 3 | xmc[29] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[30] << 13;
+ sr = sr >> 3 | xmc[31] << 13;
+ sr = sr >> 3 | xmc[32] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[33] << 13;
+ sr = sr >> 3 | xmc[34] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[35] << 13;
+ sr = sr >> 3 | xmc[36] << 13;
+ sr = sr >> 3 | xmc[37] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[38] << 13;
+ sr = sr >> 7 | Nc[3] << 9;
+ *c++ = sr >> 5;
+ sr = sr >> 2 | bc[3] << 14;
+ sr = sr >> 2 | Mc[3] << 14;
+ sr = sr >> 6 | xmaxc[3] << 10;
+ *c++ = sr >> 3;
+ sr = sr >> 3 | xmc[39] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[40] << 13;
+ sr = sr >> 3 | xmc[41] << 13;
+ sr = sr >> 3 | xmc[42] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[43] << 13;
+ sr = sr >> 3 | xmc[44] << 13;
+ sr = sr >> 3 | xmc[45] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[46] << 13;
+ sr = sr >> 3 | xmc[47] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[48] << 13;
+ sr = sr >> 3 | xmc[49] << 13;
+ sr = sr >> 3 | xmc[50] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[51] << 13;
+ sr = sr >> 4;
+ *c = sr >> 8;
+ s->frame_chain = *c;
+ }
+ else {
+ uword sr;
+
+ sr = 0;
+ sr = sr >> 4 | s->frame_chain << 12;
+ sr = sr >> 6 | LARc[0] << 10;
+ *c++ = sr >> 6;
+ sr = sr >> 6 | LARc[1] << 10;
+ *c++ = sr >> 8;
+ sr = sr >> 5 | LARc[2] << 11;
+ sr = sr >> 5 | LARc[3] << 11;
+ *c++ = sr >> 6;
+ sr = sr >> 4 | LARc[4] << 12;
+ sr = sr >> 4 | LARc[5] << 12;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | LARc[6] << 13;
+ sr = sr >> 3 | LARc[7] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 7 | Nc[0] << 9;
+ sr = sr >> 2 | bc[0] << 14;
+ *c++ = sr >> 7;
+ sr = sr >> 2 | Mc[0] << 14;
+ sr = sr >> 6 | xmaxc[0] << 10;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[0] << 13;
+ sr = sr >> 3 | xmc[1] << 13;
+ sr = sr >> 3 | xmc[2] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[3] << 13;
+ sr = sr >> 3 | xmc[4] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[5] << 13;
+ sr = sr >> 3 | xmc[6] << 13;
+ sr = sr >> 3 | xmc[7] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[8] << 13;
+ sr = sr >> 3 | xmc[9] << 13;
+ sr = sr >> 3 | xmc[10] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[11] << 13;
+ sr = sr >> 3 | xmc[12] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 7 | Nc[1] << 9;
+ sr = sr >> 2 | bc[1] << 14;
+ *c++ = sr >> 7;
+ sr = sr >> 2 | Mc[1] << 14;
+ sr = sr >> 6 | xmaxc[1] << 10;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[13] << 13;
+ sr = sr >> 3 | xmc[14] << 13;
+ sr = sr >> 3 | xmc[15] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[16] << 13;
+ sr = sr >> 3 | xmc[17] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[18] << 13;
+ sr = sr >> 3 | xmc[19] << 13;
+ sr = sr >> 3 | xmc[20] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[21] << 13;
+ sr = sr >> 3 | xmc[22] << 13;
+ sr = sr >> 3 | xmc[23] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[24] << 13;
+ sr = sr >> 3 | xmc[25] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 7 | Nc[2] << 9;
+ sr = sr >> 2 | bc[2] << 14;
+ *c++ = sr >> 7;
+ sr = sr >> 2 | Mc[2] << 14;
+ sr = sr >> 6 | xmaxc[2] << 10;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[26] << 13;
+ sr = sr >> 3 | xmc[27] << 13;
+ sr = sr >> 3 | xmc[28] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[29] << 13;
+ sr = sr >> 3 | xmc[30] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[31] << 13;
+ sr = sr >> 3 | xmc[32] << 13;
+ sr = sr >> 3 | xmc[33] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[34] << 13;
+ sr = sr >> 3 | xmc[35] << 13;
+ sr = sr >> 3 | xmc[36] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[37] << 13;
+ sr = sr >> 3 | xmc[38] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 7 | Nc[3] << 9;
+ sr = sr >> 2 | bc[3] << 14;
+ *c++ = sr >> 7;
+ sr = sr >> 2 | Mc[3] << 14;
+ sr = sr >> 6 | xmaxc[3] << 10;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[39] << 13;
+ sr = sr >> 3 | xmc[40] << 13;
+ sr = sr >> 3 | xmc[41] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[42] << 13;
+ sr = sr >> 3 | xmc[43] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[44] << 13;
+ sr = sr >> 3 | xmc[45] << 13;
+ sr = sr >> 3 | xmc[46] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[47] << 13;
+ sr = sr >> 3 | xmc[48] << 13;
+ sr = sr >> 3 | xmc[49] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[50] << 13;
+ sr = sr >> 3 | xmc[51] << 13;
+ *c++ = sr >> 8;
+ }
+ }
+
+ else
+
+#endif /* WAV49 */
+ {
+
+ *c++ = ((GSM_MAGIC & 0xF) << 4) /* 1 */
+ | ((LARc[0] >> 2) & 0xF);
+ *c++ = ((LARc[0] & 0x3) << 6)
+ | (LARc[1] & 0x3F);
+ *c++ = ((LARc[2] & 0x1F) << 3)
+ | ((LARc[3] >> 2) & 0x7);
+ *c++ = ((LARc[3] & 0x3) << 6)
+ | ((LARc[4] & 0xF) << 2)
+ | ((LARc[5] >> 2) & 0x3);
+ *c++ = ((LARc[5] & 0x3) << 6)
+ | ((LARc[6] & 0x7) << 3)
+ | (LARc[7] & 0x7);
+ *c++ = ((Nc[0] & 0x7F) << 1)
+ | ((bc[0] >> 1) & 0x1);
+ *c++ = ((bc[0] & 0x1) << 7)
+ | ((Mc[0] & 0x3) << 5)
+ | ((xmaxc[0] >> 1) & 0x1F);
+ *c++ = ((xmaxc[0] & 0x1) << 7)
+ | ((xmc[0] & 0x7) << 4)
+ | ((xmc[1] & 0x7) << 1)
+ | ((xmc[2] >> 2) & 0x1);
+ *c++ = ((xmc[2] & 0x3) << 6)
+ | ((xmc[3] & 0x7) << 3)
+ | (xmc[4] & 0x7);
+ *c++ = ((xmc[5] & 0x7) << 5) /* 10 */
+ | ((xmc[6] & 0x7) << 2)
+ | ((xmc[7] >> 1) & 0x3);
+ *c++ = ((xmc[7] & 0x1) << 7)
+ | ((xmc[8] & 0x7) << 4)
+ | ((xmc[9] & 0x7) << 1)
+ | ((xmc[10] >> 2) & 0x1);
+ *c++ = ((xmc[10] & 0x3) << 6)
+ | ((xmc[11] & 0x7) << 3)
+ | (xmc[12] & 0x7);
+ *c++ = ((Nc[1] & 0x7F) << 1)
+ | ((bc[1] >> 1) & 0x1);
+ *c++ = ((bc[1] & 0x1) << 7)
+ | ((Mc[1] & 0x3) << 5)
+ | ((xmaxc[1] >> 1) & 0x1F);
+ *c++ = ((xmaxc[1] & 0x1) << 7)
+ | ((xmc[13] & 0x7) << 4)
+ | ((xmc[14] & 0x7) << 1)
+ | ((xmc[15] >> 2) & 0x1);
+ *c++ = ((xmc[15] & 0x3) << 6)
+ | ((xmc[16] & 0x7) << 3)
+ | (xmc[17] & 0x7);
+ *c++ = ((xmc[18] & 0x7) << 5)
+ | ((xmc[19] & 0x7) << 2)
+ | ((xmc[20] >> 1) & 0x3);
+ *c++ = ((xmc[20] & 0x1) << 7)
+ | ((xmc[21] & 0x7) << 4)
+ | ((xmc[22] & 0x7) << 1)
+ | ((xmc[23] >> 2) & 0x1);
+ *c++ = ((xmc[23] & 0x3) << 6)
+ | ((xmc[24] & 0x7) << 3)
+ | (xmc[25] & 0x7);
+ *c++ = ((Nc[2] & 0x7F) << 1) /* 20 */
+ | ((bc[2] >> 1) & 0x1);
+ *c++ = ((bc[2] & 0x1) << 7)
+ | ((Mc[2] & 0x3) << 5)
+ | ((xmaxc[2] >> 1) & 0x1F);
+ *c++ = ((xmaxc[2] & 0x1) << 7)
+ | ((xmc[26] & 0x7) << 4)
+ | ((xmc[27] & 0x7) << 1)
+ | ((xmc[28] >> 2) & 0x1);
+ *c++ = ((xmc[28] & 0x3) << 6)
+ | ((xmc[29] & 0x7) << 3)
+ | (xmc[30] & 0x7);
+ *c++ = ((xmc[31] & 0x7) << 5)
+ | ((xmc[32] & 0x7) << 2)
+ | ((xmc[33] >> 1) & 0x3);
+ *c++ = ((xmc[33] & 0x1) << 7)
+ | ((xmc[34] & 0x7) << 4)
+ | ((xmc[35] & 0x7) << 1)
+ | ((xmc[36] >> 2) & 0x1);
+ *c++ = ((xmc[36] & 0x3) << 6)
+ | ((xmc[37] & 0x7) << 3)
+ | (xmc[38] & 0x7);
+ *c++ = ((Nc[3] & 0x7F) << 1)
+ | ((bc[3] >> 1) & 0x1);
+ *c++ = ((bc[3] & 0x1) << 7)
+ | ((Mc[3] & 0x3) << 5)
+ | ((xmaxc[3] >> 1) & 0x1F);
+ *c++ = ((xmaxc[3] & 0x1) << 7)
+ | ((xmc[39] & 0x7) << 4)
+ | ((xmc[40] & 0x7) << 1)
+ | ((xmc[41] >> 2) & 0x1);
+ *c++ = ((xmc[41] & 0x3) << 6) /* 30 */
+ | ((xmc[42] & 0x7) << 3)
+ | (xmc[43] & 0x7);
+ *c++ = ((xmc[44] & 0x7) << 5)
+ | ((xmc[45] & 0x7) << 2)
+ | ((xmc[46] >> 1) & 0x3);
+ *c++ = ((xmc[46] & 0x1) << 7)
+ | ((xmc[47] & 0x7) << 4)
+ | ((xmc[48] & 0x7) << 1)
+ | ((xmc[49] >> 2) & 0x1);
+ *c++ = ((xmc[49] & 0x3) << 6)
+ | ((xmc[50] & 0x7) << 3)
+ | (xmc[51] & 0x7);
+
+ }
+}
--- /dev/null
+++ b/src/gsm/lpc.c
@@ -1,0 +1,338 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/src/gsm/Attic/lpc.c,v 1.1 2001/11/14 03:31:26 cbagwell Exp $ */
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "private.h"
+
+#include "gsm.h"
+
+/*
+ * 4.2.4 .. 4.2.7 LPC ANALYSIS SECTION
+ */
+
+/* 4.2.4 */
+
+
+static void Autocorrelation (
+ word * s, /* [0..159] IN/OUT */
+ longword * L_ACF) /* [0..8] OUT */
+/*
+ * The goal is to compute the array L_ACF[k]. The signal s[i] must
+ * be scaled in order to avoid an overflow situation.
+ */
+{
+ register int k, i;
+
+ word temp, smax, scalauto;
+
+#ifdef USE_FLOAT_MUL
+ float float_s[160];
+#endif
+
+ /* Dynamic scaling of the array s[0..159]
+ */
+
+ /* Search for the maximum.
+ */
+ smax = 0;
+ for (k = 0; k <= 159; k++) {
+ temp = GSM_ABS( s[k] );
+ if (temp > smax) smax = temp;
+ }
+
+ /* Computation of the scaling factor.
+ */
+ if (smax == 0) scalauto = 0;
+ else {
+ assert(smax > 0);
+ scalauto = 4 - gsm_norm( (longword)smax << 16 );/* sub(4,..) */
+ }
+
+ /* Scaling of the array s[0...159]
+ */
+
+ if (scalauto > 0) {
+
+# ifdef USE_FLOAT_MUL
+# define SCALE(n) \
+ case n: for (k = 0; k <= 159; k++) \
+ float_s[k] = (float) \
+ (s[k] = GSM_MULT_R(s[k], 16384 >> (n-1)));\
+ break;
+# else
+# define SCALE(n) \
+ case n: for (k = 0; k <= 159; k++) \
+ s[k] = GSM_MULT_R( s[k], 16384 >> (n-1) );\
+ break;
+# endif /* USE_FLOAT_MUL */
+
+ switch (scalauto) {
+ SCALE(1)
+ SCALE(2)
+ SCALE(3)
+ SCALE(4)
+ }
+# undef SCALE
+ }
+# ifdef USE_FLOAT_MUL
+ else for (k = 0; k <= 159; k++) float_s[k] = (float) s[k];
+# endif
+
+ /* Compute the L_ACF[..].
+ */
+ {
+# ifdef USE_FLOAT_MUL
+ register float * sp = float_s;
+ register float sl = *sp;
+
+# define STEP(k) L_ACF[k] += (longword)(sl * sp[ -(k) ]);
+# else
+ word * sp = s;
+ word sl = *sp;
+
+# define STEP(k) L_ACF[k] += ((longword)sl * sp[ -(k) ]);
+# endif
+
+# define NEXTI sl = *++sp
+
+
+ for (k = 9; k--; L_ACF[k] = 0) ;
+
+ STEP (0);
+ NEXTI;
+ STEP(0); STEP(1);
+ NEXTI;
+ STEP(0); STEP(1); STEP(2);
+ NEXTI;
+ STEP(0); STEP(1); STEP(2); STEP(3);
+ NEXTI;
+ STEP(0); STEP(1); STEP(2); STEP(3); STEP(4);
+ NEXTI;
+ STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5);
+ NEXTI;
+ STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5); STEP(6);
+ NEXTI;
+ STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5); STEP(6); STEP(7);
+
+ for (i = 8; i <= 159; i++) {
+
+ NEXTI;
+
+ STEP(0);
+ STEP(1); STEP(2); STEP(3); STEP(4);
+ STEP(5); STEP(6); STEP(7); STEP(8);
+ }
+
+ for (k = 9; k--; L_ACF[k] <<= 1) ;
+
+ }
+ /* Rescaling of the array s[0..159]
+ */
+ if (scalauto > 0) {
+ assert(scalauto <= 4);
+ for (k = 160; k--; *s++ <<= scalauto) ;
+ }
+}
+
+#if defined(USE_FLOAT_MUL) && defined(FAST)
+
+static void Fast_Autocorrelation (
+ word * s, /* [0..159] IN/OUT */
+ longword * L_ACF) /* [0..8] OUT */
+{
+ register int k, i;
+ float f_L_ACF[9];
+ float scale;
+
+ float s_f[160];
+ register float *sf = s_f;
+
+ for (i = 0; i < 160; ++i) sf[i] = s[i];
+ for (k = 0; k <= 8; k++) {
+ register float L_temp2 = 0;
+ register float *sfl = sf - k;
+ for (i = k; i < 160; ++i) L_temp2 += sf[i] * sfl[i];
+ f_L_ACF[k] = L_temp2;
+ }
+ scale = MAX_LONGWORD / f_L_ACF[0];
+
+ for (k = 0; k <= 8; k++) {
+ L_ACF[k] = f_L_ACF[k] * scale;
+ }
+}
+#endif /* defined (USE_FLOAT_MUL) && defined (FAST) */
+
+/* 4.2.5 */
+
+static void Reflection_coefficients (
+ longword * L_ACF, /* 0...8 IN */
+ register word * r /* 0...7 OUT */
+)
+{
+ register int i, m, n;
+ register word temp;
+ register longword ltmp;
+ word ACF[9]; /* 0..8 */
+ word P[ 9]; /* 0..8 */
+ word K[ 9]; /* 2..8 */
+
+ /* Schur recursion with 16 bits arithmetic.
+ */
+
+ if (L_ACF[0] == 0) {
+ for (i = 8; i--; *r++ = 0) ;
+ return;
+ }
+
+ assert( L_ACF[0] != 0 );
+ temp = gsm_norm( L_ACF[0] );
+
+ assert(temp >= 0 && temp < 32);
+
+ /* ? overflow ? */
+ for (i = 0; i <= 8; i++) ACF[i] = SASR( L_ACF[i] << temp, 16 );
+
+ /* Initialize array P[..] and K[..] for the recursion.
+ */
+
+ for (i = 1; i <= 7; i++) K[ i ] = ACF[ i ];
+ for (i = 0; i <= 8; i++) P[ i ] = ACF[ i ];
+
+ /* Compute reflection coefficients
+ */
+ for (n = 1; n <= 8; n++, r++) {
+
+ temp = P[1];
+ temp = GSM_ABS(temp);
+ if (P[0] < temp) {
+ for (i = n; i <= 8; i++) *r++ = 0;
+ return;
+ }
+
+ *r = gsm_div( temp, P[0] );
+
+ assert(*r >= 0);
+ if (P[1] > 0) *r = -*r; /* r[n] = sub(0, r[n]) */
+ assert (*r != MIN_WORD);
+ if (n == 8) return;
+
+ /* Schur recursion
+ */
+ temp = GSM_MULT_R( P[1], *r );
+ P[0] = GSM_ADD( P[0], temp );
+
+ for (m = 1; m <= 8 - n; m++) {
+ temp = GSM_MULT_R( K[ m ], *r );
+ P[m] = GSM_ADD( P[ m+1 ], temp );
+
+ temp = GSM_MULT_R( P[ m+1 ], *r );
+ K[m] = GSM_ADD( K[ m ], temp );
+ }
+ }
+}
+
+/* 4.2.6 */
+
+static void Transformation_to_Log_Area_Ratios (
+ register word * r /* 0..7 IN/OUT */
+)
+/*
+ * The following scaling for r[..] and LAR[..] has been used:
+ *
+ * r[..] = integer( real_r[..]*32768. ); -1 <= real_r < 1.
+ * LAR[..] = integer( real_LAR[..] * 16384 );
+ * with -1.625 <= real_LAR <= 1.625
+ */
+{
+ register word temp;
+ register int i;
+
+
+ /* Computation of the LAR[0..7] from the r[0..7]
+ */
+ for (i = 1; i <= 8; i++, r++) {
+
+ temp = *r;
+ temp = GSM_ABS(temp);
+ assert(temp >= 0);
+
+ if (temp < 22118) {
+ temp >>= 1;
+ } else if (temp < 31130) {
+ assert( temp >= 11059 );
+ temp -= 11059;
+ } else {
+ assert( temp >= 26112 );
+ temp -= 26112;
+ temp <<= 2;
+ }
+
+ *r = *r < 0 ? -temp : temp;
+ assert( *r != MIN_WORD );
+ }
+}
+
+/* 4.2.7 */
+
+static void Quantization_and_coding (
+ register word * LAR /* [0..7] IN/OUT */
+)
+{
+ register word temp;
+ longword ltmp;
+
+
+ /* This procedure needs four tables; the following equations
+ * give the optimum scaling for the constants:
+ *
+ * A[0..7] = integer( real_A[0..7] * 1024 )
+ * B[0..7] = integer( real_B[0..7] * 512 )
+ * MAC[0..7] = maximum of the LARc[0..7]
+ * MIC[0..7] = minimum of the LARc[0..7]
+ */
+
+# undef STEP
+# define STEP( A, B, MAC, MIC ) \
+ temp = GSM_MULT( A, *LAR ); \
+ temp = GSM_ADD( temp, B ); \
+ temp = GSM_ADD( temp, 256 ); \
+ temp = SASR( temp, 9 ); \
+ *LAR = temp>MAC ? MAC - MIC : (temp<MIC ? 0 : temp - MIC); \
+ LAR++;
+
+ STEP( 20480, 0, 31, -32 );
+ STEP( 20480, 0, 31, -32 );
+ STEP( 20480, 2048, 15, -16 );
+ STEP( 20480, -2560, 15, -16 );
+
+ STEP( 13964, 94, 7, -8 );
+ STEP( 15360, -1792, 7, -8 );
+ STEP( 8534, -341, 3, -4 );
+ STEP( 9036, -1144, 3, -4 );
+
+# undef STEP
+}
+
+void Gsm_LPC_Analysis (
+ struct gsm_state *S,
+ word * s, /* 0..159 signals IN/OUT */
+ word * LARc) /* 0..7 LARc's OUT */
+{
+ longword L_ACF[9];
+
+#if defined(USE_FLOAT_MUL) && defined(FAST)
+ if (S->fast) Fast_Autocorrelation (s, L_ACF );
+ else
+#endif
+ Autocorrelation (s, L_ACF );
+ Reflection_coefficients (L_ACF, LARc );
+ Transformation_to_Log_Area_Ratios (LARc);
+ Quantization_and_coding (LARc);
+}
--- /dev/null
+++ b/src/gsm/preprocess.c
@@ -1,0 +1,112 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/src/gsm/Attic/preprocess.c,v 1.1 2001/11/14 03:31:26 cbagwell Exp $ */
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "private.h"
+
+#include "gsm.h"
+
+/* 4.2.0 .. 4.2.3 PREPROCESSING SECTION
+ *
+ * After A-law to linear conversion (or directly from the
+ * Ato D converter) the following scaling is assumed for
+ * input to the RPE-LTP algorithm:
+ *
+ * in: 0.1.....................12
+ * S.v.v.v.v.v.v.v.v.v.v.v.v.*.*.*
+ *
+ * Where S is the sign bit, v a valid bit, and * a "don't care" bit.
+ * The original signal is called sop[..]
+ *
+ * out: 0.1................... 12
+ * S.S.v.v.v.v.v.v.v.v.v.v.v.v.0.0
+ */
+
+
+void Gsm_Preprocess (
+ struct gsm_state * S,
+ word * s,
+ word * so ) /* [0..159] IN/OUT */
+{
+
+ word z1 = S->z1;
+ longword L_z2 = S->L_z2;
+ word mp = S->mp;
+
+ word s1;
+ longword L_s2;
+
+ longword L_temp;
+
+ word msp, lsp;
+ word SO;
+
+ longword ltmp; /* for ADD */
+ ulongword utmp; /* for L_ADD */
+
+ register int k = 160;
+
+ while (k--) {
+
+ /* 4.2.1 Downscaling of the input signal
+ */
+ SO = SASR( *s, 3 ) << 2;
+ s++;
+
+ assert (SO >= -0x4000); /* downscaled by */
+ assert (SO <= 0x3FFC); /* previous routine. */
+
+
+ /* 4.2.2 Offset compensation
+ *
+ * This part implements a high-pass filter and requires extended
+ * arithmetic precision for the recursive part of this filter.
+ * The input of this procedure is the array so[0...159] and the
+ * output the array sof[ 0...159 ].
+ */
+ /* Compute the non-recursive part
+ */
+
+ s1 = SO - z1; /* s1 = gsm_sub( *so, z1 ); */
+ z1 = SO;
+
+ assert(s1 != MIN_WORD);
+
+ /* Compute the recursive part
+ */
+ L_s2 = s1;
+ L_s2 <<= 15;
+
+ /* Execution of a 31 bv 16 bits multiplication
+ */
+
+ msp = SASR( L_z2, 15 );
+ lsp = L_z2-((longword)msp<<15); /* gsm_L_sub(L_z2,(msp<<15)); */
+
+ L_s2 += GSM_MULT_R( lsp, 32735 );
+ L_temp = (longword)msp * 32735; /* GSM_L_MULT(msp,32735) >> 1;*/
+ L_z2 = GSM_L_ADD( L_temp, L_s2 );
+
+ /* Compute sof[k] with rounding
+ */
+ L_temp = GSM_L_ADD( L_z2, 16384 );
+
+ /* 4.2.3 Preemphasis
+ */
+
+ msp = GSM_MULT_R( mp, -28180 );
+ mp = SASR( L_temp, 15 );
+ *so++ = GSM_ADD( mp, msp );
+ }
+
+ S->z1 = z1;
+ S->L_z2 = L_z2;
+ S->mp = mp;
+}
--- /dev/null
+++ b/src/gsm/private.h
@@ -1,0 +1,264 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/*$Header: /cvsroot/sox/sox/src/gsm/Attic/private.h,v 1.1 2001/11/14 03:31:26 cbagwell Exp $*/
+
+#ifndef PRIVATE_H
+#define PRIVATE_H
+
+typedef short word; /* 16 bit signed int */
+typedef long longword; /* 32 bit signed int */
+
+typedef unsigned short uword; /* unsigned word */
+typedef unsigned long ulongword; /* unsigned longword */
+
+struct gsm_state {
+
+ word dp0[ 280 ];
+
+ word z1; /* preprocessing.c, Offset_com. */
+ longword L_z2; /* Offset_com. */
+ int mp; /* Preemphasis */
+
+ word u[8]; /* short_term_aly_filter.c */
+ word LARpp[2][8]; /* */
+ word j; /* */
+
+ word ltp_cut; /* long_term.c, LTP crosscorr. */
+ word nrp; /* 40 */ /* long_term.c, synthesis */
+ word v[9]; /* short_term.c, synthesis */
+ word msr; /* decoder.c, Postprocessing */
+
+ char verbose; /* only used if !NDEBUG */
+ char fast; /* only used if FAST */
+
+ char wav_fmt; /* only used if WAV49 defined */
+ unsigned char frame_index; /* odd/even chaining */
+ unsigned char frame_chain; /* half-byte to carry forward */
+};
+
+
+#define MIN_WORD (-32767 - 1)
+#define MAX_WORD 32767
+
+#define MIN_LONGWORD (-2147483647 - 1)
+#define MAX_LONGWORD 2147483647
+
+#ifdef SASR /* flag: >> is a signed arithmetic shift right */
+#undef SASR
+#define SASR(x, by) ((x) >> (by))
+#else
+#define SASR(x, by) ((x) >= 0 ? (x) >> (by) : (~(-((x) + 1) >> (by))))
+#endif /* SASR */
+
+/*
+ * Prototypes from add.c
+ */
+extern word gsm_mult (word a, word b);
+extern longword gsm_L_mult (word a, word b);
+extern word gsm_mult_r (word a, word b);
+
+extern word gsm_div (word num, word denum);
+
+extern word gsm_add ( word a, word b );
+extern longword gsm_L_add ( longword a, longword b );
+
+extern word gsm_sub (word a, word b);
+extern longword gsm_L_sub (longword a, longword b);
+
+extern word gsm_abs (word a);
+
+extern word gsm_norm ( longword a );
+
+extern longword gsm_L_asl (longword a, int n);
+extern word gsm_asl (word a, int n);
+
+extern longword gsm_L_asr (longword a, int n);
+extern word gsm_asr (word a, int n);
+
+/*
+ * Inlined functions from add.h
+ */
+
+/*
+ * #define GSM_MULT_R(a, b) (* word a, word b, !(a == b == MIN_WORD) *) \
+ * (0x0FFFF & SASR(((longword)(a) * (longword)(b) + 16384), 15))
+ */
+#define GSM_MULT_R(a, b) /* word a, word b, !(a == b == MIN_WORD) */ \
+ (SASR( ((longword)(a) * (longword)(b) + 16384), 15 ))
+
+# define GSM_MULT(a,b) /* word a, word b, !(a == b == MIN_WORD) */ \
+ (SASR( ((longword)(a) * (longword)(b)), 15 ))
+
+# define GSM_L_MULT(a, b) /* word a, word b */ \
+ (((longword)(a) * (longword)(b)) << 1)
+
+# define GSM_L_ADD(a, b) \
+ ( (a) < 0 ? ( (b) >= 0 ? (a) + (b) \
+ : (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \
+ >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 ) \
+ : ((b) <= 0 ? (a) + (b) \
+ : (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \
+ ? MAX_LONGWORD : utmp))
+
+/*
+ * # define GSM_ADD(a, b) \
+ * ((ltmp = (longword)(a) + (longword)(b)) >= MAX_WORD \
+ * ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp)
+ */
+/* Nonportable, but faster: */
+
+#define GSM_ADD(a, b) \
+ ((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \
+ MAX_WORD - MIN_WORD ? (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp)
+
+# define GSM_SUB(a, b) \
+ ((ltmp = (longword)(a) - (longword)(b)) >= MAX_WORD \
+ ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp)
+
+# define GSM_ABS(a) ((a) < 0 ? ((a) == MIN_WORD ? MAX_WORD : -(a)) : (a))
+
+/* Use these if necessary:
+
+# define GSM_MULT_R(a, b) gsm_mult_r(a, b)
+# define GSM_MULT(a, b) gsm_mult(a, b)
+# define GSM_L_MULT(a, b) gsm_L_mult(a, b)
+
+# define GSM_L_ADD(a, b) gsm_L_add(a, b)
+# define GSM_ADD(a, b) gsm_add(a, b)
+# define GSM_SUB(a, b) gsm_sub(a, b)
+
+# define GSM_ABS(a) gsm_abs(a)
+
+*/
+
+/*
+ * More prototypes from implementations..
+ */
+extern void Gsm_Coder (
+ struct gsm_state * S,
+ word * s, /* [0..159] samples IN */
+ word * LARc, /* [0..7] LAR coefficients OUT */
+ word * Nc, /* [0..3] LTP lag OUT */
+ word * bc, /* [0..3] coded LTP gain OUT */
+ word * Mc, /* [0..3] RPE grid selection OUT */
+ word * xmaxc,/* [0..3] Coded maximum amplitude OUT */
+ word * xMc /* [13*4] normalized RPE samples OUT */);
+
+extern void Gsm_Long_Term_Predictor ( /* 4x for 160 samples */
+ struct gsm_state * S,
+ word * d, /* [0..39] residual signal IN */
+ word * dp, /* [-120..-1] d' IN */
+ word * e, /* [0..40] OUT */
+ word * dpp, /* [0..40] OUT */
+ word * Nc, /* correlation lag OUT */
+ word * bc /* gain factor OUT */);
+
+extern void Gsm_LPC_Analysis (
+ struct gsm_state * S,
+ word * s, /* 0..159 signals IN/OUT */
+ word * LARc); /* 0..7 LARc's OUT */
+
+extern void Gsm_Preprocess (
+ struct gsm_state * S,
+ word * s, word * so);
+
+extern void Gsm_Encoding (
+ struct gsm_state * S,
+ word * e,
+ word * ep,
+ word * xmaxc,
+ word * Mc,
+ word * xMc);
+
+extern void Gsm_Short_Term_Analysis_Filter (
+ struct gsm_state * S,
+ word * LARc, /* coded log area ratio [0..7] IN */
+ word * d /* st res. signal [0..159] IN/OUT */);
+
+extern void Gsm_Decoder (
+ struct gsm_state * S,
+ word * LARcr, /* [0..7] IN */
+ word * Ncr, /* [0..3] IN */
+ word * bcr, /* [0..3] IN */
+ word * Mcr, /* [0..3] IN */
+ word * xmaxcr, /* [0..3] IN */
+ word * xMcr, /* [0..13*4] IN */
+ word * s); /* [0..159] OUT */
+
+extern void Gsm_Decoding (
+ struct gsm_state * S,
+ word xmaxcr,
+ word Mcr,
+ word * xMcr, /* [0..12] IN */
+ word * erp); /* [0..39] OUT */
+
+extern void Gsm_Long_Term_Synthesis_Filtering (
+ struct gsm_state* S,
+ word Ncr,
+ word bcr,
+ word * erp, /* [0..39] IN */
+ word * drp); /* [-120..-1] IN, [0..40] OUT */
+
+void Gsm_RPE_Decoding (
+ struct gsm_state *S,
+ word xmaxcr,
+ word Mcr,
+ word * xMcr, /* [0..12], 3 bits IN */
+ word * erp); /* [0..39] OUT */
+
+void Gsm_RPE_Encoding (
+ struct gsm_state * S,
+ word * e, /* -5..-1][0..39][40..44 IN/OUT */
+ word * xmaxc, /* OUT */
+ word * Mc, /* OUT */
+ word * xMc); /* [0..12] OUT */
+
+extern void Gsm_Short_Term_Synthesis_Filter (
+ struct gsm_state * S,
+ word * LARcr, /* log area ratios [0..7] IN */
+ word * drp, /* received d [0...39] IN */
+ word * s); /* signal s [0..159] OUT */
+
+extern void Gsm_Update_of_reconstructed_short_time_residual_signal (
+ word * dpp, /* [0...39] IN */
+ word * ep, /* [0...39] IN */
+ word * dp); /* [-120...-1] IN/OUT */
+
+/*
+ * Tables from table.c
+ */
+#ifndef GSM_TABLE_C
+
+extern word gsm_A[8], gsm_B[8], gsm_MIC[8], gsm_MAC[8];
+extern word gsm_INVA[8];
+extern word gsm_DLB[4], gsm_QLB[4];
+extern word gsm_H[11];
+extern word gsm_NRFAC[8];
+extern word gsm_FAC[8];
+
+#endif /* GSM_TABLE_C */
+
+/*
+ * Debugging
+ */
+#ifdef NDEBUG
+
+# define gsm_debug_words(a, b, c, d) /* nil */
+# define gsm_debug_longwords(a, b, c, d) /* nil */
+# define gsm_debug_word(a, b) /* nil */
+# define gsm_debug_longword(a, b) /* nil */
+
+#else /* !NDEBUG => DEBUG */
+
+ extern void gsm_debug_words (char * name, int, int, word *);
+ extern void gsm_debug_longwords (char * name, int, int, longword *);
+ extern void gsm_debug_longword (char * name, longword);
+ extern void gsm_debug_word (char * name, word);
+
+#endif /* !NDEBUG */
+
+#endif /* PRIVATE_H */
--- /dev/null
+++ b/src/gsm/rpe.c
@@ -1,0 +1,487 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/src/gsm/Attic/rpe.c,v 1.1 2001/11/14 03:31:26 cbagwell Exp $ */
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "private.h"
+
+#include "gsm.h"
+
+/* 4.2.13 .. 4.2.17 RPE ENCODING SECTION
+ */
+
+/* 4.2.13 */
+
+static void Weighting_filter (
+ register word * e, /* signal [-5..0.39.44] IN */
+ word * x /* signal [0..39] OUT */
+)
+/*
+ * The coefficients of the weighting filter are stored in a table
+ * (see table 4.4). The following scaling is used:
+ *
+ * H[0..10] = integer( real_H[ 0..10] * 8192 );
+ */
+{
+ /* word wt[ 50 ]; */
+
+ register longword L_result;
+ register int k /* , i */ ;
+
+ /* Initialization of a temporary working array wt[0...49]
+ */
+
+ /* for (k = 0; k <= 4; k++) wt[k] = 0;
+ * for (k = 5; k <= 44; k++) wt[k] = *e++;
+ * for (k = 45; k <= 49; k++) wt[k] = 0;
+ *
+ * (e[-5..-1] and e[40..44] are allocated by the caller,
+ * are initially zero and are not written anywhere.)
+ */
+ e -= 5;
+
+ /* Compute the signal x[0..39]
+ */
+ for (k = 0; k <= 39; k++) {
+
+ L_result = 8192 >> 1;
+
+ /* for (i = 0; i <= 10; i++) {
+ * L_temp = GSM_L_MULT( wt[k+i], gsm_H[i] );
+ * L_result = GSM_L_ADD( L_result, L_temp );
+ * }
+ */
+
+#undef STEP
+#define STEP( i, H ) (e[ k + i ] * (longword)H)
+
+ /* Every one of these multiplications is done twice --
+ * but I don't see an elegant way to optimize this.
+ * Do you?
+ */
+
+#ifdef STUPID_COMPILER
+ L_result += STEP( 0, -134 ) ;
+ L_result += STEP( 1, -374 ) ;
+ /* + STEP( 2, 0 ) */
+ L_result += STEP( 3, 2054 ) ;
+ L_result += STEP( 4, 5741 ) ;
+ L_result += STEP( 5, 8192 ) ;
+ L_result += STEP( 6, 5741 ) ;
+ L_result += STEP( 7, 2054 ) ;
+ /* + STEP( 8, 0 ) */
+ L_result += STEP( 9, -374 ) ;
+ L_result += STEP( 10, -134 ) ;
+#else
+ L_result +=
+ STEP( 0, -134 )
+ + STEP( 1, -374 )
+ /* + STEP( 2, 0 ) */
+ + STEP( 3, 2054 )
+ + STEP( 4, 5741 )
+ + STEP( 5, 8192 )
+ + STEP( 6, 5741 )
+ + STEP( 7, 2054 )
+ /* + STEP( 8, 0 ) */
+ + STEP( 9, -374 )
+ + STEP(10, -134 )
+ ;
+#endif
+
+ /* L_result = GSM_L_ADD( L_result, L_result ); (* scaling(x2) *)
+ * L_result = GSM_L_ADD( L_result, L_result ); (* scaling(x4) *)
+ *
+ * x[k] = SASR( L_result, 16 );
+ */
+
+ /* 2 adds vs. >>16 => 14, minus one shift to compensate for
+ * those we lost when replacing L_MULT by '*'.
+ */
+
+ L_result = SASR( L_result, 13 );
+ x[k] = ( L_result < MIN_WORD ? MIN_WORD
+ : (L_result > MAX_WORD ? MAX_WORD : L_result ));
+ }
+}
+
+/* 4.2.14 */
+
+static void RPE_grid_selection (
+ word * x, /* [0..39] IN */
+ word * xM, /* [0..12] OUT */
+ word * Mc_out /* OUT */
+)
+/*
+ * The signal x[0..39] is used to select the RPE grid which is
+ * represented by Mc.
+ */
+{
+ /* register word temp1; */
+ register int /* m, */ i;
+ register longword L_result, L_temp;
+ longword EM; /* xxx should be L_EM? */
+ word Mc;
+
+ longword L_common_0_3;
+
+ EM = 0;
+ Mc = 0;
+
+ /* for (m = 0; m <= 3; m++) {
+ * L_result = 0;
+ *
+ *
+ * for (i = 0; i <= 12; i++) {
+ *
+ * temp1 = SASR( x[m + 3*i], 2 );
+ *
+ * assert(temp1 != MIN_WORD);
+ *
+ * L_temp = GSM_L_MULT( temp1, temp1 );
+ * L_result = GSM_L_ADD( L_temp, L_result );
+ * }
+ *
+ * if (L_result > EM) {
+ * Mc = m;
+ * EM = L_result;
+ * }
+ * }
+ */
+
+#undef STEP
+#define STEP( m, i ) L_temp = SASR( x[m + 3 * i], 2 ); \
+ L_result += L_temp * L_temp;
+
+ /* common part of 0 and 3 */
+
+ L_result = 0;
+ STEP( 0, 1 ); STEP( 0, 2 ); STEP( 0, 3 ); STEP( 0, 4 );
+ STEP( 0, 5 ); STEP( 0, 6 ); STEP( 0, 7 ); STEP( 0, 8 );
+ STEP( 0, 9 ); STEP( 0, 10); STEP( 0, 11); STEP( 0, 12);
+ L_common_0_3 = L_result;
+
+ /* i = 0 */
+
+ STEP( 0, 0 );
+ L_result <<= 1; /* implicit in L_MULT */
+ EM = L_result;
+
+ /* i = 1 */
+
+ L_result = 0;
+ STEP( 1, 0 );
+ STEP( 1, 1 ); STEP( 1, 2 ); STEP( 1, 3 ); STEP( 1, 4 );
+ STEP( 1, 5 ); STEP( 1, 6 ); STEP( 1, 7 ); STEP( 1, 8 );
+ STEP( 1, 9 ); STEP( 1, 10); STEP( 1, 11); STEP( 1, 12);
+ L_result <<= 1;
+ if (L_result > EM) {
+ Mc = 1;
+ EM = L_result;
+ }
+
+ /* i = 2 */
+
+ L_result = 0;
+ STEP( 2, 0 );
+ STEP( 2, 1 ); STEP( 2, 2 ); STEP( 2, 3 ); STEP( 2, 4 );
+ STEP( 2, 5 ); STEP( 2, 6 ); STEP( 2, 7 ); STEP( 2, 8 );
+ STEP( 2, 9 ); STEP( 2, 10); STEP( 2, 11); STEP( 2, 12);
+ L_result <<= 1;
+ if (L_result > EM) {
+ Mc = 2;
+ EM = L_result;
+ }
+
+ /* i = 3 */
+
+ L_result = L_common_0_3;
+ STEP( 3, 12 );
+ L_result <<= 1;
+ if (L_result > EM) {
+ Mc = 3;
+ EM = L_result;
+ }
+
+ /**/
+
+ /* Down-sampling by a factor 3 to get the selected xM[0..12]
+ * RPE sequence.
+ */
+ for (i = 0; i <= 12; i ++) xM[i] = x[Mc + 3*i];
+ *Mc_out = Mc;
+}
+
+/* 4.12.15 */
+
+static void APCM_quantization_xmaxc_to_exp_mant (
+ word xmaxc, /* IN */
+ word * exp_out, /* OUT */
+ word * mant_out ) /* OUT */
+{
+ word exp, mant;
+
+ /* Compute exponent and mantissa of the decoded version of xmaxc
+ */
+
+ exp = 0;
+ if (xmaxc > 15) exp = SASR(xmaxc, 3) - 1;
+ mant = xmaxc - (exp << 3);
+
+ if (mant == 0) {
+ exp = -4;
+ mant = 7;
+ }
+ else {
+ while (mant <= 7) {
+ mant = mant << 1 | 1;
+ exp--;
+ }
+ mant -= 8;
+ }
+
+ assert( exp >= -4 && exp <= 6 );
+ assert( mant >= 0 && mant <= 7 );
+
+ *exp_out = exp;
+ *mant_out = mant;
+}
+
+static void APCM_quantization (
+ word * xM, /* [0..12] IN */
+
+ word * xMc, /* [0..12] OUT */
+ word * mant_out, /* OUT */
+ word * exp_out, /* OUT */
+ word * xmaxc_out /* OUT */
+)
+{
+ int i, itest;
+
+ word xmax, xmaxc, temp, temp1, temp2;
+ word exp, mant;
+
+
+ /* Find the maximum absolute value xmax of xM[0..12].
+ */
+
+ xmax = 0;
+ for (i = 0; i <= 12; i++) {
+ temp = xM[i];
+ temp = GSM_ABS(temp);
+ if (temp > xmax) xmax = temp;
+ }
+
+ /* Qantizing and coding of xmax to get xmaxc.
+ */
+
+ exp = 0;
+ temp = SASR( xmax, 9 );
+ itest = 0;
+
+ for (i = 0; i <= 5; i++) {
+
+ itest |= (temp <= 0);
+ temp = SASR( temp, 1 );
+
+ assert(exp <= 5);
+ if (itest == 0) exp++; /* exp = add (exp, 1) */
+ }
+
+ assert(exp <= 6 && exp >= 0);
+ temp = exp + 5;
+
+ assert(temp <= 11 && temp >= 0);
+ xmaxc = gsm_add( SASR(xmax, temp), exp << 3 );
+
+ /* Quantizing and coding of the xM[0..12] RPE sequence
+ * to get the xMc[0..12]
+ */
+
+ APCM_quantization_xmaxc_to_exp_mant( xmaxc, &exp, &mant );
+
+ /* This computation uses the fact that the decoded version of xmaxc
+ * can be calculated by using the exponent and the mantissa part of
+ * xmaxc (logarithmic table).
+ * So, this method avoids any division and uses only a scaling
+ * of the RPE samples by a function of the exponent. A direct
+ * multiplication by the inverse of the mantissa (NRFAC[0..7]
+ * found in table 4.5) gives the 3 bit coded version xMc[0..12]
+ * of the RPE samples.
+ */
+
+
+ /* Direct computation of xMc[0..12] using table 4.5
+ */
+
+ assert( exp <= 4096 && exp >= -4096);
+ assert( mant >= 0 && mant <= 7 );
+
+ temp1 = 6 - exp; /* normalization by the exponent */
+ temp2 = gsm_NRFAC[ mant ]; /* inverse mantissa */
+
+ for (i = 0; i <= 12; i++) {
+
+ assert(temp1 >= 0 && temp1 < 16);
+
+ temp = xM[i] << temp1;
+ temp = GSM_MULT( temp, temp2 );
+ temp = SASR(temp, 12);
+ xMc[i] = temp + 4; /* see note below */
+ }
+
+ /* NOTE: This equation is used to make all the xMc[i] positive.
+ */
+
+ *mant_out = mant;
+ *exp_out = exp;
+ *xmaxc_out = xmaxc;
+}
+
+/* 4.2.16 */
+
+static void APCM_inverse_quantization (
+ register word * xMc, /* [0..12] IN */
+ word mant,
+ word exp,
+ register word * xMp) /* [0..12] OUT */
+/*
+ * This part is for decoding the RPE sequence of coded xMc[0..12]
+ * samples to obtain the xMp[0..12] array. Table 4.6 is used to get
+ * the mantissa of xmaxc (FAC[0..7]).
+ */
+{
+ int i;
+ word temp, temp1, temp2, temp3;
+ longword ltmp;
+
+ assert( mant >= 0 && mant <= 7 );
+
+ temp1 = gsm_FAC[ mant ]; /* see 4.2-15 for mant */
+ temp2 = gsm_sub( 6, exp ); /* see 4.2-15 for exp */
+ temp3 = gsm_asl( 1, gsm_sub( temp2, 1 ));
+
+ for (i = 13; i--;) {
+
+ assert( *xMc <= 7 && *xMc >= 0 ); /* 3 bit unsigned */
+
+ /* temp = gsm_sub( *xMc++ << 1, 7 ); */
+ temp = (*xMc++ << 1) - 7; /* restore sign */
+ assert( temp <= 7 && temp >= -7 ); /* 4 bit signed */
+
+ temp <<= 12; /* 16 bit signed */
+ temp = GSM_MULT_R( temp1, temp );
+ temp = GSM_ADD( temp, temp3 );
+ *xMp++ = gsm_asr( temp, temp2 );
+ }
+}
+
+/* 4.2.17 */
+
+static void RPE_grid_positioning (
+ word Mc, /* grid position IN */
+ register word * xMp, /* [0..12] IN */
+ register word * ep /* [0..39] OUT */
+)
+/*
+ * This procedure computes the reconstructed long term residual signal
+ * ep[0..39] for the LTP analysis filter. The inputs are the Mc
+ * which is the grid position selection and the xMp[0..12] decoded
+ * RPE samples which are upsampled by a factor of 3 by inserting zero
+ * values.
+ */
+{
+ int i = 13;
+
+ assert(0 <= Mc && Mc <= 3);
+
+ switch (Mc) {
+ case 3: *ep++ = 0;
+ case 2: do {
+ *ep++ = 0;
+ case 1: *ep++ = 0;
+ case 0: *ep++ = *xMp++;
+ } while (--i);
+ }
+ while (++Mc < 4) *ep++ = 0;
+
+ /*
+
+ int i, k;
+ for (k = 0; k <= 39; k++) ep[k] = 0;
+ for (i = 0; i <= 12; i++) {
+ ep[ Mc + (3*i) ] = xMp[i];
+ }
+ */
+}
+
+/* 4.2.18 */
+
+/* This procedure adds the reconstructed long term residual signal
+ * ep[0..39] to the estimated signal dpp[0..39] from the long term
+ * analysis filter to compute the reconstructed short term residual
+ * signal dp[-40..-1]; also the reconstructed short term residual
+ * array dp[-120..-41] is updated.
+ */
+
+#if 0 /* Has been inlined in code.c */
+void Gsm_Update_of_reconstructed_short_time_residual_signal P3((dpp, ep, dp),
+ word * dpp, /* [0...39] IN */
+ word * ep, /* [0...39] IN */
+ word * dp) /* [-120...-1] IN/OUT */
+{
+ int k;
+
+ for (k = 0; k <= 79; k++)
+ dp[ -120 + k ] = dp[ -80 + k ];
+
+ for (k = 0; k <= 39; k++)
+ dp[ -40 + k ] = gsm_add( ep[k], dpp[k] );
+}
+#endif /* Has been inlined in code.c */
+
+void Gsm_RPE_Encoding (
+
+ struct gsm_state * S,
+
+ word * e, /* -5..-1][0..39][40..44 IN/OUT */
+ word * xmaxc, /* OUT */
+ word * Mc, /* OUT */
+ word * xMc) /* [0..12] OUT */
+{
+ word x[40];
+ word xM[13], xMp[13];
+ word mant, exp;
+
+ Weighting_filter(e, x);
+ RPE_grid_selection(x, xM, Mc);
+
+ APCM_quantization( xM, xMc, &mant, &exp, xmaxc);
+ APCM_inverse_quantization( xMc, mant, exp, xMp);
+
+ RPE_grid_positioning( *Mc, xMp, e );
+
+}
+
+void Gsm_RPE_Decoding (
+ struct gsm_state * S,
+
+ word xmaxcr,
+ word Mcr,
+ word * xMcr, /* [0..12], 3 bits IN */
+ word * erp /* [0..39] OUT */
+)
+{
+ word exp, mant;
+ word xMp[ 13 ];
+
+ APCM_quantization_xmaxc_to_exp_mant( xmaxcr, &exp, &mant );
+ APCM_inverse_quantization( xMcr, mant, exp, xMp );
+ RPE_grid_positioning( Mcr, xMp, erp );
+
+}
--- /dev/null
+++ b/src/gsm/short_term.c
@@ -1,0 +1,428 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/src/gsm/Attic/short_term.c,v 1.1 2001/11/14 03:31:26 cbagwell Exp $ */
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "private.h"
+
+#include "gsm.h"
+
+/*
+ * SHORT TERM ANALYSIS FILTERING SECTION
+ */
+
+/* 4.2.8 */
+
+static void Decoding_of_the_coded_Log_Area_Ratios (
+ word * LARc, /* coded log area ratio [0..7] IN */
+ word * LARpp) /* out: decoded .. */
+{
+ register word temp1 /* , temp2 */;
+ register long ltmp; /* for GSM_ADD */
+
+ /* This procedure requires for efficient implementation
+ * two tables.
+ *
+ * INVA[1..8] = integer( (32768 * 8) / real_A[1..8])
+ * MIC[1..8] = minimum value of the LARc[1..8]
+ */
+
+ /* Compute the LARpp[1..8]
+ */
+
+ /* for (i = 1; i <= 8; i++, B++, MIC++, INVA++, LARc++, LARpp++) {
+ *
+ * temp1 = GSM_ADD( *LARc, *MIC ) << 10;
+ * temp2 = *B << 1;
+ * temp1 = GSM_SUB( temp1, temp2 );
+ *
+ * assert(*INVA != MIN_WORD);
+ *
+ * temp1 = GSM_MULT_R( *INVA, temp1 );
+ * *LARpp = GSM_ADD( temp1, temp1 );
+ * }
+ */
+
+#undef STEP
+#define STEP( B, MIC, INVA ) \
+ temp1 = GSM_ADD( *LARc++, MIC ) << 10; \
+ temp1 = GSM_SUB( temp1, B << 1 ); \
+ temp1 = GSM_MULT_R( INVA, temp1 ); \
+ *LARpp++ = GSM_ADD( temp1, temp1 );
+
+ STEP( 0, -32, 13107 );
+ STEP( 0, -32, 13107 );
+ STEP( 2048, -16, 13107 );
+ STEP( -2560, -16, 13107 );
+
+ STEP( 94, -8, 19223 );
+ STEP( -1792, -8, 17476 );
+ STEP( -341, -4, 31454 );
+ STEP( -1144, -4, 29708 );
+
+ /* NOTE: the addition of *MIC is used to restore
+ * the sign of *LARc.
+ */
+}
+
+/* 4.2.9 */
+/* Computation of the quantized reflection coefficients
+ */
+
+/* 4.2.9.1 Interpolation of the LARpp[1..8] to get the LARp[1..8]
+ */
+
+/*
+ * Within each frame of 160 analyzed speech samples the short term
+ * analysis and synthesis filters operate with four different sets of
+ * coefficients, derived from the previous set of decoded LARs(LARpp(j-1))
+ * and the actual set of decoded LARs (LARpp(j))
+ *
+ * (Initial value: LARpp(j-1)[1..8] = 0.)
+ */
+
+static void Coefficients_0_12 (
+ register word * LARpp_j_1,
+ register word * LARpp_j,
+ register word * LARp)
+{
+ register int i;
+ register longword ltmp;
+
+ for (i = 1; i <= 8; i++, LARp++, LARpp_j_1++, LARpp_j++) {
+ *LARp = GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 ));
+ *LARp = GSM_ADD( *LARp, SASR( *LARpp_j_1, 1));
+ }
+}
+
+static void Coefficients_13_26 (
+ register word * LARpp_j_1,
+ register word * LARpp_j,
+ register word * LARp)
+{
+ register int i;
+ register longword ltmp;
+ for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) {
+ *LARp = GSM_ADD( SASR( *LARpp_j_1, 1), SASR( *LARpp_j, 1 ));
+ }
+}
+
+static void Coefficients_27_39 (
+ register word * LARpp_j_1,
+ register word * LARpp_j,
+ register word * LARp)
+{
+ register int i;
+ register longword ltmp;
+
+ for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) {
+ *LARp = GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 ));
+ *LARp = GSM_ADD( *LARp, SASR( *LARpp_j, 1 ));
+ }
+}
+
+
+static void Coefficients_40_159 (
+ register word * LARpp_j,
+ register word * LARp)
+{
+ register int i;
+
+ for (i = 1; i <= 8; i++, LARp++, LARpp_j++)
+ *LARp = *LARpp_j;
+}
+
+/* 4.2.9.2 */
+
+static void LARp_to_rp (
+ register word * LARp) /* [0..7] IN/OUT */
+/*
+ * The input of this procedure is the interpolated LARp[0..7] array.
+ * The reflection coefficients, rp[i], are used in the analysis
+ * filter and in the synthesis filter.
+ */
+{
+ register int i;
+ register word temp;
+ register longword ltmp;
+
+ for (i = 1; i <= 8; i++, LARp++) {
+
+ /* temp = GSM_ABS( *LARp );
+ *
+ * if (temp < 11059) temp <<= 1;
+ * else if (temp < 20070) temp += 11059;
+ * else temp = GSM_ADD( temp >> 2, 26112 );
+ *
+ * *LARp = *LARp < 0 ? -temp : temp;
+ */
+
+ if (*LARp < 0) {
+ temp = *LARp == MIN_WORD ? MAX_WORD : -(*LARp);
+ *LARp = - ((temp < 11059) ? temp << 1
+ : ((temp < 20070) ? temp + 11059
+ : GSM_ADD( temp >> 2, 26112 )));
+ } else {
+ temp = *LARp;
+ *LARp = (temp < 11059) ? temp << 1
+ : ((temp < 20070) ? temp + 11059
+ : GSM_ADD( temp >> 2, 26112 ));
+ }
+ }
+}
+
+
+/* 4.2.10 */
+static void Short_term_analysis_filtering (
+ struct gsm_state * S,
+ register word * rp, /* [0..7] IN */
+ register int k_n, /* k_end - k_start */
+ register word * s /* [0..n-1] IN/OUT */
+)
+/*
+ * This procedure computes the short term residual signal d[..] to be fed
+ * to the RPE-LTP loop from the s[..] signal and from the local rp[..]
+ * array (quantized reflection coefficients). As the call of this
+ * procedure can be done in many ways (see the interpolation of the LAR
+ * coefficient), it is assumed that the computation begins with index
+ * k_start (for arrays d[..] and s[..]) and stops with index k_end
+ * (k_start and k_end are defined in 4.2.9.1). This procedure also
+ * needs to keep the array u[0..7] in memory for each call.
+ */
+{
+ register word * u = S->u;
+ register int i;
+ register word di, zzz, ui, sav, rpi;
+ register longword ltmp;
+
+ for (; k_n--; s++) {
+
+ di = sav = *s;
+
+ for (i = 0; i < 8; i++) { /* YYY */
+
+ ui = u[i];
+ rpi = rp[i];
+ u[i] = sav;
+
+ zzz = GSM_MULT_R(rpi, di);
+ sav = GSM_ADD( ui, zzz);
+
+ zzz = GSM_MULT_R(rpi, ui);
+ di = GSM_ADD( di, zzz );
+ }
+
+ *s = di;
+ }
+}
+
+#if defined(USE_FLOAT_MUL) && defined(FAST)
+
+static void Fast_Short_term_analysis_filtering (
+ struct gsm_state * S,
+ register word * rp, /* [0..7] IN */
+ register int k_n, /* k_end - k_start */
+ register word * s /* [0..n-1] IN/OUT */
+)
+{
+ register word * u = S->u;
+ register int i;
+
+ float uf[8],
+ rpf[8];
+
+ register float scalef = 3.0517578125e-5;
+ register float sav, di, temp;
+
+ for (i = 0; i < 8; ++i) {
+ uf[i] = u[i];
+ rpf[i] = rp[i] * scalef;
+ }
+ for (; k_n--; s++) {
+ sav = di = *s;
+ for (i = 0; i < 8; ++i) {
+ register float rpfi = rpf[i];
+ register float ufi = uf[i];
+
+ uf[i] = sav;
+ temp = rpfi * di + ufi;
+ di += rpfi * ufi;
+ sav = temp;
+ }
+ *s = di;
+ }
+ for (i = 0; i < 8; ++i) u[i] = uf[i];
+}
+#endif /* ! (defined (USE_FLOAT_MUL) && defined (FAST)) */
+
+static void Short_term_synthesis_filtering (
+ struct gsm_state * S,
+ register word * rrp, /* [0..7] IN */
+ register int k, /* k_end - k_start */
+ register word * wt, /* [0..k-1] IN */
+ register word * sr /* [0..k-1] OUT */
+)
+{
+ register word * v = S->v;
+ register int i;
+ register word sri, tmp1, tmp2;
+ register longword ltmp; /* for GSM_ADD & GSM_SUB */
+
+ while (k--) {
+ sri = *wt++;
+ for (i = 8; i--;) {
+
+ /* sri = GSM_SUB( sri, gsm_mult_r( rrp[i], v[i] ) );
+ */
+ tmp1 = rrp[i];
+ tmp2 = v[i];
+ tmp2 = ( tmp1 == MIN_WORD && tmp2 == MIN_WORD
+ ? MAX_WORD
+ : 0x0FFFF & (( (longword)tmp1 * (longword)tmp2
+ + 16384) >> 15)) ;
+
+ sri = GSM_SUB( sri, tmp2 );
+
+ /* v[i+1] = GSM_ADD( v[i], gsm_mult_r( rrp[i], sri ) );
+ */
+ tmp1 = ( tmp1 == MIN_WORD && sri == MIN_WORD
+ ? MAX_WORD
+ : 0x0FFFF & (( (longword)tmp1 * (longword)sri
+ + 16384) >> 15)) ;
+
+ v[i+1] = GSM_ADD( v[i], tmp1);
+ }
+ *sr++ = v[0] = sri;
+ }
+}
+
+
+#if defined(FAST) && defined(USE_FLOAT_MUL)
+
+static void Fast_Short_term_synthesis_filtering (
+ struct gsm_state * S,
+ register word * rrp, /* [0..7] IN */
+ register int k, /* k_end - k_start */
+ register word * wt, /* [0..k-1] IN */
+ register word * sr /* [0..k-1] OUT */
+)
+{
+ register word * v = S->v;
+ register int i;
+
+ float va[9], rrpa[8];
+ register float scalef = 3.0517578125e-5, temp;
+
+ for (i = 0; i < 8; ++i) {
+ va[i] = v[i];
+ rrpa[i] = (float)rrp[i] * scalef;
+ }
+ while (k--) {
+ register float sri = *wt++;
+ for (i = 8; i--;) {
+ sri -= rrpa[i] * va[i];
+ if (sri < -32768.) sri = -32768.;
+ else if (sri > 32767.) sri = 32767.;
+
+ temp = va[i] + rrpa[i] * sri;
+ if (temp < -32768.) temp = -32768.;
+ else if (temp > 32767.) temp = 32767.;
+ va[i+1] = temp;
+ }
+ *sr++ = va[0] = sri;
+ }
+ for (i = 0; i < 9; ++i) v[i] = va[i];
+}
+
+#endif /* defined(FAST) && defined(USE_FLOAT_MUL) */
+
+void Gsm_Short_Term_Analysis_Filter (
+
+ struct gsm_state * S,
+
+ word * LARc, /* coded log area ratio [0..7] IN */
+ word * s /* signal [0..159] IN/OUT */
+)
+{
+ word * LARpp_j = S->LARpp[ S->j ];
+ word * LARpp_j_1 = S->LARpp[ S->j ^= 1 ];
+
+ word LARp[8];
+
+#undef FILTER
+#if defined(FAST) && defined(USE_FLOAT_MUL)
+# define FILTER (* (S->fast \
+ ? Fast_Short_term_analysis_filtering \
+ : Short_term_analysis_filtering ))
+
+#else
+# define FILTER Short_term_analysis_filtering
+#endif
+
+ Decoding_of_the_coded_Log_Area_Ratios( LARc, LARpp_j );
+
+ Coefficients_0_12( LARpp_j_1, LARpp_j, LARp );
+ LARp_to_rp( LARp );
+ FILTER( S, LARp, 13, s);
+
+ Coefficients_13_26( LARpp_j_1, LARpp_j, LARp);
+ LARp_to_rp( LARp );
+ FILTER( S, LARp, 14, s + 13);
+
+ Coefficients_27_39( LARpp_j_1, LARpp_j, LARp);
+ LARp_to_rp( LARp );
+ FILTER( S, LARp, 13, s + 27);
+
+ Coefficients_40_159( LARpp_j, LARp);
+ LARp_to_rp( LARp );
+ FILTER( S, LARp, 120, s + 40);
+}
+
+void Gsm_Short_Term_Synthesis_Filter (
+ struct gsm_state * S,
+
+ word * LARcr, /* received log area ratios [0..7] IN */
+ word * wt, /* received d [0..159] IN */
+
+ word * s /* signal s [0..159] OUT */
+)
+{
+ word * LARpp_j = S->LARpp[ S->j ];
+ word * LARpp_j_1 = S->LARpp[ S->j ^=1 ];
+
+ word LARp[8];
+
+#undef FILTER
+#if defined(FAST) && defined(USE_FLOAT_MUL)
+
+# define FILTER (* (S->fast \
+ ? Fast_Short_term_synthesis_filtering \
+ : Short_term_synthesis_filtering ))
+#else
+# define FILTER Short_term_synthesis_filtering
+#endif
+
+ Decoding_of_the_coded_Log_Area_Ratios( LARcr, LARpp_j );
+
+ Coefficients_0_12( LARpp_j_1, LARpp_j, LARp );
+ LARp_to_rp( LARp );
+ FILTER( S, LARp, 13, wt, s );
+
+ Coefficients_13_26( LARpp_j_1, LARpp_j, LARp);
+ LARp_to_rp( LARp );
+ FILTER( S, LARp, 14, wt + 13, s + 13 );
+
+ Coefficients_27_39( LARpp_j_1, LARpp_j, LARp);
+ LARp_to_rp( LARp );
+ FILTER( S, LARp, 13, wt + 27, s + 27 );
+
+ Coefficients_40_159( LARpp_j, LARp );
+ LARp_to_rp( LARp );
+ FILTER(S, LARp, 120, wt + 40, s + 40);
+}
--- a/src/handlers.c
+++ b/src/handlers.c
@@ -79,7 +79,7 @@
(char *)0
};
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
/* GSM 06.10 */
static char *gsmnames[] = {
"gsm",
@@ -264,7 +264,7 @@
{dvmsnames, 0,
st_dvmsstartread, st_cvsdread, st_cvsdstopread,
st_dvmsstartwrite, st_cvsdwrite, st_dvmsstopwrite, st_format_nothing_seek},
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
{gsmnames, 0,
st_gsmstartread, st_gsmread, st_gsmstopread,
st_gsmstartwrite, st_gsmwrite, st_gsmstopwrite, st_format_nothing_seek},
--- a/src/sox.c
+++ b/src/sox.c
@@ -1169,7 +1169,7 @@
fprintf(stderr, "Failed: %s\n", opt);
else {
fprintf(stderr,"gopts: -e -h -p -v volume -V\n\n");
- fprintf(stderr,"fopts: -r rate -c channels -s/-u/-U/-A/-a/-i/-g -b/-w/-l/-f/-d/-D -x\n\n");
+ fprintf(stderr,"fopts: -r rate -c channels -s/-u/-U/-A/-a/-i/-g/-f -b/-w/-l -x\n\n");
fprintf(stderr, "effect: ");
for (i = 0; st_effects[i].name != NULL; i++) {
fprintf(stderr, "%s ", st_effects[i].name);
--- a/src/st.h
+++ b/src/st.h
@@ -22,14 +22,19 @@
#define ST_LIB_VERSION_CODE 0x0c1103
#define ST_LIB_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#else
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#else
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+typedef u_int32_t uint32_t;
+#else
+typdef long int32_t;
+typedef unsigned long uint32_t;
+#endif
#endif
#endif
--- a/src/st_i.h
+++ b/src/st_i.h
@@ -192,7 +192,7 @@
int st_dvmsstartwrite(ft_t ft);
int st_dvmsstopwrite(ft_t ft);
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
int st_gsmstartread(ft_t ft);
st_ssize_t st_gsmread(ft_t ft, st_sample_t *buf, st_ssize_t len);
int st_gsmstopread(ft_t ft);
--- a/src/wav.c
+++ b/src/wav.c
@@ -71,8 +71,8 @@
#include "wav.h"
#include "ima_rw.h"
#include "adpcm.h"
-#ifdef HAVE_LIBGSM
-#include "gsm.h"
+#ifdef ENABLE_GSM
+#include "gsm/gsm.h"
#endif
#undef PAD_NSAMPS
@@ -99,7 +99,7 @@
int state[16]; /* step-size info for *ADPCM writes */
/* following used by GSM 6.10 wav */
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
gsm gsmhandle;
gsm_signal *gsmsample;
int gsmindex;
@@ -241,7 +241,7 @@
/****************************************************************************/
/* WAV GSM6.10 support functions */
/****************************************************************************/
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
/* create the gsm object, malloc buffer for 160*2 samples */
int wavgsminit(ft_t ft)
{
@@ -557,7 +557,7 @@
st_fail_errno(ft,ST_EHDR,"Sorry, this WAV file is in Dolby AC2 format.");
return ST_EOF;
case WAVE_FORMAT_GSM610:
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
if (ft->info.encoding == -1 || ft->info.encoding == ST_ENCODING_GSM )
ft->info.encoding = ST_ENCODING_GSM;
else
@@ -742,7 +742,7 @@
bytespersample = ST_SIZE_WORD; /* AFTER de-compression */
break;
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
/* GSM formats have extended fmt chunk. Check for those cases. */
case WAVE_FORMAT_GSM610:
if (wExtSize < 2)
@@ -854,7 +854,7 @@
ft->length = wav->numSamples*ft->info.channels;
break;
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
case WAVE_FORMAT_GSM610:
wav->numSamples = (((dwDataLength / wav->blockAlign) * wav->samplesPerBlock) * ft->info.channels);
wavgsminit(ft);
@@ -887,7 +887,7 @@
wExtSize,wav->samplesPerBlock,bytesPerBlock);
break;
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
case WAVE_FORMAT_GSM610:
st_report("GSM .wav: %d Extsize, %d Samps/block, %d samples",
wExtSize,wav->samplesPerBlock,wav->numSamples);
@@ -1028,7 +1028,7 @@
return done;
break;
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
case ST_ENCODING_GSM:
if (len > wav->numSamples)
len = wav->numSamples;
@@ -1070,7 +1070,7 @@
switch (ft->info.encoding)
{
-#ifdef HAVE_LIBGSM
+#ifdef ENABLEGSM
case ST_ENCODING_GSM:
wavgsmdestroy(ft);
break;
@@ -1139,7 +1139,7 @@
wav->samplePtr = wav->samples;
break;
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
case WAVE_FORMAT_GSM610:
wavgsminit(ft);
break;
@@ -1338,7 +1338,7 @@
wSamplesPerBlock = AdpcmSamplesIn(0, wChannels, wBlockAlign, 0);
break;
case ST_ENCODING_GSM:
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
if (wChannels!=1)
{
st_warn("Overriding GSM audio from %d channel to 1\n",wChannels);
@@ -1372,7 +1372,7 @@
case WAVE_FORMAT_IMA_ADPCM:
dwDataLength = wav->dataLength;
break;
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
case WAVE_FORMAT_GSM610:
/* intentional case fallthrough! */
#endif
@@ -1383,7 +1383,7 @@
}
}
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
if (wFormatTag == WAVE_FORMAT_GSM610)
dwDataLength = (dwDataLength+1) & ~1; /*round up to even */
#endif
@@ -1429,7 +1429,7 @@
st_writew(ft, iCoef[i][1]);
}
break;
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
case WAVE_FORMAT_GSM610:
st_writew(ft, wSamplesPerBlock);
break;
@@ -1457,7 +1457,7 @@
} else {
st_report("Finished writing Wave file, %u data bytes %u samples\n",
dwDataLength,wav->numSamples);
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
if (wFormatTag == WAVE_FORMAT_GSM610){
st_report("GSM6.10 format: %u blocks %u padded samples %u padded data bytes\n",
blocksWritten, wSamplesWritten, dwDataLength);
@@ -1499,7 +1499,7 @@
return total_len - len;
break;
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
case WAVE_FORMAT_GSM610:
len = wavgsmwrite(ft, buf, len);
wav->numSamples += len;
@@ -1527,7 +1527,7 @@
case WAVE_FORMAT_ADPCM:
xxxAdpcmWriteBlock(ft);
break;
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
case WAVE_FORMAT_GSM610:
wavgsmstopwrite(ft);
break;
@@ -1620,7 +1620,7 @@
{
case WAVE_FORMAT_IMA_ADPCM:
case WAVE_FORMAT_ADPCM:
-#ifdef HAVE_LIBGSM
+#ifdef ENABLE_GSM
case WAVE_FORMAT_GSM610:
#endif
st_fail_errno(ft,ST_ENOTSUP,"Only PCM Supported");