From 338e698d05a1180535ace6dfa583e2a911a054f2 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Tue, 21 Jun 2022 21:16:38 -0400 Subject: =?UTF-8?q?Convert=20GetLength=20to=20SkipLength=20that=20can=20mo?= =?UTF-8?q?dify=20=F0=9D=95=A8.beat=20in=20case=20the=20skipped=20section?= =?UTF-8?q?=20sets=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tracker.bqn | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tracker.bqn b/tracker.bqn index 5841781..2445481 100644 --- a/tracker.bqn +++ b/tracker.bqn @@ -5,7 +5,7 @@ MakeTrack # Build entire track Sequence # Build a single instrument ReadPattern # Read pattern for a track from lf-separated string - GetLength # Find length of pattern + SkipLength # Find length of pattern ⟩⇐ "tracker.bqn takes a single option namespace, or no arguments" ! 1≥≠•args @@ -20,6 +20,7 @@ Opts ← { control ⇐ noop∾shifts∾○⊏gains # Non-sample characters GetShift‿GetVol ⇐ 0‿1 {{𝕩⊏˜𝕨⊸⊐}⟜(∾⟜𝕨)˝𝕩}¨ shifts‿gains + SetBeat ⇐ {beat↩𝕩} beat ⇐ {𝕩.beat} ⎊(!˙) 𝕩 # Starting samples/beat (optional with :BEAT:) empty ⇐ {𝕩.empty}⎊(2‿0⥊0) 𝕩 swing ⇐ {𝕩.swing}⎊⟨1⟩ 𝕩 # Modifier for length of each beat @@ -61,10 +62,10 @@ ParseBeats ← { g ← (⊑1↑s) (𝕨!∘m⊘⋈⊢)⊸∾⍟(0<≠∘⊣) Getb¨⌾(⊏⍉) ⌊‿2⥊1↓s <∘∾˘ ⍉ (≠∘⊢ ⥊¨ ⋈∾Avgb∘⊣)´˘ g } -GetLength ← { ⌊ +´ ⊑ 𝕨 ParseBeats ⊏𝕩 } -GetLastBeat ← { - ¬⊑':'∊𝕩 ? 𝕨.beat ; - Avgb Getb 1↓ (1-˜⊢´)⊸=∘(+`':'⊸=)⊸/ 𝕩 +SkipLength ← (0<≠∘⊢)◶0‿{ + len ← ⌊0.5 +´ ⊑ ({𝕩.beat}⎊⊢𝕨) ParseBeats b←⊏𝕩 + {⟨S⇐SetBeat⟩: ⊑':'∊b ? S Avgb Getb 1↓ (1-˜⊢´)⊸=∘(+`':'⊸=)⊸/ b ; @ } 𝕨 + len } Sequence ← { 𝕊𝕩:opt0𝕊𝕩 ; o𝕊p‿s:o𝕊𝕩∾0 ; o 𝕊 pattern‿GetSamples‿overlap: -- cgit v1.2.3