ref: aac924f5cc55696f9771c3ed1a7a7f2d049e19dd
parent: d58638ae87b0cd38175037dee2cb1cca71b418f9
author: robs <robs>
date: Sat Dec 6 06:33:55 EST 2008
grouped file options; man updates
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,6 +39,7 @@
check_include_files("byteswap.h" HAVE_BYTESWAP_H)
check_include_files("inttypes.h" HAVE_INTTYPES_H)
+check_include_files("glob.h" HAVE_GLOB_H)
check_include_files("io.h" HAVE_IO_H)
#check_include_files("ltdl.h" HAVE_LTDL_H) # no plug-ins as yet
check_include_files("stdint.h" HAVE_STDINT_H)
@@ -76,6 +77,7 @@
optional(HAVE_LAME_LAME_H lame.h mp3lame lame_init mp3)
endif (NOT HAVE_LAME_LAME_H)
optional(HAVE_MAGIC magic.h magic magic_open "")
+optional(HAVE_OGG_SPEEX speex/speex.h speex speex_decoder_init speex)
optional(HAVE_PNG png.h png png_set_rows spectrogram)
optional(HAVE_SAMPLERATE_H samplerate.h samplerate src_simple rabbit)
optional(HAVE_SNDFILE sndfile.h sndfile sf_open sndfile)
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,7 @@
o New bitrate, time in seconds, & total options for soxi. (robs)
o Added ability to create shared DLL's on cygwin (cbagwell)
+ o Grouped files, e.g. play -r 6k "*.vox" plays all at 6k. (robs)
Other bug fixes:
--- a/configure.ac
+++ b/configure.ac
@@ -146,7 +146,7 @@
AC_CHECK_HEADERS(fcntl.h unistd.h byteswap.h sys/time.h sys/timeb.h sys/types.h sys/utsname.h)
dnl Checks for library functions.
-AC_CHECK_FUNCS(strcasecmp strdup popen vsnprintf gettimeofday)
+AC_CHECK_FUNCS(strcasecmp strdup popen vsnprintf gettimeofday glob)
dnl Check if math library is needed.
AC_CHECK_FUNC(pow)
--- a/sox.1
+++ b/sox.1
@@ -572,6 +572,25 @@
below and
.BR soxformat (7)).
.TP
+\fB\(dq\fIwildcard-filename\fB\(dq\fR
+Specifies that filename `globbing' (wild-card matching) should be performed
+by SoX instead of the shell. This allows a single set of file options to be
+applied to a group of files. For example, if the current directory contains
+three `vox' files: file1.vox, file2.vox, and file3.vox, then
+.EX
+ play --rate 6k *.vox
+.EE
+will be expanded by the `shell' (in most environments) to
+.EX
+ play --rate 6k file1.vox file2.vox file3.vox
+.EE
+which will treat only the first vox file as having a sample rate of 6k; but
+with
+.EX
+ play --rate 6k "*.vox"
+.EE
+the given sample rate option will be applied to all three vox files.
+.TP
\fB\-p\fR, \fB\-\-sox\-pipe\fR
This can be used in place of an output filename to specify that
the SoX command should be used as in input pipe to another SoX command.
@@ -820,7 +839,7 @@
for the output file that is different to that of the input file.
.TP
\fB\-b\fR \fIBITS\fR, \fB\-\-bits\fR \fIBITS\fR
-The number of bits in each encoded sample.
+The number of bits (a.k.a. bit-depth) in each encoded sample.
Not applicable to complex encodings, e.g. MP3, GSM.
Not necessary with encodings that have a fixed number of bits, e.g.
A/\(*m-law, ADPCM.
@@ -912,6 +931,15 @@
\fBsigned-integer\fR/\fBunsigned-integer\fR/\fBfloating-point\fR/\fBmu-law\fR/\fBa-law\fR/\fBoki-adpcm\fR/\fBima-adpcm\fR/\fBms-adpcm\fR/\fBgsm-full-rate\fR
respectively.
.TP
+\fB\-\-no\-glob\fR
+Specifies that filename `globbing' (wild-card matching) should not be
+performed by SoX on the following filename. For example, if the current
+directory contains the two files `five-seconds.wav' and `five*.wav', then
+.EX
+ play --no-glob "five*.wav"
+.EE
+can be used to play just the single file `five*.wav'.
+.TP
\fB\-r, \fB\-\-rate\fR \fIRATE\fR[\fBk\fR]
Gives the sample rate in Hz (or kHz if appended with `k') of the file.
To cause the output file to have
@@ -1375,7 +1403,7 @@
quiet and loud passages suitable for listening to in a noisy environment
such as a moving vehicle:
.EX
- sox asz.au asz-car.au compand 0.3,1 6:-70,-60,-20 -5 -90 0.2
+ sox asz.au asz-car.au compand 0.3,1 6:-70,-60,-20 -5 -90 0.2
.EE
The transfer function (`6:\-70,...') says that very soft sounds (below
\-70dB) will remain unchanged. This will stop the compander from
@@ -1391,6 +1419,17 @@
with near silence, and the delay of 0\*d2 (seconds) has the effect of causing
the compander to react a bit more quickly to sudden volume changes.
.SP
+In this example, compand is being used as a noise-gate for when the
+noise is at a lower level than the signal:
+.EX
+ play infile compand .1,.2 -inf,-50.1,-inf,-50,-50 0 -90 .1
+.EE
+Here is another noise-gate, this time for when the
+noise is at a higher level than the signal (making it, in some ways,
+similar to squelch):
+.EX
+ play infile compand .1,.1 -45.1,-45,-inf,0,-inf 45 -90 .1
+.EE
This effect supports the \fB\-\-plot\fR global option (for the transfer function).
.SP
See also
@@ -1397,7 +1436,7 @@
.B mcompand
for a multiple-band companding effect.
.TP
-\fBcontrast [\fIenhancement-amount (75)\fR]
+\fBcontrast \fR[\fIenhancement-amount\fR(75)]
Comparable with compression, this effect modifies an audio signal to
make it sound louder.
.I enhancement-amount
--- a/src/sox.c
+++ b/src/sox.c
@@ -34,6 +34,10 @@
#include <sys/types.h>
#include <time.h>
+#ifdef HAVE_GLOB_H
+ #include <glob.h>
+#endif
+
#ifdef HAVE_IO_H
#include <io.h>
#endif
@@ -112,6 +116,7 @@
double volume;
double replay_gain;
sox_oob_t oob;
+ sox_bool no_glob;
sox_format_t * ft; /* libSoX file descriptor */
size_t volume_clips;
@@ -1640,6 +1645,7 @@
"--add-comment TEXT Append output file comment",
"--comment TEXT Specify comment text for the output file",
"--comment-file FILENAME File containing comment text for the output file",
+"--no-glob Don't `glob' wildcard match the following filename",
""};
if (!(sox_globals.verbosity > 2)) {
@@ -1804,6 +1810,7 @@
{"interactive" , no_argument, NULL, 0},
{"help-effect" , required_argument, NULL, 0},
{"help-format" , required_argument, NULL, 0},
+ {"no-glob" , no_argument, NULL, 0},
{"plot" , required_argument, NULL, 0},
{"replay-gain" , required_argument, NULL, 0},
{"version" , no_argument, NULL, 0},
@@ -1970,19 +1977,26 @@
break;
case 10:
- sox_effects_globals.plot = enum_option(option_index, plot_methods);
+ f->no_glob = sox_true;
break;
case 11:
- replay_gain_mode = enum_option(option_index, rg_modes);
+ sox_effects_globals.plot = enum_option(option_index, plot_methods);
break;
case 12:
+ replay_gain_mode = enum_option(option_index, rg_modes);
+ break;
+
+ case 13:
display_SoX_version(stdout);
exit(0);
break;
case 14:
+ break;
+
+ case 15:
effects_filename = strdup(optarg);
break;
@@ -2178,6 +2192,34 @@
return 0;
}
+#if HAVE_GLOB_H
+#ifndef GLOB_BRACE
+#define GLOB_BRACE 0
+#endif
+#ifndef GLOB_TILDE
+#define GLOB_TILDE 0
+#endif
+static int add_glob_file(file_t const * const opts, char const * const filename)
+{
+ glob_t globbuf;
+ size_t i;
+
+ if (opts->no_glob)
+ return add_file(opts, filename);
+
+ if (glob(filename, GLOB_BRACE | GLOB_TILDE | GLOB_NOCHECK, NULL, &globbuf)) {
+ lsx_fail("glob: %s", strerror(errno));
+ exit(1);
+ }
+ for (i = 0; i < globbuf.gl_pathc; ++i)
+ add_file(opts, globbuf.gl_pathv[i]);
+ globfree(&globbuf);
+ return 0;
+}
+#else
+ #define add_glob_file add_file
+#endif
+
static void init_file(file_t * f)
{
memset(f, 0, sizeof(*f));
@@ -2213,7 +2255,7 @@
else if (optind >= argc || sox_find_effect(argv[optind]))
break;
else if (!sox_is_playlist(argv[optind]))
- add_file(&opts, argv[optind++]);
+ add_glob_file(&opts, argv[optind++]);
else if (sox_parse_playlist((sox_playlist_callback_t)add_file, &opts, argv[optind++]) != SOX_SUCCESS)
exit(1);
}
--- a/src/soxconfig.h.cmake
+++ b/src/soxconfig.h.cmake
@@ -11,6 +11,7 @@
#cmakedefine HAVE_GETTIMEOFDAY 1
#cmakedefine HAVE_ID3TAG 1
#cmakedefine HAVE_INTTYPES_H 1
+#cmakedefine HAVE_GLOB_H 1
#cmakedefine HAVE_IO_H 1
#cmakedefine HAVE_LAME_LAME_H 1
#cmakedefine HAVE_LIBAO 1
@@ -19,6 +20,7 @@
#cmakedefine HAVE_MAD_H 1
#cmakedefine HAVE_MP3 1
#cmakedefine HAVE_MAGIC 1
+#cmakedefine HAVE_OGG_SPEEX 1
#cmakedefine HAVE_OGG_VORBIS 1
#cmakedefine HAVE_POPEN 1
#cmakedefine HAVE_PNG 1