sox-devel@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
From: Stephen.Paterson <stephen.paterson@synety.com>
To: "sox-devel@lists.sourceforge.net" <sox-devel@lists.sourceforge.net>
Subject: Re: Half length output with libsox for stereo -> mono
Date: Thu, 11 Apr 2013 10:15:59 +0000	[thread overview]
Message-ID: <BDC1841AE4B16746AB058F709D669BB0458AC2F5@AMSPRD0311MB400.eurprd03.prod.outlook.com> (raw)
In-Reply-To: <20130410174751.Horde.Np1as3bg2m6mEzrCjDQ57g1@webmail.df.eu>

Hi Ulrich,

Thanks for that. All working now.

Cheers

Stephen Paterson
Developer   |  SYNETY
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.


-----Original Message-----
From: Ulrich Klauer [mailto:ulrich@chirlu.de] 
Sent: 10 April 2013 16:48
To: sox-devel@lists.sourceforge.net
Subject: Re: [SoX-devel] Half length output with libsox for stereo -> mono

Stephen Paterson wrote:

> 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).

example3 is buggy. It doesn't take into account that sox_add_effect() modifies the "in" signalinfo, which is why it isn't a good idea to pass it a signalinfo that is still in use elsewhere, or to call
sox_add_effect() with identical in and out signalinfos.

What is happening here is that in->signal.length, after the sox_open_read(), contains some value like 882000, for a 10-second stereo 44100 Hz input file. After adding "rate", the value will have changed to 160000, and after "channels", to 80000. Because it is the same memory location all the time, the input format handler (from
sox_open_read()) will see this value as well and think that its file is only 80000 samples long. It will therefore stop reading after 80000 samples (/2 channels, /44100 Hz = 0.907 seconds), and that is all that is processed by the effects chain.

See the attached diff for how to use a copy of the signalinfo instead.

Ulrich
------------------------------------------------------------------------------
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	other threads:[~2013-04-11 10:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10 12:04 Half length output with libsox for stereo -> mono Stephen.Paterson
2013-04-10 13:36 ` Stephen.Paterson
2013-04-10 15:47 ` Ulrich Klauer
2013-04-11 10:15   ` Stephen.Paterson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.sourceforge.net/lists/listinfo/sox-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BDC1841AE4B16746AB058F709D669BB0458AC2F5@AMSPRD0311MB400.eurprd03.prod.outlook.com \
    --to=sox-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).