0

We're trying to use SoX to convert our WAVs to CAFs for an iPhone project. At the moment, as the possesser of the only Mac in the office, it's me who has to regularly run afconvert to do this, but I'd prefer the guys actually making the audio could do it on Windows instead.

I compiled SoX from source to enable CAF support, gave it and a batch file to the sound guys, and all seemed well. But we started getting distorted sound and I found the cause to be that the endianness of the data in the CAFs produced by SoX was opposite to that produced by afconvert.

So, I added −−endian swap to the command line in the batch file and thought no more about it. But the problem persisted, so I traced through a SoX convert and found that it complete ignores the endian flags when writing CAF files (or indeed any file type that SoX uses libsndfile for). If writing to a WAV, SoX does the swap on write, but for CAFs (for which it uses libsndfile), nothing.

afconvert will swap the endianness, the problem is that SoX does nto pass any endian information down to libsndfile. The relevant flags are reverse_bytes (whatever the format, reverse the bytes of the data given) and opposite_endian (whatever the destination format, reverse the endianness). Neither of these are refered to when setting up libsndfile's SF_INFO, which can be told the endianness to use (via the format member of SF_INFO), but the required information to deduce which to use (the endianness of the source data and/or the default endianness of the dest file) doesn't seem to be available.

Can anyone suggest a way for me to get this information?

subi211
  • 105
  • 2
  • 9
  • This seems to be a [known issue](http://sourceforge.net/p/sox/mailman/sox-devel/thread/From_noreply@sourceforge.net_Wed_Apr_10_16:49:07_2013/). – Thor Jun 13 '14 at 21:02
  • Damn, it's always embarrassing when your search-fu fails. Thanks. I'll fix it myself. – subi211 Jun 14 '14 at 18:13

0 Answers0