From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.5 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 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 EEEDF1F44D for ; Fri, 26 Apr 2024 07:04:54 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=80x24.org header.i=@80x24.org header.a=rsa-sha256 header.s=selector1 header.b=Q1wuzhHA; dkim-atps=neutral Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s0FdX-000233-3V; Fri, 26 Apr 2024 03:04:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s0FdU-00022f-An for dtas-all@nongnu.org; Fri, 26 Apr 2024 03:04:44 -0400 Received: from dcvr.yhbt.net ([173.255.242.215]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s0FdS-0001iH-Lt for dtas-all@nongnu.org; Fri, 26 Apr 2024 03:04:44 -0400 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id B6B961F51B for ; Fri, 26 Apr 2024 07:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1714115056; bh=442amm9ZNshRD8pkrs8bTXEk2S26nb/wLQHMLNA03hQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Q1wuzhHApBar9Jzt6QAaaHCp4P+0QVB6IRcD4uYk/qNPSFYdvb1U36BH/EtF1t4K3 lwZ3oO1KsOD2wM+tUP+E5a9Zf6z2xIvI6VR8g+q8w47o6UI7mxbb2CRtmTnPd1P3Zd yaA5USHWw+TuIsh3pKzNVYE9xeZnhYP9Cowsu3vU= From: Eric Wong To: dtas-all@nongnu.org Subject: [PATCH 3/3] splitfx: support tshift directive Date: Fri, 26 Apr 2024 07:04:15 +0000 Message-ID: <20240426070416.497972-4-e@80x24.org> In-Reply-To: <20240426070416.497972-1-e@80x24.org> References: <20240426070416.497972-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=173.255.242.215; envelope-from=e@80x24.org; helo=dcvr.yhbt.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+e=80x24.org@nongnu.org This directive is useful for cutting sections of audio out in addition to making it easier to share track offsets between different recordings of the same source. --- Documentation/dtas-splitfx.pod | 14 ++++++++++++++ lib/dtas/splitfx.rb | 20 +++++++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/Documentation/dtas-splitfx.pod b/Documentation/dtas-splitfx.pod index 6f8d9ed..88179d7 100644 --- a/Documentation/dtas-splitfx.pod +++ b/Documentation/dtas-splitfx.pod @@ -173,6 +173,20 @@ any tracks written to the filesystem, including those using the L switch. These environment variables are intended to affect the specified L or default L invocation. +=item tshift TIME + +Increment subsequent time stamps for L, L, and L +directives by the specified TIME offset. TIME can be prefixed by +C<+=> or C<-=> to adjust the existing C value. Negative +values can be specified by prefixing with C<-> for a backwards +time shift. + +This directive is useful for working with multiple recordings of the +same source and cutting a section from the middle of a recording after +initial tracking is done. + +Default: 0 + =item skip TIME - skip a segment starting at TIME "skip" segments are diff --git a/lib/dtas/splitfx.rb b/lib/dtas/splitfx.rb index 1150ee0..b94f54b 100644 --- a/lib/dtas/splitfx.rb +++ b/lib/dtas/splitfx.rb @@ -66,6 +66,7 @@ def commit(advance_track_samples) # $CHANNELS (input) # $BITS_PER_SAMPLE (input) def initialize + @tshift = 0 @env = {} @comments = {} @track_start = 1 @@ -290,7 +291,7 @@ def parse_track(argv) start_time = argv.shift title = argv.shift t = T.new - t.tbeg = @t2s.call(start_time) + t.tbeg = @t2s.call(start_time) + @tshift t.comments = @comments.dup title.valid_encoding? or warn "#{title.inspect} encoding invalid" t.comments["TITLE"] = title @@ -311,11 +312,24 @@ def parse_track(argv) prev = @tracks.last and prev.commit(t.tbeg) @tracks << t + when 'tshift' + tshift = argv.shift + argv.empty? or raise ArgumentError, 'tshift does not take extra args' + if tshift.sub!(/\A-=/, '') + @tshift = @tshift - @t2s.call(tshift) + elsif tshift.sub!(/\A\+=/, '') + @tshift = @tshift + @t2s.call(tshift) + elsif tshift.sub!(/\A-/, '') + @tshift = -@t2s.call(tshift) + else + tshift.sub!(/\A\+/, '') + @tshift = @t2s.call(tshift) + end when "skip" stop_time = argv.shift argv.empty? or raise ArgumentError, "skip does not take extra args" s = Skip.new - s.tbeg = @t2s.call(stop_time) + s.tbeg = @t2s.call(stop_time) + @tshift # s.comments = {} # s.env = {} prev = @tracks.last or raise ArgumentError, "no tracks to skip" @@ -324,7 +338,7 @@ def parse_track(argv) when "stop" stop_time = argv.shift argv.empty? or raise ArgumentError, "stop does not take extra args" - samples = @t2s.call(stop_time) + samples = @t2s.call(stop_time) + @tshift prev = @tracks.last and prev.commit(samples) else raise ArgumentError, "unknown command: #{xs(cmd)}"