osdir.com
mailing list archive

Subject: sox-14.0.1 w64 format incompatibility - msg#00005

List: audio.sox

Date: Prev Next Index Thread: Prev Next Index
SoX appears to be reading and writing something other than IEEE
floating-point data when dealing with w64 files. I discovered this
while attempting to use SoX to convert the w64 files produced by
TimeMachine into something more universally readable. Other
sndfile-linked applications handled these files without a hitch.

SoX would correctly read any w64 files that it produced, so checking SoX
against itself hid the problem. Other programs could not correctly read
SoX-produced w64 files.

I verified the problem by preparing a simple wave file (pcm16, 2
channel) and converting it with both SoX and sndfile:

sndfile-convert -float32 test.wav test_snd.w64
sox test.wav -f -4 test_sox.wav

Both files had the same length and identical headers, but the data were
very different.

test_snd.w64 contained 32-bit, IEEE floating-point, little-endian data
with a range of +/-1.000E0.

test_sox.w64 clearly contained something else.

The problem appears to be in the SoX-sndfile interface. Adding a few
lines to sox-14.0.1/src/sndfile.c seemed to clear things up. Here is
what I did:


--- OLD/sox-14.0.1/src/sndfile.c 2008-01-28 14:47:19.000000000 -0800
+++ NEW/sox-14.0.1/src/sndfile.c 2008-05-02 06:11:17.000000000 -0700
@@ -317,6 +317,9 @@
}
else ft->signal.rate = sf->sf_info->samplerate;

+ if ((sf->sf_info->format & SF_FORMAT_SUBMASK) == SF_FORMAT_FLOAT)
+ sf_command(sf->sf_file, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE);
+
return SOX_SUCCESS;
}

@@ -384,6 +387,9 @@
return SOX_EOF;
}

+ if ((sf->sf_info->format & SF_FORMAT_SUBMASK) == SF_FORMAT_FLOAT)
+ sf_command(sf->sf_file, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_TRUE);
+
return SOX_SUCCESS;
}

After patching the file I notice that, because SoX uses sf_write_int
instead of sf_write_float, the w64 files it creates are not
automatically normalized to +/-1.0 as the files returned by other
sndfile-linked applications tend to be. Perhaps this is a good thing.

If this issue has already been dealt with elsewhere, I apologize for
bringing it up.

Tim



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone


Was this page helpful?
Yes No
Thread at a glance:

Previous Message by Date: click to view message preview

Re: Alternative to stretch?

--- Mike Keithley <mkeithley@xxxxxxxxx> wrote: > Hello list, > > Sox 14.0.1 says that the stretch is deprecated and to look for an > alternative in the man page. But the man page says nothing about an > stretch alternative that I can find. It's `tempo': stretch factor [window fade shift fading] Change the audio duration (but not its pitch). This effect is equivalent to the tempo effect with (factor inverted and) search set to zero, so its results are comparatively poor; it is retained for backwards compatibility only. __________________________________________________________ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

Next Message by Date: click to view message preview

Documentation page is hacked...

It seems an unscrupulous SPAMMER hacked your documentation page... http://sox.sourceforge.net/Docs/HomePage :( - Andy ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

Previous Message by Thread: click to view message preview

Alternative to stretch?

Hello list, Sox 14.0.1 says that the stretch is deprecated and to look for an alternative in the man page. But the man page says nothing about an stretch alternative that I can find. Mike Keithley ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

Next Message by Thread: click to view message preview

Documentation page is hacked...

It seems an unscrupulous SPAMMER hacked your documentation page... http://sox.sourceforge.net/Docs/HomePage :( - Andy ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Loading Comments...
Home | News | Patents | Sitemap | FAQ | advertise

Advertising by