summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-06-21 21:16:38 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-06-21 21:19:04 -0400
commit338e698d05a1180535ace6dfa583e2a911a054f2 (patch)
tree46c59313e5830e2314a6996f42a37040b74e0c7f
parent9554ef16fb46085a9aafea4c852bb4f148725b94 (diff)
Convert GetLength to SkipLength that can modify 𝕨.beat in case the skipped section sets it
-rw-r--r--tracker.bqn11
1 files 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: