From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 79D101F4B5 for ; Sun, 17 Nov 2019 22:47:29 +0000 (UTC) Received: from localhost ([::1]:56814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWTKK-0000y0-2o for e@80x24.org; Sun, 17 Nov 2019 17:47:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46596) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWTKH-0000xh-Q4 for dtas-all@nongnu.org; Sun, 17 Nov 2019 17:47:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWTKG-00078K-OY for dtas-all@nongnu.org; Sun, 17 Nov 2019 17:47:25 -0500 Received: from dcvr.yhbt.net ([64.71.152.64]:46992) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iWTKG-00075U-Jg for dtas-all@nongnu.org; Sun, 17 Nov 2019 17:47:24 -0500 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id C4D131F4B5 for ; Sun, 17 Nov 2019 22:47:20 +0000 (UTC) From: Eric Wong To: dtas-all@nongnu.org Subject: [PATCH] splitfx: add "offset" option for all track times Date: Sun, 17 Nov 2019 22:47:20 +0000 Message-Id: <20191117224720.7361-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.71.152.64 X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: duct tape audio suite List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+e=80x24.org@nongnu.org Sender: "dtas-all" This option is intended to make it easy to reuse track splits from one audio recording of a given source (e.g. a live performance or vinyl rip) for another audio recording of the same source. --- Documentation/dtas-splitfx.pod | 5 +++++ lib/dtas/splitfx.rb | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Documentation/dtas-splitfx.pod b/Documentation/dtas-splitfx.= pod index b5dadfd..ff3d8cb 100644 --- a/Documentation/dtas-splitfx.pod +++ b/Documentation/dtas-splitfx.pod @@ -117,6 +117,11 @@ highest-numbered track. Default: true =20 =3Ditem command - used only by L =20 +=3Ditem offset - time offset to apply to each track + +This is useful for reusing track offsets between different recordings +of the same source or live performance. May be a negative value. + =3Dback =20 =3Dhead1 TRACKS diff --git a/lib/dtas/splitfx.rb b/lib/dtas/splitfx.rb index c0c7ac9..e310300 100644 --- a/lib/dtas/splitfx.rb +++ b/lib/dtas/splitfx.rb @@ -92,6 +92,7 @@ def initialize @infmt =3D nil # wait until input is assigned @cuebp =3D nil # for playback @command =3D nil # top-level, for playback + @offset =3D 0 end =20 def _bool(hash, key) @@ -145,6 +146,16 @@ def import(hash, overrides =3D {}) end end =20 + if offset =3D hash["offset"] + offset =3D offset.dup + sign =3D 1 + if offset.sub!(/\A-/, '') + sign =3D -1 + else + offset.sub!(/\A\+/, '') # drop "+" + end + @offset =3D @t2s.call(offset) * sign + end load_input!(hash) load_tracks!(hash) @command =3D hash["command"] # nil by default @@ -343,7 +354,7 @@ def t2s_cdda(time) end =20 def t2s(time) - @infmt.hhmmss_to_samples(time) + @infmt.hhmmss_to_samples(time) + @offset end =20 def run(target, opts =3D {})