From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3561 216.34.176.0/20 X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,T_DKIM_INVALID,T_RP_MATCHES_RCVD shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id A61EE20C31 for ; Wed, 6 Dec 2017 06:17:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.89) (envelope-from ) id 1eMT1J-0006S8-JJ; Wed, 06 Dec 2017 06:17:25 +0000 Received: from sfi-mx-4.v28.ch3.sourceforge.com ([172.29.28.194] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eMT1J-0006S1-5Q for sox-users@lists.sourceforge.net; Wed, 06 Dec 2017 06:17:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:To:Subject:Message-ID:Date:From: MIME-Version:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=OyjSnZdgp0I6xG/GWo1vj0yzRkUPM25Q7H0HqgF1cZs=; b=YnPiLPpCUG8DbNEki+IoZMyjOh UwGwcpEDhZhUR3MLgY/7+TFIIpC3wDoJhY00qSjagQUlsQ2hgapF+QpF6bl0XnYUQJQ0T3eYsJzEj XAEu43fW15/p3IbsAgDHvUvKZ5XsxF7hKVeR27harK/jocKEHchr4cKfH33KcLcH5gb0=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:To:Subject:Message-ID:Date:From:MIME-Version:Sender:Reply-To :Cc:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=OyjSnZdgp0I6xG/GWo1vj0yzRkUPM25Q7H0HqgF1cZs=; b=B S108JIQ2LtAB8swvCX5QAwsJmU12rmm4RV0/fA8iezvCkQOiD9LdsMkaoZcaTlcCz6NJLvvDZ1+9A QdQrGKvEbukL7ADNJEykogKuDvUcTeLUZtlXuhN1n9bwtARHYVFbV3xdyohVAUx/X3ChMVjFpn/c8 npds43qmj2GiJBi8=; Received: from mail-wm0-f44.google.com ([74.125.82.44]) by sfi-mx-4.v28.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) id 1eMT1H-0006bY-FV for sox-users@lists.sourceforge.net; Wed, 06 Dec 2017 06:17:24 +0000 Received: by mail-wm0-f44.google.com with SMTP id r78so5224757wme.5 for ; Tue, 05 Dec 2017 22:17:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=OyjSnZdgp0I6xG/GWo1vj0yzRkUPM25Q7H0HqgF1cZs=; b=ZZWzNqGkC0wz0RGUiM+RismXiwyD+dBvJRaklbRAWIS0ee3nv4AOdlrLdYxc24uN3H wSBSxJSOeoCSdVKqlYxLGxEa/65l5yypGRJ+arJt0C35EPcYGI5yJ1QoMfYyjmn67HvD OnUgr7GganX6dDDQ9sirXoMfdFFjFmCyGbiRkrkiw0paO94ZMNhlAnYnKX+3lLkMq030 AiA3LY8Tsa/8ClvPa6AL1gzBWGYpTrYloC1Ek6GECaRmD04FeReBD/iRunITzD2MBKWs UCUHGjTi3zJaqPTjUpJIKXpttxPkyJp24eAd0yDlV1lp+w9/AMKREU+gGOdOp/d+OFJx AH9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=OyjSnZdgp0I6xG/GWo1vj0yzRkUPM25Q7H0HqgF1cZs=; b=Au6IoJOkSCqTw8IPVEXJwafniB7AulU0/H/siZeR+SmP5U86/Qf4ICcqZEPqE8XWvN 0wu1yqfJAsV8i5j9Mn6MNAfGVcF3k/1lF4MCjGkobu1PAmEJHBTz2uezmSwqkfNPrbHs 63BZP3a7Wt6jVxW58lCNMk9usb/YySFqHMAoXyz1XtI5plopgI7MLtZuWzMTizeIlQ1j ulPua4tv4+e0wgGTCELfpaOLzE/bWHNHRZ+yXSRHJlXDZH0/a56lqxzStYEgmf6IllRn h/6nv56ELig8Nl0t9yx7BZ3rYHqXaVuAXfVdgmX2XE+/TDSW4g2KkuDYBvrHkRHMDti/ wTTA== X-Gm-Message-State: AKGB3mL2NzETjp94/ZFjIy8NyBlNovHlHpX/3pSeIJ8ZZMBPuhVZ55/4 ImE4OuDL+Y5+UV3/T8pcyuADkvYnlnUvPPBGQuCJvw== X-Google-Smtp-Source: AGs4zMYHLXI3LMrhmvvfy/NyoOHDeWE4iU3y046rCx5SEmVN1+KqzVWpFksMagtUvV55gn+Ct/k4cjPRZCx+YVPzMKY= X-Received: by 10.28.170.75 with SMTP id t72mr7076735wme.15.1512541037247; Tue, 05 Dec 2017 22:17:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.139.2 with HTTP; Tue, 5 Dec 2017 22:17:16 -0800 (PST) From: Sicheng Wang Date: Wed, 6 Dec 2017 01:17:16 -0500 Message-ID: To: sox-users@lists.sourceforge.net X-Headers-End: 1eMT1H-0006bY-FV Subject: Sox multiple output file trim X-BeenThere: sox-users@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sox-users@lists.sourceforge.net Content-Type: multipart/mixed; boundary="===============2871611917892790247==" Errors-To: sox-users-bounces@lists.sourceforge.net --===============2871611917892790247== Content-Type: multipart/alternative; boundary="001a1144347c3bc129055fa5e788" --001a1144347c3bc129055fa5e788 Content-Type: text/plain; charset="UTF-8" Hi all, I've been playing around with some amazing effects in Sox. Right now I concatenated many short files sequentially to create a long audio. (I'm going to do something with this long audio, but due to the issue I'm going to describe, I leave the long audio untouched for now). Afterwards I wish to split the long audio into smaller segments with the same duration my short files (like disassembling the long audio into its original short pieces) . I expect to get the same short audios back. It seems the following line of code in the manual does the thing closest to what I wish: sox song.wav ringtone%1n.wav trim 0 30 : newfile : trim 0 30 Here is my code: swang423@cw4:~/tmp>$ sox 440a0101.wav 440a0102.wav 440a0103.wav tmp.wav #concat swang423@cw4:~/tmp>$ soxi 440a010[1-3].wav -D #Get wav dur 5.538938 5.773500 6.409750 swang423@cw4:~/tmp>$ soxi 440a010[1-3].wav -DT #Get Total dur 17.722188 swang423@cw4:~/tmp>$ soxi tmp.wav -D #Long dur; match is good 17.722188 swang423@cw4:~/tmp>$ sox tmp.wav out%2n.wav trim 0 5.538938 : newfile : trim 0 5.773500 #Trim to get the first 2 file swang423@cw4:~/tmp>$ soxi out0[1-2].wav -D #Check dur match; match is good 5.538938 5.773500 swang423@cw4:~/tmp>$ cmp 440a0101.wav out01.wav #The first files areidentical swang423@cw4:~/tmp>$ cmp 440a0102.wav out02.wav #The second files are not 440a0102.wav out02.wav differ: byte 45, line 1 Upon closer inspection, I found that out02.wav is shifted by something like 1000 samples from 440a0102.wav. The last file could not be trimmed successfully as well, since the output will be shorter than the original. I suspect the buffer has something to do with it. But I could always use the "reverse-trim-reverse" trick for the last file. I don't think it is the way I'm specifying the time, is it. I also tried to specify it with sample count: swang423@cw4:~/tmp>$ sox tmp.wav out%2n.wav trim 0s 88623s : newfile : trim 0s 92376s but the results are the same. My sox is sox: SoX v14.3.2 running on swang423@cw4:~/tmp>$ uname -a Linux cw4 3.8.0-44-generic #66~precise1-Ubuntu SMP Tue Jul 15 04:01:04 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux BTW I ended up doing sox tmp.wav out02.wav trim 5.538938 5.773500 which works out fine. But I need to do this a dozen of times. I still think the "multiple output" seems more elegant. Thanks. Sicheng --001a1144347c3bc129055fa5e788 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi all,

