ref: 8791cbd4a9f89b06f87ea3f85f8c2d2432bf8903
parent: 8abc793d95d141a162b56730d2061c49ca0515b8
author: cbagwell <cbagwell>
date: Sat Aug 26 17:24:57 EDT 2000
Updated lowp and highp filters to use a different filter algorthim. highp actually works now. Adding error checking to sphere handler and can autodetect it now. more man page updates.
--- a/Makefile.gcc
+++ b/Makefile.gcc
@@ -133,11 +133,6 @@
# DOS_DEFINES = -DDOS
# RM = del /q
-# Uncomment the following line if compiling under NeXT.
-# defines .snd to mean a NeXT sound format file only.
-#
-# NEXT_DEFINES = -DNeXT
-
# MISC DEFINES - The catch all for things that make even less sense
# then normal under unix. If you need more than one of the following
# MISC DEFINES remember to include them on one line so it isn't just
--- a/README
+++ b/README
@@ -2,32 +2,41 @@
SoX (also known as Sound eXchange) translates sound samples between different
-file formats, and optionally performs various sound effects.
+file formats, and optionally applies various sound effects.
+SoX is intended as the Swiss Army knife of sound processing tools. It
+doesn't do anything very well, but sooner or later it comes in very handy.
+
This release understands:
o Raw files in various binary formats
o Raw textual data
- o Microsoft .WAV files
+ o Amiga 8svx files
+ o Apple/SGI AIFF files
+ o SUN .au style files
o PCM, u-law, a-law
- o MS ADPCM
- o IMA ADPCM
- o GSM
- o MAUD files
- o Sound Blaster .VOC files
- o IRCAM SoundFile files
- o SUN .au files
- o PCM, u-law, a-law
o G7xx ADPCM files (read only)
- o mutant DEC .au files
- o Apple/SGI AIFF files
+ o mutant DEC .au files
+ o NeXT .snd files
+ o AVR files
o CD-R (music CD format)
+ o CVS and VMS files (continous variable slope)
+ o GSM files.
o Macintosh HCOM files
- o Sounder files
- o NeXT .snd files
+ o Amiga MAUD files
+ o IRCAM SoundFile files
+ o NIST SPHERE files
+ o Turtle beach SampleVision files.
o Soundtool (DOS) files
- o Psion (palmtop) A-law files
- o AVR files
+ o Yamaha TX-16W sampler files.
+ o Sound Blaster .VOC files
+ o Microsoft .WAV files
+ o PCM, u-law, a-law
+ o MS ADPCM, IMA ADPCM
+ o GSM
+ o Psion (palmtop) A-law WVE files
+ o Pseudo-file fomats that allow direct playing/recording
+ from some audio devices under unix.
The sound effects include:
@@ -73,11 +82,6 @@
Technically, SoX is made up of a sound file processing library called libst
and SoX is a program implemented using this library.
-
-SoX is intended as the Swiss Army knife of sound processing tools. It
-doesn't do anything very well, but sooner or later it comes in very handy.
-SoX is really only usable day-to-day if you hide the wacky options with
-one-line shell scripts.
Installing:
--- a/configure
+++ b/configure
@@ -1123,10 +1123,6 @@
CFLAGS="$CFLAGS -D_HPUX_SOURCE"
;;
- *next*|*rhapsody*|*apple*darwin* )
- CFLAGS="$CFLAGS -DNeXT"
- ;;
-
*cygwin* )
CFLAGS="$CFLAGS -mno-cygwin"
LDFLAGS="$LDFLAGS -mno-cygwin"
@@ -1145,7 +1141,7 @@
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:1149: checking whether byte ordering is bigendian" >&5
+echo "configure:1145: 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
@@ -1152,7 +1148,7 @@
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
-#line 1156 "configure"
+#line 1152 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -1163,11 +1159,11 @@
#endif
; return 0; }
EOF
-if { (eval echo configure:1167: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1163: \"$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 1171 "configure"
+#line 1167 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -1178,7 +1174,7 @@
#endif
; return 0; }
EOF
-if { (eval echo configure:1182: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1178: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
@@ -1198,7 +1194,7 @@
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1202 "configure"
+#line 1198 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
@@ -1211,7 +1207,7 @@
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
-if { (eval echo configure:1215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1211: \"$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
@@ -1238,14 +1234,14 @@
echo "checking if math library is required during link" 1>&6
-echo "configure:1242: checking if math library is required during link" >&5
+echo "configure:1238: checking if math library is required during link" >&5
echo $ac_n "checking for pow""... $ac_c" 1>&6
-echo "configure:1244: checking for pow" >&5
+echo "configure:1240: 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 1249 "configure"
+#line 1245 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char pow(); below. */
@@ -1268,7 +1264,7 @@
; return 0; }
EOF
-if { (eval echo configure:1272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_pow=yes"
else
@@ -1290,7 +1286,7 @@
if test "$ac_cv_func_pow" = no
then
echo $ac_n "checking for pow in -lm""... $ac_c" 1>&6
-echo "configure:1294: checking for pow in -lm" >&5
+echo "configure:1290: 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
@@ -1298,7 +1294,7 @@
ac_save_LIBS="$LIBS"
LIBS="-lm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1302 "configure"
+#line 1298 "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
@@ -1309,7 +1305,7 @@
pow()
; return 0; }
EOF
-if { (eval echo configure:1313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1309: \"$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
@@ -1357,17 +1353,17 @@
ac_safe=`echo "gsm.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for gsm.h""... $ac_c" 1>&6
-echo "configure:1361: checking for gsm.h" >&5
+echo "configure:1357: checking for gsm.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 1366 "configure"
+#line 1362 "configure"
#include "confdefs.h"
#include <gsm.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1371: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1367: \"$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*
@@ -1392,7 +1388,7 @@
if test "$gsminc" = yes
then
echo $ac_n "checking for gsm_create in -lgsm""... $ac_c" 1>&6
-echo "configure:1396: checking for gsm_create in -lgsm" >&5
+echo "configure:1392: checking for gsm_create in -lgsm" >&5
ac_lib_var=`echo gsm'_'gsm_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1400,7 +1396,7 @@
ac_save_LIBS="$LIBS"
LIBS="-lgsm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1404 "configure"
+#line 1400 "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
@@ -1411,7 +1407,7 @@
gsm_create()
; return 0; }
EOF
-if { (eval echo configure:1415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1411: \"$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
@@ -1446,17 +1442,17 @@
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1450: checking for $ac_hdr" >&5
+echo "configure:1446: 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 1455 "configure"
+#line 1451 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1460: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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
rm -rf conftest*
@@ -1487,12 +1483,12 @@
for ac_func in getopt strerror memmove rand
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1491: checking for $ac_func" >&5
+echo "configure:1487: 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 1496 "configure"
+#line 1492 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1515,7 +1511,7 @@
; return 0; }
EOF
-if { (eval echo configure:1519: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1515: \"$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
@@ -1544,7 +1540,7 @@
if test "$alsa_dsp" = auto
then
echo $ac_n "checking whether /proc/asound is functional (ALSA)""... $ac_c" 1>&6
-echo "configure:1548: checking whether /proc/asound is functional (ALSA)" >&5
+echo "configure:1544: checking whether /proc/asound is functional (ALSA)" >&5
if eval "test \"`echo '$''{'ac_cv_dev_alsa_dsp'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1552,7 +1548,7 @@
ac_cv_dev_alsa_dsp=no
else
cat > conftest.$ac_ext <<EOF
-#line 1556 "configure"
+#line 1552 "configure"
#include "confdefs.h"
void *opendir(const char *);
@@ -1570,7 +1566,7 @@
}
EOF
-if { (eval echo configure:1574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_dev_alsa_dsp=yes
else
@@ -1592,17 +1588,17 @@
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1596: checking for $ac_hdr" >&5
+echo "configure:1592: 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 1601 "configure"
+#line 1597 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1606: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1602: \"$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*
@@ -1642,17 +1638,17 @@
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1646: checking for $ac_hdr" >&5
+echo "configure:1642: 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 1651 "configure"
+#line 1647 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1656: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1652: \"$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*
@@ -1687,7 +1683,7 @@
if test "$oss_dsp" = auto
then
echo $ac_n "checking whether /dev/dsp is functional (OSS)""... $ac_c" 1>&6
-echo "configure:1691: checking whether /dev/dsp is functional (OSS)" >&5
+echo "configure:1687: checking whether /dev/dsp is functional (OSS)" >&5
if eval "test \"`echo '$''{'ac_cv_dev_oss_dsp'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1695,7 +1691,7 @@
ac_cv_dev_oss_dsp=no
else
cat > conftest.$ac_ext <<EOF
-#line 1699 "configure"
+#line 1695 "configure"
#include "confdefs.h"
int open(const char *, int);
@@ -1713,7 +1709,7 @@
}
EOF
-if { (eval echo configure:1717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_dev_oss_dsp=yes
else
@@ -1735,17 +1731,17 @@
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1739: checking for $ac_hdr" >&5
+echo "configure:1735: 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 1744 "configure"
+#line 1740 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1749: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1745: \"$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*
@@ -1785,17 +1781,17 @@
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1789: checking for $ac_hdr" >&5
+echo "configure:1785: 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 1794 "configure"
+#line 1790 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1799: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1795: \"$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*
@@ -1830,7 +1826,7 @@
if test "$sun_audio" = auto
then
echo $ac_n "checking whether /dev/audio is functional (SUN style)""... $ac_c" 1>&6
-echo "configure:1834: checking whether /dev/audio is functional (SUN style)" >&5
+echo "configure:1830: checking whether /dev/audio is functional (SUN style)" >&5
if eval "test \"`echo '$''{'ac_cv_dev_sun_audio'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1838,7 +1834,7 @@
ac_cv_dev_sun_audio=no
else
cat > conftest.$ac_ext <<EOF
-#line 1842 "configure"
+#line 1838 "configure"
#include "confdefs.h"
int open(const char *, int);
@@ -1856,7 +1852,7 @@
}
EOF
-if { (eval echo configure:1860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_dev_sun_audio=yes
else
@@ -1878,17 +1874,17 @@
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1882: checking for $ac_hdr" >&5
+echo "configure:1878: 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 1887 "configure"
+#line 1883 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1888: \"$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*
@@ -1928,17 +1924,17 @@
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1932: checking for $ac_hdr" >&5
+echo "configure:1928: 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 1937 "configure"
+#line 1933 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1942: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1938: \"$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*
--- a/configure.in
+++ b/configure.in
@@ -63,10 +63,6 @@
CFLAGS="$CFLAGS -D_HPUX_SOURCE"
;;
- *next*|*rhapsody*|*apple*darwin* )
- CFLAGS="$CFLAGS -DNeXT"
- ;;
-
*cygwin* )
CFLAGS="$CFLAGS -mno-cygwin"
LDFLAGS="$LDFLAGS -mno-cygwin"
--- a/pick.c
+++ b/pick.c
@@ -81,12 +81,12 @@
if (effp->outinfo.channels != 1) /* must be one output channel */
{
- st_fail("Can't pick with other than 1 output channel.");
+ st_fail("Pick effect requires output to be forced to 1 channel. Currenty it is set for %d channels.",effp->outinfo.channels);
return (ST_EOF);
}
if (effp->ininfo.channels != 2 && effp->ininfo.channels != 4)
{
- st_fail("Can't pick with other than 2 or 4 input channels.");
+ st_fail("Pick effect can not work with mono input data.");
return (ST_EOF);
}
if (effp->ininfo.channels == 2) { /* check for valid option */
--- a/sox.1
+++ b/sox.1
@@ -70,11 +70,11 @@
.br
\fBflanger\fR \fIgain-in gain-out delay decay speed\fR < -s | -t >
.br
- \fBhighp\fR \fIcenter\fR
+ \fBhighp\fR \fIfrequency\fR
.br
\fBhighpass\fR \fIfrequency\fR
.br
- \fBlowp\fR \fIcenter\fR
+ \fBlowp\fR \fIfrequency\fR
.br
\fBlowpass\fR \fIfrequency\fR
.br
@@ -86,7 +86,7 @@
.br
\fBphaser\fR \fIgain-in gain-out delay decay speed\fR < -s | -t >
.br
- \fBpick\fR
+ \fBpick\fR [ \fI-1\fR | \fI-2\fR | \fI-3\fR | \fI-4\fR | \fI-l\fR | \fI-r\fR ]
.br
\fBpitch\fR \fIshift\fR [ \fIwidth interpole fade\fR ]
.br
@@ -407,6 +407,17 @@
Sound Files are used by academic music software
such as the CSound package, and the MixView sound sample editor.
.TP 10
+.B .sph
+.br
+SPHERE (SPeech HEader Resources) is a file format defined by NIST
+(National Institute of Standards and Technology) and is used with
+speech audio. SoX can read these files when they contain
+ulaw and PCM data. It will ignore any header information that
+says the data is compressed using \fIshorten\fR compression and
+will treat the data as either ulaw or PCM. This will allow SoX
+and the command line \fIshorten\fR program to be ran together using
+pipes to uncompress the data and then pass the result to SoX for processing.
+.TP 10
.B .smp
Turtle Beach SampleVision files.
.br
@@ -415,6 +426,16 @@
sample rates are supported by the package, although not all are supported by
the samplers themselves. Currently loop points are ignored.
.TP 10
+.B .snd
+.br
+Under DOS this file format is the same as the \fB.sndt\fR format. Under all
+other platforms it is the same as the \fB.au\fR format.
+.TP 10
+.B .sndt
+SoundTool files.
+.br
+This is an older DOS file format.
+.TP 10
.B sunau
Sun /dev/audio device driver
.br
@@ -653,11 +674,11 @@
The modulation is either sinodial (-s) or triangular
(-t). Gain-out is the volume of the output.
.TP 10
-highp \fIcenter
-Apply a high-pass filter.
+highp \fIfrequency\fR
+Apply a single pole recursive high-pass filter.
The frequency response drops logarithmically with
-.I center
-frequency in the middle of the drop.
+I frequency
+in the middle of the drop.
The slope of the filter is quite gentle.
See \fBfilter\fR for a highpass effect with sharper cutoff.
.TP 10
@@ -664,11 +685,11 @@
highpass \fIfrequency\fB
Butterworth highpass filter. Description comming soon!
.TP 10
-lowp \fIcenter
-Apply a low-pass filter.
+lowp \fIfrequency\fR
+Apply a single pole recursive low-pass filter.
The frequency response drops logarithmically with
-.I center
-frequency in the middle of the drop.
+.I frequency
+in the middle of the drop.
The slope of the filter is quite gentle.
See \fBfilter\fR for a lowpass effect with sharper cutoff.
.TP 10
@@ -710,9 +731,12 @@
(-t). The decay should be less than 0.5 to avoid
feedback. Gain-out is the volume of the output.
.TP 10
-pick
+pick [ \fI-1\fR | \fI-2\fR | \fI-3\fR | \fI-4\fR | \fI-l\fR | \fI-r\fR ]
Select the left or right channel of a stereo sample,
-or one of four channels in a quadrophonic sample.
+or one of four channels in a quadrophonic sample. The \fI-l\fR and \fI-r\fR
+options represent either the left or right channel. It is required that
+you use the \fB-c 1\fR command line option in order to force the output file to
+contain only 1 channel.
.TP 10
pitch \fIshift [ width interpole fade ]\fB
Change the pitch of file without affecting its duration by cross-fading
--- a/sox.txt
+++ b/sox.txt
@@ -42,15 +42,15 @@
echos gain-in gain-out delay decay [ delay decay ...]
filter [ low ]-[ high ] [ window-len [ beta ]]
flanger gain-in gain-out delay decay speed < -s | -t >
- highp center
+ highp frequency
highpass frequency
- lowp center
+ lowp frequency
lowpass frequency
map
mask
pan direction
phaser gain-in gain-out delay decay speed < -s | -t >
- pick
+ pick [ -1 | -2 | -3 | -4 | -l | -r ]
pitch shift [ width interpole fade ]
polyphase [ -w < nut / ham > ]
[ -width < long / short / # > ]
@@ -425,35 +425,35 @@
such as the CSound package, and the MixView
sound sample editor.
+ .sph
+ 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 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.
- 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
- /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
- audio 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 hardware can handle. Example: -t sunau -w
- -s /dev/audio or -t sunau -U -c 1 /dev/audio for
- older sun equipment.
+ .snd
+ Under DOS this file format is the same as the
+ .sndt format. Under all other platforms it is
+ the same as the .au format.
- .txw Yamaha TX-16W sampler.
- 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
+ .sndt SoundTool files.
+ This is an older DOS file format.
@@ -466,129 +466,129 @@
SoX(1) SoX(1)
- sample 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
+ 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
+ /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
+ audio 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 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-
+ 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
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.
.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
- all of these formats including (NEW!) the ADPCM
- encoding.
+ Output format options will cause a format con-
+ version, and the .wav will written appropri-
+ ately. Sox currently can read PCM, ULAW, ALAW,
- .wve Psion 8-bit alaw
- 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
- encoding (signed, unsigned, etc.) of the sample
- file must be given. The number of channels
- defaults to 1.
- .ub, .sb, .uw, .sw, .ul, .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),
+ July 24, 2000 8
- July 24, 2000 8
+SoX(1) SoX(1)
+ MS ADPCM, and IMA (or DVI) ADPCM. It can write
+ all of these formats including (NEW!) the ADPCM
+ encoding.
-SoX(1) SoX(1)
+ .wve Psion 8-bit alaw
+ 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
+ encoding (signed, unsigned, etc.) of the sample
+ file must be given. The number of channels
+ defaults to 1.
- and "signed long". The sample rate defaults to
+ .ub, .sb, .uw, .sw, .ul, .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),
+ 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
+ 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
+ of 8000 hz. (Certain sound management software
cheerfully ignores the headers.) 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 ]
- 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 and -r options to select only the left or
- right channel for the output instead of averag-
+ reducing the number of channels it is possible
+ to manually specify the avg effect and use the
+ -l and -r options to select only the left or
+ right channel for the output instead of averag-
ing the two channels.
- band [ -n ] center [ width ]
- 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
- 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-
- 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
- effect with steeper shoulders.
- bandpass frequency bandwidth
- Butterworth bandpass filter. Description coming
-
-
July 24, 2000 9
@@ -598,6 +598,25 @@
SoX(1) SoX(1)
+ band [ -n ] center [ width ]
+ 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
+ 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-
+ 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
+ effect with steeper shoulders.
+
+ bandpass frequency bandwidth
+ Butterworth bandpass filter. Description coming
soon!
bandreject frequency bandwidth
@@ -607,10 +626,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.
@@ -620,41 +639,22 @@
in-dB1,out-dB1[,in-dB2,out-dB2...]
[gain] [initial-volume]
- 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. Where more than one pair
- of attack/decay parameters are specified, each
- channel is treated separately and the number of
- pairs must agree with the number of input chan-
- nels. The second parameter is a list of points
- on the compander's transfer function specified
- in dB relative to the maximum possible signal
+ 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. Where more than one pair
+ of attack/decay parameters are specified, each
+ channel is treated separately and the number of
+ pairs must agree with the number of input chan-
+ nels. The second parameter 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 order but the transfer func-
- tion does not have to be monotonically rising.
- The special value -inf may be used to indicate
- that the input volume should be associated out-
- put 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 postprocessing gain in dB which is applied
- after the compression has taken place; the
- fourth (optional) parameter is an initial volume
- to be assumed for each channel when the effect
- starts. This permits the user to supply a nomi-
- nal level initially, 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 compander gain properly adjusts
- itself.
+ strictly increasing order but the transfer
-
July 24, 2000 10
@@ -664,22 +664,41 @@
SoX(1) SoX(1)
+ function does not have to be monotonically ris-
+ ing. The special value -inf may be used to
+ indicate that the input volume should be associ-
+ ated 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 postprocessing gain in dB which
+ is applied after the compression has taken
+ place; the fourth (optional) parameter is an
+ initial volume to be assumed for each channel
+ when the effect starts. This permits the user
+ to supply a nominal level initially, 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 proba-
+ ble that in such an event, the output would be
+ severely clipped while the compander gain prop-
+ erly adjusts itself.
+
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.
cut loopnumber
Extract loop #N from a sample.
- 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.
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.
@@ -686,107 +705,88 @@
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.
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
- The window-len, if unspecified, defaults to 128.
- 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.
+ July 24, 2000 11
- 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
- modulation speed in Hz. The modulation is
- July 24, 2000 11
+SoX(1) SoX(1)
+ 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
+ windows a more gradual cutoff.
-SoX(1) SoX(1)
+ 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.
- either sinodial (-s) or triangular (-t). Gain-
+ 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
+ modulation speed in Hz. The modulation is
+ either sinodial (-s) or triangular (-t). Gain-
out is the volume of the output.
- highp center
- Apply a high-pass filter. The frequency
- response drops logarithmically with center fre-
- quency in the middle of the drop. The slope of
- the filter is quite gentle. See filter for a
- highpass effect with sharper cutoff.
+ highp frequency
+ 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
+ for a highpass effect with sharper cutoff.
highpass frequency
- Butterworth highpass filter. Description com-
+ Butterworth highpass filter. Description com-
ming soon!
- lowp center
- Apply a low-pass filter. The frequency response
- drops logarithmically with center frequency in
- the middle of the drop. The slope of the filter
- is quite gentle. See filter for a lowpass
- effect with sharper cutoff.
+ lowp frequency
+ Apply a single pole recursive low-pass filter.
+ The frequency response drops logarithmically
+ 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
- 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
- number of output channels then this effect tries
- 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
- 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
-
-
July 24, 2000 12
@@ -796,27 +796,50 @@
SoX(1) SoX(1)
- delay/decay/speed gives the delay in millisec-
- onds and the decay (relative to gain-in) with a
+ pan direction
+ 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
+ number of output channels then this effect tries
+ 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
+ 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
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 Select the left or right channel of a stereo
- sample, or one of four channels in a quadro-
- phonic sample.
+ 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
+ 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 > ]
@@ -825,58 +848,59 @@
[ -cutoff # ]
Translate input sampling rate to output sampling
- rate via polyphase interpolation, a DSP algo-
- rithm. This method is slow and uses lots of
- RAM, but gives much better results than rate.
+ rate via polyphase interpolation, a DSP algo-
+ rithm. This method is slow and uses lots of
- -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
- exact number can be used. Default is long. The
- 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.
- Default is 0.95. Remember that this is a float.
+ July 24, 2000 13
- July 24, 2000 13
+SoX(1) SoX(1)
+ RAM, but gives much better results than rate.
+ -w < nut / ham > : select either a Nuttal (~90
+ dB stopband) or Hamming (~43 dB stopband) win-
+ dow. Default is nut.
-SoX(1) SoX(1)
+ -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
+ 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.
+ 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 differ-
- ent sampling rates and the preview options was
+ 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
+ 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
@@ -883,26 +907,37 @@
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
+
+
+ July 24, 2000 14
+
+
+
+
+
+SoX(1) SoX(1)
+
+
+ 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
@@ -914,77 +949,42 @@
------ ------ ------- ---- -------------
-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
-
-
-
- July 24, 2000 14
-
-
-
-
-
-SoX(1) SoX(1)
-
-
- 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
- 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
- the original Nyquist frequency to use a highpass
- filter to remove this false data, with closer
- also being better.
+ ter. When increasing the sample rate of an
+ audio file you would not expect to have any
- The beta parameter determines the type of filter
- 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
- 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
- longer sample window. A Nuttall window is
- selected by specifying any 'beta' <= 2, and the
-
-
July 24, 2000 15
@@ -994,22 +994,45 @@
SoX(1) SoX(1)
- 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
+ frequencies 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
+ also being better.
+
+ The beta parameter determines the type of filter
+ 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
+ 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
+ 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
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
@@ -1019,104 +1042,81 @@
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
+
+
+
+ July 24, 2000 16
+
+
+
+
+
+SoX(1) SoX(1)
+
+
+ reverse Reverse the sound sample completely. Included
for finding Satanic subliminals.
speed 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-
+ 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.
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
-
-
-
- July 24, 2000 16
-
-
-
-
-
-SoX(1) SoX(1)
-
-
- 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
- default depends on factor and shift.
+ stretching: >1.0 lengthen, <1.0 shorten
- 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
- 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
- both channels containing the same audio data.
- vibro speed [ depth ]
- Add the world-famous Fender Vibro-Champ sound
- effect to a sound sample by using a sine wave as
-
-
July 24, 2000 17
@@ -1126,42 +1126,77 @@
SoX(1) SoX(1)
+ duration. 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
+ 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
+ both channels containing the same audio data.
+
+ vibro speed [ depth ]
+ 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 ]
- 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
+ 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. 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
+ 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 change loga-
- rithmically. 0.0 is constant while +6 doubles
+ When type is dB the amplitude is change loga-
+ rithmically. 0.0 is constant while +6 doubles
the amplitude.
- Sox enforces certain effects. If the two files have dif-
+ Sox enforces certain effects. If the two files have dif-
ferent sampling rates, the requested effect must be one of
- polyphase, rate, or resample. If the two files have dif-
- ferent numbers of channels, the avg or other channel mix-
+ polyphase, rate, or resample. If the two files have dif-
+ ferent numbers of channels, the avg or other channel mix-
ing effect must be requested.
+
+
+
+ July 24, 2000 18
+
+
+
+
+
+SoX(1) SoX(1)
+
+
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
@@ -1169,10 +1204,10 @@
play(1), rec(1), soxexam(1)
NOTICES
- The version of Sox that accompanies this manual page is
- support by Chris Bagwell (cbagwell@sprynet.com). Please
+ The version of Sox that accompanies this manual page is
+ support by Chris Bagwell (cbagwell@sprynet.com). Please
refer any questions regarding it to this address. You may
- obtain the latest version at the the web site
+ obtain the latest version at the the web site
http://home.sprynet.com/~cbagwell/sox.html
@@ -1183,6 +1218,37 @@
- July 24, 2000 18
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ July 24, 2000 19
--- a/src/auto.c
+++ b/src/auto.c
@@ -64,18 +64,17 @@
else if (strncmp(header, "2BIT", 4) == 0) {
type = "avr";
}
- else if (header[0] == 0 && header[1] == 0) {
- int rate = (header[2] & 0xff) + ((header[3] & 0xff) << 8);
- if (rate >= 4000 && rate <= 25000)
- type = "sndr";
+ else if (strncmp(header, "NIST_1A", 4)) {
+ type = "sph";
}
+
if (type == 0) {
printf("Type AUTO doesn't recognize this header\n");
- printf("Trying: -t raw -r 11000 -b -u\n\n");
+ printf("Trying: -t raw -r 44100 -s -w\n\n");
type = "raw";
- ft->info.rate = 11000;
- ft->info.size = ST_SIZE_BYTE;
- ft->info.encoding = ST_ENCODING_UNSIGNED;
+ ft->info.rate = 44100;
+ ft->info.size = ST_SIZE_WORD;
+ ft->info.encoding = ST_ENCODING_SIGN2;
}
st_report("Type AUTO changed to %s", type);
ft->filetype = type;
--- a/src/handlers.c
+++ b/src/handlers.c
@@ -46,7 +46,7 @@
static char *aunames[] = {
"au",
-#ifdef NeXT
+#ifndef DOS
"snd",
#endif
(char *) 0
@@ -211,13 +211,6 @@
extern int st_smpstartwrite();
extern int st_smpstopwrite();
-static char *sndrnames[] = {
- "sndr",
- (char *) 0
-};
-
-extern int st_sndrstartwrite();
-
static char *sndtnames[] = {
"sndt",
#ifdef DOS
@@ -239,6 +232,7 @@
extern int st_spherestartread();
extern LONG st_sphereread();
extern int st_spherestartwrite();
+extern LONG st_spherewrite();
extern int st_spherestopwrite();
#if defined(SUNAUDIO_PLAYER)
@@ -413,15 +407,12 @@
{smpnames, ST_FILE_STEREO | ST_FILE_LOOPS,/* SampleVision sound */
st_smpstartread, st_smpread, st_nothing,
st_smpstartwrite, st_smpwrite, st_smpstopwrite},
- {sndrnames, ST_FILE_STEREO, /* Sounder Sound File */
- st_sndtstartread, st_rawread, st_rawstopread,
- st_sndrstartwrite, st_rawwrite, st_rawstopwrite},
{sndtnames, ST_FILE_STEREO, /* Sndtool Sound File */
st_sndtstartread, st_rawread, st_rawstopread,
st_sndtstartwrite, st_sndtwrite, st_sndtstopwrite},
{spherenames, ST_FILE_STEREO, /* NIST Sphere File */
st_spherestartread, st_sphereread, st_rawstopread,
- st_spherestartwrite, st_rawwrite, st_spherestopwrite},
+ st_spherestartwrite, st_spherewrite, st_spherestopwrite},
#if defined(SUNAUDIO_PLAYER)
{sunnames, ST_FILE_STEREO, /* Sun /dev/audio player */
st_sunstartread, st_rawread, st_rawstopread,
--- a/src/highp.c
+++ b/src/highp.c
@@ -10,15 +10,30 @@
/*
* Sound Tools High-Pass effect file.
*
- * Algorithm: 1nd order filter.
- * From Fugue source code:
+ * Algorithm: Recursive single pole high-pass filter
*
- * output[N] = B * (output[N-1] - input[N-1] + input[N])
+ * Reference: The Scientist and Engineer's Guide to Digital Processing
*
- * A = 2.0 * pi * center
- * B = exp(-A / frequency)
+ * output[N] = A0 * input[N] + A1 * input[N-1] + B1 * output[N-1]
+ *
+ * X = exp(-2.0 * pi * Fc)
+ * A0 = (1 + X) / 2
+ * A1 = -(1 + X) / 2
+ * B1 = X
+ * Fc = cutoff freq / sample rate
+ *
+ * Mimics an RC high-pass filter:
+ *
+ * || C
+ * ----||--------->
+ * || |
+ * <
+ * > R
+ * <
+ * |
+ * V
+ *
*/
-/* SJB: Note: highp filter is currently broken, see test gnuplot graphs */
#include <math.h>
#include "st.h"
@@ -25,9 +40,9 @@
/* Private data for Highpass effect */
typedef struct highpstuff {
- float center;
- double A, B;
- double in1, out1;
+ float cutoff;
+ double A0, A1, B1;
+ double inm1, outm1;
} *highp_t;
/*
@@ -40,9 +55,9 @@
{
highp_t highp = (highp_t) effp->priv;
- if ((n < 1) || !sscanf(argv[0], "%f", &highp->center))
+ if ((n < 1) || !sscanf(argv[0], "%f", &highp->cutoff))
{
- st_fail("Usage: highp center");
+ st_fail("Usage: highp cutoff");
return (ST_EOF);
}
return (ST_SUCCESS);
@@ -55,16 +70,17 @@
eff_t effp;
{
highp_t highp = (highp_t) effp->priv;
- if (highp->center > effp->ininfo.rate*2)
+ if (highp->cutoff > effp->ininfo.rate/2)
{
- st_fail("Highpass: center must be < minimum data rate*2\n");
+ st_fail("Highpass: cutoff must be < sample rate / 2 (Nyquest rate)\n");
return (ST_EOF);
}
-
- highp->A = (M_PI * 2.0 * highp->center) / effp->ininfo.rate;
- highp->B = exp(-highp->A / effp->ininfo.rate);
- highp->in1 = 0.0;
- highp->out1 = 0.0;
+
+ highp->B1 = exp((-2.0 * M_PI * (highp->cutoff / effp->ininfo.rate)));
+ highp->A0 = (1 + highp->B1) / 2;
+ highp->A1 = (-1 * (1 + highp->B1)) / 2;
+ highp->inm1 = 0.0;
+ highp->outm1 = 0.0;
return (ST_SUCCESS);
}
@@ -84,21 +100,20 @@
LONG l;
len = ((*isamp > *osamp) ? *osamp : *isamp);
- d = highp->out1;
- /* yeah yeah yeah registers & integer arithmetic yeah yeah yeah */
for(done = 0; done < len; done++) {
l = *ibuf++;
- d = (highp->B * ((d - highp->in1) + (double) l)) / 65536.0;
- d *= 0.8;
- if (d > 32767)
- d = 32767;
- if (d < - 32767)
- d = - 32767;
- highp->in1 = l;
- *obuf++ = d * 65536L;
+ d = highp->A0 * l +
+ highp->A1 * highp->inm1 +
+ highp->B1 * highp->outm1;
+ if (d < -2147483647L)
+ d = -2147483647L;
+ else if (d > 2147483647L)
+ d = 2147483647L;
+ highp->inm1 = l;
+ highp->outm1 = d;
+ *obuf++ = d;
}
- highp->out1 = d;
*isamp = len;
*osamp = len;
return (ST_SUCCESS);
--- a/src/lowp.c
+++ b/src/lowp.c
@@ -11,13 +11,27 @@
/*
* Sound Tools Low-Pass effect file.
*
- * Algorithm: 1nd order filter.
- * From Fugue source code:
+ * Algorithm: Recursive single pole lowpass filter
*
- * output[N] = input[N] * A + input[N-1] * B
+ * Reference: The Scientist and Engineer's Guide to Digital Signal Processing
*
- * A = 2.0 * pi * center
- * B = exp(-A / frequency)
+ * output[N] = input[N] * A + output[N-1] * B
+ *
+ * X = exp(-2.0 * pi * Fc)
+ * A = 1 - X
+ * B = X
+ * Fc = cutoff freq / sample rate
+ *
+ * Mimics an RC low-pass filter:
+ *
+ * ---/\/\/\/\----------->
+ * |
+ * --- C
+ * ---
+ * |
+ * |
+ * V
+ *
*/
#include <math.h>
@@ -25,9 +39,9 @@
/* Private data for Lowpass effect */
typedef struct lowpstuff {
- float center;
+ float cutoff;
double A, B;
- double in1;
+ double outm1;
} *lowp_t;
/*
@@ -40,9 +54,9 @@
{
lowp_t lowp = (lowp_t) effp->priv;
- if ((n < 1) || !sscanf(argv[0], "%f", &lowp->center))
+ if ((n < 1) || !sscanf(argv[0], "%f", &lowp->cutoff))
{
- st_fail("Usage: lowp center");
+ st_fail("Usage: lowp cutoff");
return (ST_EOF);
}
return (ST_SUCCESS);
@@ -55,15 +69,15 @@
eff_t effp;
{
lowp_t lowp = (lowp_t) effp->priv;
- if (lowp->center > effp->ininfo.rate*2)
+ if (lowp->cutoff > effp->ininfo.rate / 2)
{
- st_fail("Lowpass: center must be < minimum data rate*2\n");
+ st_fail("Lowpass: cutoff must be < sample rate / 2 (Nyquest rate)\n");
return (ST_EOF);
}
- lowp->A = (M_PI * 2.0 * lowp->center) / effp->ininfo.rate;
- lowp->B = exp(-lowp->A / effp->ininfo.rate);
- lowp->in1 = 0.0;
+ lowp->B = exp((-2.0 * M_PI * (lowp->cutoff / effp->ininfo.rate)));
+ lowp->A = 1 - lowp->B;
+ lowp->outm1 = 0.0;
return (ST_SUCCESS);
}
@@ -84,17 +98,15 @@
len = ((*isamp > *osamp) ? *osamp : *isamp);
- /* yeah yeah yeah registers & integer arithmetic yeah yeah yeah */
for(done = 0; done < len; done++) {
l = *ibuf++;
- d = lowp->A * (l / 65536L) + lowp->B * (lowp->in1 / 65536L);
- d *= 0.8;
- if (d > 32767)
- d = 32767;
- if (d < - 32767)
- d = - 32767;
- lowp->in1 = l;
- *obuf++ = d * 65536L;
+ d = lowp->A * l + lowp->B * lowp->outm1;
+ if (d < -2147483647L)
+ d = -2147483647L;
+ else if (d > 2147483647L)
+ d = 2147483647L;
+ lowp->outm1 = l;
+ *obuf++ = d;
}
*isamp = len;
*osamp = len;
--- a/src/sphere.c
+++ b/src/sphere.c
@@ -16,6 +16,7 @@
/* Private data for SKEL file */
typedef struct spherestuff {
char shorten_check[4];
+ ULONG numSamples;
} *sphere_t;
/*
@@ -68,11 +69,12 @@
while (strncmp(buf, "end_head", 8) != 0)
{
- if (strncmp(buf, "sample_n_bytes", 14) == 0)
+ if (strncmp(buf, "sample_n_bytes", 14) == 0 && ft->info.size == -1)
{
sscanf(buf, "%s %s %d", fldname, fldtype, &ft->info.size);
}
- if (strncmp(buf, "channel_count", 13) == 0)
+ if (strncmp(buf, "channel_count", 13) == 0 &&
+ ft->info.channels == -1)
{
sscanf(buf, "%s %s %d", fldname, fldtype, &ft->info.channels);
}
@@ -82,12 +84,14 @@
/* Only bother looking for ulaw flag. All others
* should be caught below by default PCM check
*/
- if (strncmp(fldsval,"ulaw",4) == 0)
+ if (ft->info.encoding == -1 &&
+ strncmp(fldsval,"ulaw",4) == 0)
{
ft->info.encoding = ST_ENCODING_ULAW;
}
}
- if (strncmp(buf, "sample_rate", 11) == 0)
+ if (strncmp(buf, "sample_rate", 11) == 0 &&
+ ft->info.rate == -1)
{
#ifdef __alpha__
sscanf(buf, "%s %s %d", fldname, fldtype, &ft->info.rate);
@@ -126,7 +130,7 @@
}
if (ft->info.size == -1)
- ft->info.size = 1;
+ ft->info.size = ST_SIZE_BYTE;
/* sample_coding is optional and is PCM if missing.
* This means encoding is signed if size = word or
@@ -151,10 +155,15 @@
}
sphere->shorten_check[0] = 0;
+
+ /* TODO: Check first four bytes of data to see if its shorten
+ * compressed or not. This data will need to be written to
+ * buffer during first st_sphereread().
+ */
#if 0
st_reads(ft, sphere->shorten_check, 4);
- if (!strcmp(sphere->shorten_check,"abcd"))
+ if (!strcmp(sphere->shorten_check,"ajkg"))
{
st_fail("File uses shorten compression, can not handle this.\n");
return(ST_EOF);
@@ -179,6 +188,9 @@
if (sphere->shorten_check[0])
{
+ /* TODO: put these 4 bytes into the buffer. Requires
+ * knowing how to process ulaw and all version of PCM data size.
+ */
sphere->shorten_check[0] = 0;
}
return st_rawread(ft, buf, len);
@@ -189,6 +201,7 @@
{
int rc;
int x;
+ sphere_t sphere = (sphere_t) ft->priv;
if (!ft->seekable)
{
@@ -196,6 +209,19 @@
return (ST_EOF);
}
+ switch (ft->info.encoding)
+ {
+ case ST_ENCODING_ULAW:
+ case ST_ENCODING_SIGN2:
+ case ST_ENCODING_UNSIGNED:
+ break;
+ default:
+ st_fail("SPHERE format only supports ulaw and PCM data.");
+ return(ST_EOF);
+ }
+
+ sphere->numSamples = 0;
+
/* Needed for rawwrite */
rc = st_rawstartwrite(ft);
if (rc)
@@ -210,11 +236,22 @@
}
+LONG st_spherewrite(ft, buf, len)
+ft_t ft;
+LONG *buf, len;
+{
+ sphere_t sphere = (sphere_t) ft->priv;
+
+ sphere->numSamples += len; /* must later be divided by channels */
+ return st_rawwrite(ft, buf, len);
+}
+
int st_spherestopwrite(ft)
ft_t ft;
{
int rc;
char buf[128];
+ sphere_t sphere = (sphere_t) ft->priv;
rc = st_rawstopwrite(ft);
if (rc)
@@ -229,7 +266,12 @@
st_writes(ft, "NIST_1A\n");
st_writes(ft, " 1024\n");
- /* FIXME: Need sample_count */
+#ifdef __alpha__
+ sprintf(buf, "sample_count -i %d\n", sphere->numSamples/ft->info.channels);
+#else
+ sprintf(buf, "sample_count -i %ld\n", sphere->numSamples/ft->info.channels);
+#endif
+ st_writes(ft, buf);
sprintf(buf, "sample_n_bytes -i %d\n", ft->info.size);
st_writes(ft, buf);
--- a/src/stat.c
+++ b/src/stat.c
@@ -208,7 +208,7 @@
if (x1 == (stat->fft_size/2) - 1)
magnitude *= 2.0;
}
- printf("%f %f\n",ffa*x1, magnitude);
+ fprintf(stderr,"%f %f\n",ffa*x1, magnitude);
}
}