OK, after some more trial and error I have the correct data, however, it is not 
writing the wav header correctly. Now I don't really care about that as when I 
play it back I can specify the format in which it will be played and everything 
sounds fine.
So I'm not really concerned but I would still be interested to know how to do 
it all properly. At the moment I can either get the correct header info or the 
correct data but not both.

Cheers

Stephen Paterson
Developer   |  SYNETY
www.synety.com<http://www.synety.com/>

ddi:    01134 166029
main: 0330 335 0000

SMARTER COMMUNICATIONS
Confidentiality: This e-mail transmission, including any attachments, is 
intended only for the named recipient(s) and may contain information that is 
privileged, confidential and/or exempt from disclosure under applicable law. If 
you have received this transmission in error, or are not the named 
recipient(s), please notify the sender immediately by return e-mail and 
permanently delete this transmission, including any attachments.

Security: This e-mail and any attachments are believed to be free from any 
virus but it is the responsibility of the recipient to ensure this is so. 
E-mail is not a 100% secure communications medium. We recommend you observe 
this when e-mailing us.

From: Stephen.Paterson [mailto:stephen.pater...@synety.com]
Sent: 10 April 2013 13:04
To: sox-devel@lists.sourceforge.net
Subject: [SoX-devel] Half length output with libsox for stereo -> mono

Hi all,

I've found a couple of threads relating to this problem but I can't for the 
life of me get it to work.

The following command line works fine:

sox original.wav -c 1 -r 8000 converted.wav

I can't get it to work with libsox. I've made a tiny modification to example3.c 
that should do the same but no matter what I try I always end up with a file 
that is exactly half the length of the one I get from sox (or some crazy audio).
If I leave the output as stereo I get the full length audio but sadly stereo is 
no use to me.
The 2 threads I've found are [Sox-devel] 'Effects going crazy' - 2012-05-07 and 
[SoX] 'Channels/remix does not function as documented' - 2011-11-12
Nothing suggested in either seems to work for me. Could someone take a look at 
the attached code (it's very simple) to see if they can see what I'm doing 
wrong please? It's driving me crazy! I'm at the point of giving up and just 
spawning the sox executable from my code but that would make me cry.

The following is the format of my test input file but it needs to work for any 
wav file:
RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 24000 Hz

Desired output will always be in the following format regardless of the input 
format:
RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz

Apologies if this is more appropriate for sox-users. If so, just let me know 
and I'll post there.

Cheers


Stephen Paterson
Developer   |  SYNETY
www.synety.com<http://www.synety.com/>

ddi:    01134 166029
main: 0330 335 0000

SMARTER COMMUNICATIONS
Confidentiality: This e-mail transmission, including any attachments, is 
intended only for the named recipient(s) and may contain information that is 
privileged, confidential and/or exempt from disclosure under applicable law. If 
you have received this transmission in error, or are not the named 
recipient(s), please notify the sender immediately by return e-mail and 
permanently delete this transmission, including any attachments.

Security: This e-mail and any attachments are believed to be free from any 
virus but it is the responsibility of the recipient to ensure this is so. 
E-mail is not a 100% secure communications medium. We recommend you observe 
this when e-mailing us.

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

Reply via email to