=C2=A0I've been playing aro= und with some amazing effects in Sox. Right now I concatenated many short f= iles sequentially to create a long audio. (I'm going to do something wi= th this long audio, but due to the issue I'm going to describe, I leave= the long audio untouched for now).=C2=A0Afterwards I wish to split the lon= g audio into smaller segments with the same duration my short files (like d= isassembling the long audio into its original short pieces) . I expect to g= et the same short audios back.

=C2=A0It seems the = following line of code in the manual does the thing closest to what I wish:=
sox song.wa=
v ringtone%1n.wav trim 0 30 : newfile : trim 0 30
Here is m= y code:

swang423@cw4:~/tmp>$ so= x 440a0101.wav 440a0102.wav 440a0103.wav tmp.wav=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#concat
swang423@cw4:~/tmp>= $ soxi 440a010[1-3].wav -D=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #Get wav dur
5.5= 38938
5.773500
6.409750
swang423@cw4:~/tmp>= ;$ soxi 440a010[1-3].wav -DT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#Get Total dur
17.722188
swang423@cw4:~/tmp>$ soxi tmp.wav -D=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#L= ong dur; match is good
17.722188
swang423@cw4:~/tmp>= $ sox tmp.wav out%2n.wav trim 0 5.538938 : newfile : trim 0 5.773500=C2=A0 = =C2=A0 =C2=A0#Trim to get the first 2 file
swang423@cw4:~/tmp>= $ soxi out0[1-2].wav -D=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 #Check dur match; match is good
5.538938
5.77350= 0
swang423@cw4:~/tmp>$ cmp 440a0101.wav out01.wav=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0#The first files areidentical
swang423@cw4:~/tmp>$ cmp 440a= 0102.wav out02.wav=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#The second files are not
440a0= 102.wav out02.wav differ: byte 45, line 1

Up= on closer inspection, I found that out02.wav is shifted by something like 1= 000 samples from 440a0102.wav.

The last file could= not be trimmed successfully as well, since the output will be shorter than= the original. I suspect the buffer has something to do with it. But I coul= d always use the "reverse-trim-reverse" trick for the last file.= =C2=A0

I don't think it is the way I'm spe= cifying the time, is it. I also tried to specify it with sample count:
swang423@cw4:~/tmp>$ sox tmp.wav out%2n.wav trim 0s 88623s : = newfile : trim 0s 92376s
but the results are the same.

My sox is=C2=A0sox: SoX v14.3.2 running on=C2=A0
=
swang423@cw4:~/tmp>$ uname -a
Linux cw4 3.8.0-44-gen= eric #66~precise1-Ubuntu SMP Tue Jul 15 04:01:04 UTC 2014 x86_64 x86_64 x86= _64 GNU/Linux

BTW I ended up doing=C2=A0
sox tmp.wav out02.wav trim 5.538938 5.773500
which wor= ks out fine. But I need to do this a dozen of times. I still think the &quo= t;multiple output" seems more elegant.

Thanks= .
Sicheng

--001a1144347c3bc129055fa5e788-- --===============2871611917892790247== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot --===============2871611917892790247== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Sox-users mailing list Sox-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sox-users --===============2871611917892790247==--