shithub: sox

Download patch

ref: 4428da8ac391ce16d34bff8d9e685fee7ab8983e
parent: 0ab7230f60d5e5767d41509d416947e634dee1d0
author: cbagwell <cbagwell>
date: Sat Nov 28 11:05:37 EST 2009

Change MP3 input percision back to 16 bits to make default behavior
still be to write 16 bit output files.

--- a/ChangeLog
+++ b/ChangeLog
@@ -37,8 +37,6 @@
 
   o Added new variants of sox_open to allow read/write from/to memory
     buffers (in POSIX 2008 environment); see example5.c.  (robs)
-  o amrnb and amrwb formats can optionally use opencore-amr libraries.
-    (cbagwell)
 
 File formats:
 
@@ -54,6 +52,8 @@
     based formats).  (cbagwell)
   o Allow libsndfile to be dlopen()'ed at runtime if --enable-dl-sndfile
     is used. (Doug Cook)
+  o amrnb and amrwb formats can optionally use opencore-amr libraries.
+    (cbagwell)
 
 Audio device drivers:
 
--- a/soxformat.7
+++ b/soxformat.7
@@ -402,6 +402,12 @@
 from source code, or, in some cases, obtain pre-built dynamically loadable
 libraries.
 .SP
+When reading MP3 files, up to 28 bits of precision is stored although
+only 16 bits is reported to user.  This is to allow default behavior
+of writing 16 bit output files.  A user can specify a higher precision
+for the output file to prevent lossing this extra information.  MP3
+output files will use up to 24 bits of precision while encoding.
+.SP
 MP3 compression parameters can be selected using SoX's \fB\-C\fR option
 as follows
 (note that the current syntax is subject to change):
--- a/src/mp3.c
+++ b/src/mp3.c
@@ -66,8 +66,9 @@
 #define MP3_LAME_PRECISION 24
 
 /* MAD returns values with MAD_F_FRACBITS (28) bits of precision, though it's
-   not certain that all of them are meaningful. Let's just make it match LAME. */
-#define MP3_MAD_PRECISION  MP3_LAME_PRECISION
+   not certain that all of them are meaningful. Default to 16 bits to
+   align with most users expectation of output file should be 16 bits. */
+#define MP3_MAD_PRECISION  16
 
 static const char* const mad_library_names[] =
 {