musa-dsl 0.43.0 → 0.49.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -2
  3. data/README.md +100 -169
  4. data/README.yard.md +37 -0
  5. data/docs/{getting-started/tutorial.md → examples/neuma-notation.md} +6 -3
  6. data/docs/{getting-started/quick-start.md → examples/sequencer-dsl-voices.md} +2 -2
  7. data/docs/guides/project-structure.md +273 -0
  8. data/docs/idioms.md +332 -0
  9. data/docs/subsystems/core-extensions.md +147 -129
  10. data/docs/subsystems/datasets.md +131 -39
  11. data/docs/subsystems/generative.md +58 -167
  12. data/docs/subsystems/matrix.md +41 -9
  13. data/docs/subsystems/midi.md +76 -4
  14. data/docs/subsystems/music.md +105 -26
  15. data/docs/subsystems/musicxml-builder.md +91 -30
  16. data/docs/subsystems/neumas.md +159 -37
  17. data/docs/subsystems/repl.md +42 -32
  18. data/docs/subsystems/sequencer.md +293 -110
  19. data/docs/subsystems/series.md +128 -25
  20. data/docs/subsystems/transcription.md +25 -3
  21. data/docs/subsystems/transport.md +96 -19
  22. data/docs/vocabulary.md +62 -0
  23. data/lib/musa-dsl/core-ext/arrayfy.rb +5 -1
  24. data/lib/musa-dsl/core-ext/attribute-builder.rb +7 -4
  25. data/lib/musa-dsl/core-ext/deep-copy.rb +81 -24
  26. data/lib/musa-dsl/core-ext/dynamic-proxy.rb +4 -4
  27. data/lib/musa-dsl/core-ext/hashify.rb +9 -2
  28. data/lib/musa-dsl/core-ext/inspect-nice.rb +1 -1
  29. data/lib/musa-dsl/core-ext/smart-proc-binder.rb +26 -10
  30. data/lib/musa-dsl/core-ext/with.rb +25 -12
  31. data/lib/musa-dsl/datasets/dataset.rb +17 -9
  32. data/lib/musa-dsl/datasets/delta-d.rb +11 -11
  33. data/lib/musa-dsl/datasets/e.rb +72 -21
  34. data/lib/musa-dsl/datasets/gdv.rb +119 -87
  35. data/lib/musa-dsl/datasets/gdvd.rb +62 -26
  36. data/lib/musa-dsl/datasets/helper.rb +40 -10
  37. data/lib/musa-dsl/datasets/p.rb +60 -24
  38. data/lib/musa-dsl/datasets/pdv.rb +90 -19
  39. data/lib/musa-dsl/datasets/ps.rb +10 -5
  40. data/lib/musa-dsl/datasets/score/queriable.rb +55 -20
  41. data/lib/musa-dsl/datasets/score/render.rb +22 -5
  42. data/lib/musa-dsl/datasets/score/to-mxml/process-pdv.rb +287 -263
  43. data/lib/musa-dsl/datasets/score/to-mxml/process-ps.rb +139 -128
  44. data/lib/musa-dsl/datasets/score/to-mxml/process-time.rb +342 -324
  45. data/lib/musa-dsl/datasets/score/to-mxml/to-mxml.rb +61 -10
  46. data/lib/musa-dsl/datasets/score.rb +99 -30
  47. data/lib/musa-dsl/generative/darwin.rb +35 -28
  48. data/lib/musa-dsl/generative/generative-grammar.rb +49 -17
  49. data/lib/musa-dsl/generative/markov.rb +49 -9
  50. data/lib/musa-dsl/generative/variatio.rb +26 -6
  51. data/lib/musa-dsl/generative.rb +0 -1
  52. data/lib/musa-dsl/logger/logger.rb +42 -16
  53. data/lib/musa-dsl/matrix/matrix.rb +49 -20
  54. data/lib/musa-dsl/midi/midi-recorder.rb +31 -12
  55. data/lib/musa-dsl/midi/midi-voices.rb +204 -20
  56. data/lib/musa-dsl/music/chord-definition.rb +63 -25
  57. data/lib/musa-dsl/music/chords.rb +107 -30
  58. data/lib/musa-dsl/music/scale_kinds/chromatic_scale_kind.rb +6 -6
  59. data/lib/musa-dsl/music/scale_kinds/major_scale_kind.rb +9 -6
  60. data/lib/musa-dsl/music/scale_kinds/minor_harmonic_scale_kind.rb +10 -5
  61. data/lib/musa-dsl/music/scale_kinds/minor_natural_scale_kind.rb +9 -6
  62. data/lib/musa-dsl/music/scale_systems/equally_tempered_12_tone_scale_system.rb +3 -3
  63. data/lib/musa-dsl/music/scale_systems/twelve_semitones_scale_system.rb +2 -2
  64. data/lib/musa-dsl/music/scales.rb +265 -88
  65. data/lib/musa-dsl/musicxml/builder/attributes.rb +134 -55
  66. data/lib/musa-dsl/musicxml/builder/backup-forward.rb +26 -0
  67. data/lib/musa-dsl/musicxml/builder/direction.rb +41 -21
  68. data/lib/musa-dsl/musicxml/builder/helper.rb +7 -4
  69. data/lib/musa-dsl/musicxml/builder/measure.rb +31 -3
  70. data/lib/musa-dsl/musicxml/builder/note-complexities.rb +14 -7
  71. data/lib/musa-dsl/musicxml/builder/part-group.rb +11 -1
  72. data/lib/musa-dsl/musicxml/builder/part.rb +14 -0
  73. data/lib/musa-dsl/musicxml/builder/pitched-note.rb +11 -3
  74. data/lib/musa-dsl/musicxml/builder/rest.rb +6 -3
  75. data/lib/musa-dsl/musicxml/builder/score-partwise.rb +22 -1
  76. data/lib/musa-dsl/musicxml/builder/typed-text.rb +8 -6
  77. data/lib/musa-dsl/musicxml/builder/unpitched-note.rb +4 -2
  78. data/lib/musa-dsl/neumalang/neumalang.rb +43 -16
  79. data/lib/musa-dsl/neumas/array-to-neumas.rb +36 -18
  80. data/lib/musa-dsl/neumas/neuma-decoder.rb +3 -3
  81. data/lib/musa-dsl/neumas/neuma-gdv-decoder.rb +16 -2
  82. data/lib/musa-dsl/neumas/neuma-gdvd-decoder.rb +19 -14
  83. data/lib/musa-dsl/neumas/neumas.rb +25 -17
  84. data/lib/musa-dsl/neumas/string-to-neumas.rb +89 -18
  85. data/lib/musa-dsl/repl/repl.rb +100 -91
  86. data/lib/musa-dsl/sequencer/base-sequencer-implementation-every.rb +22 -6
  87. data/lib/musa-dsl/sequencer/base-sequencer-implementation-move.rb +4 -2
  88. data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-helper.rb +62 -35
  89. data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-timed.rb +8 -3
  90. data/lib/musa-dsl/sequencer/base-sequencer-implementation-play.rb +95 -20
  91. data/lib/musa-dsl/sequencer/base-sequencer-implementation.rb +39 -9
  92. data/lib/musa-dsl/sequencer/base-sequencer-tick-based.rb +50 -14
  93. data/lib/musa-dsl/sequencer/base-sequencer-tickless-based.rb +84 -24
  94. data/lib/musa-dsl/sequencer/base-sequencer.rb +159 -39
  95. data/lib/musa-dsl/sequencer/sequencer-dsl.rb +39 -7
  96. data/lib/musa-dsl/series/array-to-serie.rb +15 -5
  97. data/lib/musa-dsl/series/base-series.rb +97 -14
  98. data/lib/musa-dsl/series/buffer-serie.rb +6 -0
  99. data/lib/musa-dsl/series/main-serie-constructors.rb +233 -69
  100. data/lib/musa-dsl/series/main-serie-operations.rb +163 -52
  101. data/lib/musa-dsl/series/proxy-serie.rb +157 -13
  102. data/lib/musa-dsl/series/quantizer-serie.rb +44 -4
  103. data/lib/musa-dsl/series/queue-serie.rb +33 -8
  104. data/lib/musa-dsl/series/series-composer.rb +94 -40
  105. data/lib/musa-dsl/series/timed-serie.rb +1 -1
  106. data/lib/musa-dsl/transcription/from-gdv-to-midi.rb +117 -12
  107. data/lib/musa-dsl/transcription/from-gdv-to-musicxml.rb +7 -0
  108. data/lib/musa-dsl/transcription/from-gdv.rb +1 -1
  109. data/lib/musa-dsl/transcription/transcription.rb +23 -11
  110. data/lib/musa-dsl/transport/clock.rb +8 -3
  111. data/lib/musa-dsl/transport/dummy-clock.rb +46 -9
  112. data/lib/musa-dsl/transport/external-tick-clock.rb +30 -23
  113. data/lib/musa-dsl/transport/input-midi-clock.rb +22 -15
  114. data/lib/musa-dsl/transport/timer-clock.rb +40 -6
  115. data/lib/musa-dsl/transport/timer.rb +6 -4
  116. data/lib/musa-dsl/transport/transport.rb +80 -36
  117. data/lib/musa-dsl/version.rb +1 -1
  118. data/lib/musa-dsl.rb +9 -6
  119. data/tools/doc-examples.rb +744 -0
  120. data/tools/vocabulary.rb +239 -0
  121. metadata +9 -6
  122. data/docs/README.md +0 -84
  123. data/docs/api-reference.md +0 -86
  124. data/lib/musa-dsl/generative/rules.rb +0 -590
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa34fee0b26abe335f3288cc4593230f4f9e76b0b8f198594d5880c3055038f6
4
- data.tar.gz: 7836f199fc7a81192269391d4e26d68e99de85d116750e30c32bf39df421ed39
3
+ metadata.gz: b8f19ea8b2adc69b0337938f0db645b11ec6b021781b163f9d9d49bcc95470aa
4
+ data.tar.gz: 1fd764ad354f2eba388fb2c74e2689919d4729dd875dfc27f75f4aff7bb1a261
5
5
  SHA512:
6
- metadata.gz: 296f17a87edaf39c519c3054bfc790445aa45aa5295aee76b978c831465a6e4a312b2c541fc9d99424e7365ff9726055e05537ddb6b7b362ee5fb69bb5b3e83d
7
- data.tar.gz: 571a82f51bc2e5d61c77f214629d727c8c47ed1c7a8d0ba6c4ac7c3019ccd4ba93f7a6f85b81e7041fdb773aa11607ab1606a7a2f9adbee252ccc72e8e516a76
6
+ metadata.gz: f7d6453e9842589676863769ecc0c4da051d2d1df76e53e5f65ed301465aa8a3eacb80706f8adb0cc4307bd12a8b889309276916e9e1192299cd3ace3cb9db08
7
+ data.tar.gz: a5dd8a6f58085d18c4b572613fe688554bc21553fbf21b730dc118b2edabc92ca09736260655039908a1b42ed60fd477cb56e4fb6f43a0874184c4573d1c46e4
data/.yardopts CHANGED
@@ -1,7 +1,6 @@
1
1
  --markup markdown
2
2
  --title "Musa-DSL API"
3
- --readme README.md
3
+ --readme README.yard.md
4
4
  --no-private
5
5
  --embed-mixins
6
6
  lib/**/*.rb
7
-
data/README.md CHANGED
@@ -23,7 +23,7 @@ Musa-DSL is a programming language DSL (Domain-Specific Language) based on Ruby
23
23
  - **Transport & Timing** - Multiple clock sources (internal, MIDI, external) with microsecond precision
24
24
  - **Audio Engine Independent** - Works with any MIDI-capable, OSC-capable or any other output hardware or software system
25
25
  - **Series-Based Composition** - Flexible sequence generators for pitches, rhythms, dynamics, and any musical parameter
26
- - **Generative Tools** - Markov chains, combinatorial variations (Variatio), rule-based production systems (Rules), formal grammars (GenerativeGrammar), and genetic algorithms (Darwin)
26
+ - **Generative Tools** - Markov chains, combinatorial variations (Variatio), formal grammars (GenerativeGrammar), and genetic algorithms (Darwin)
27
27
  - **Matrix Operations** - Mathematical transformations for musical structures
28
28
  - **Scale System** - Comprehensive support for scales, tuning systems, and chord structures
29
29
  - **Neumalang Notation** - Intuitive text-based and customizable musical (or sound) notation
@@ -39,40 +39,7 @@ Musa-DSL is a programming language DSL (Domain-Specific Language) based on Ruby
39
39
  - [Non-commercial use](https://www.jetbrains.com/non-commercial/) — for learning, hobbies, open-source, content creation
40
40
  - [Students](https://www.jetbrains.com/academy/student-pack/) and [Teachers/Researchers](https://www.jetbrains.com/academy/teacher-pack/) — with institutional email
41
41
 
42
- VSCode with the Ruby LSP extension also works well, though Ruby autocomplete and hover documentation are less complete.
43
-
44
- ### AI Composition Assistant: Claude Code Plugin
45
-
46
- The fastest way to learn and compose with MusaDSL is through **[Nota](https://github.com/javier-sy/nota-plugin-for-claude)** — a plugin for [Claude Code](https://claude.ai/code) that provides:
47
-
48
- - **`/nota:explain`** — Ask any question about MusaDSL and get sourced answers with working code examples
49
- - **`/nota:think`** — Creative ideation across multiple musical dimensions
50
- - **`/nota:code`** — Describe your musical intention in natural language and get verified MusaDSL code
51
- - **`/nota:analyze`** — Structured analysis of your compositions
52
- - **`/nota:best-practices`** — Consolidate recurring patterns into searchable best practices
53
-
54
- The plugin includes a semantic knowledge base covering all MusaDSL documentation, API reference, 22+ demo projects, and 12 built-in composition best practices. Your compositions, analyses, and practices become searchable knowledge that enriches future sessions.
55
-
56
- **Requirements:** [Ruby 3.4+](https://www.ruby-lang.org/) and a [Voyage AI](https://dash.voyageai.com/) API key (free tier is sufficient for personal use).
57
-
58
- **Install in Claude Code:**
59
-
60
- First, add the Nota marketplace:
61
- ```
62
- /plugin marketplace add javier-sy/nota-plugin-for-claude
63
- ```
64
-
65
- Then install the plugin:
66
- ```
67
- /plugin install nota@yeste.studio
68
- ```
69
-
70
- Then add your Voyage AI API key to your shell profile:
71
- ```
72
- export VOYAGE_API_KEY="your-key-here"
73
- ```
74
-
75
- Run `/nota:setup` to verify the installation.
42
+ [VSCode](https://code.visualstudio.com/) with the Ruby LSP extension also works well, though Ruby autocomplete and hover documentation are less complete.
76
43
 
77
44
  ### Framework Installation
78
45
 
@@ -91,24 +58,19 @@ gem install musa-dsl
91
58
  **Requirements:**
92
59
  - Ruby ~> 3.4
93
60
 
94
- ## Quick Start
61
+ ## Examples
95
62
 
96
- A complete working example with multiple interacting voice lines, demonstrating sequencer DSL, timing control, and shared state.
63
+ Two complete, runnable examples included here. Pedagogical learning is covered separately in the [musadsl-demo](https://github.com/javier-sy/musadsl-demo) repository.
97
64
 
98
- **📖 [Complete Quick Start Guide](docs/getting-started/quick-start.md)**
99
-
100
- ## Tutorial
101
-
102
- Detailed tutorial showing the Neuma notation system for composing melodies with grade-based notation.
103
-
104
- **📖 [Complete Tutorial](docs/getting-started/tutorial.md)**
65
+ - **[Sequencer DSL with interacting voices](docs/examples/sequencer-dsl-voices.md)** — multiple voice lines coordinated through shared state, demonstrating the sequencer DSL and timing primitives.
66
+ - **[Neuma notation](docs/examples/neuma-notation.md)** — composing melodies with grade-based Neuma notation and the parser.
105
67
 
106
68
  ## Demo Projects
107
69
 
108
70
  A collection of 22+ working demo projects covering the full spectrum of Musa DSL capabilities:
109
71
 
110
72
  - **Basic concepts**: Setup, series, neumas, canon
111
- - **Generative tools**: Markov chains, Variatio, Darwin, Grammar, Rules, Matrix
73
+ - **Generative tools**: Markov chains, Variatio, Darwin, Grammar, Matrix
112
74
  - **DAW integration**: MIDI sync, live coding, clock modes
113
75
  - **External protocols**: OSC with SuperCollider and Max/MSP
114
76
  - **Advanced patterns**: Event architecture, parameter automation, multi-phase compositions
@@ -117,175 +79,144 @@ Each demo is a complete, runnable project with documentation explaining the conc
117
79
 
118
80
  **📦 [musadsl-demo Repository](https://github.com/javier-sy/musadsl-demo)**
119
81
 
120
- ## System Architecture
82
+ ## MusaDSL Ecosystem
121
83
 
122
84
  MusaDSL is a comprehensive ecosystem consisting of a core framework (musa-dsl) and associated projects for communication, development, and integration.
123
85
 
124
- ### MusaDSL Ecosystem
125
-
126
86
  **Core Framework:**
127
87
  - [**musa-dsl**](https://github.com/javier-sy/musa-dsl) - Main DSL framework for algorithmic composition and musical thinking
128
88
 
129
- **MIDI Communication Stack:**
89
+ **MIDI Communication Stack** (used internally by musa-dsl for MIDI I/O):
130
90
  - [**midi-events**](https://github.com/javier-sy/midi-events) - Low-level MIDI event definitions and protocols
131
91
  - [**midi-parser**](https://github.com/javier-sy/midi-parser) - MIDI file parsing and analysis
132
92
  - [**midi-communications**](https://github.com/javier-sy/midi-communications) - Cross-platform MIDI I/O abstraction layer
133
93
  - [**midi-communications-macos**](https://github.com/javier-sy/midi-communications-macos) - macOS-specific MIDI native implementation
134
94
 
135
- **Live Coding Environment (MusaLCE):**
136
- - [**musalce-server**](https://github.com/javier-sy/musalce-server) - Live coding evaluation server with hot-reload capabilities
137
- - [**MusaLCEClientForVSCode**](https://github.com/javier-sy/MusaLCEClientForVSCode) - Visual Studio Code extension for live coding
138
- - [**MusaLCEClientForAtom**](https://github.com/javier-sy/MusaLCEClientForAtom) - Atom editor plugin for live coding
139
- - [**MusaLCEforBitwig**](https://github.com/javier-sy/MusaLCEforBitwig) - Bitwig Studio integration for live coding
140
- - [**MusaLCEforLive**](https://github.com/javier-sy/MusaLCEforLive) - Ableton Live integration for live coding
141
-
142
- ### musa-dsl Internal Architecture
95
+ ## MusaDSL Architecture
143
96
 
144
- The musa-dsl framework is organized in modular layers:
97
+ The musa-dsl framework is organized in modular layers. Each component has its own detailed documentation.
145
98
 
146
- #### 1. Foundation Layer
147
- - **core-ext** - Ruby core extensions (refinements for enhanced syntax)
148
- - **logger** - Structured logging system with severity levels
99
+ ### 1. Foundation Layer
100
+ - [**core-ext**](docs/subsystems/core-extensions.md) - Ruby refinements and metaprogramming utilities: Arrayfy, Hashify, ExplodeRanges, DeepCopy, DynamicProxy, AttributeBuilder.
101
+ - **logger** - Structured logging system with severity levels.
149
102
 
150
- #### 2. Temporal & Scheduling Layer
151
- - **sequencer** - Event scheduling engine with microsecond precision
152
- - Tick-based (quantized) and tickless (continuous) timing modes
153
- - Series playback with automatic duration management
154
- - Support for polyrhythms and polytemporal structures
155
- - **transport** - High-level playback control with clock synchronization
156
- - BPM management and tempo changes
157
- - Start/stop/pause/continue controls
158
- - Multiple clock source support (internal, MIDI, external)
103
+ ### 2. Temporal & Scheduling Layer
104
+ - [**sequencer**](docs/subsystems/sequencer.md) - Event scheduling engine with musical time (bars/beats), microsecond-precise tick-based timing, and a DSL for temporal composition. Tick-based (quantized) and tickless (continuous) modes; series playback with automatic duration management; polyrhythms and polytemporal structures.
105
+ - [**transport**](docs/subsystems/transport.md) - Comprehensive timing infrastructure connecting clock sources to the sequencer. Supports multiple clock types (TimerClock, InputMidiClock, ExternalTickClock, DummyClock), BPM management, tempo changes, and the start/stop/pause/continue playback lifecycle.
159
106
 
160
- #### 3. Notation & Parsing Layer
161
- - **neumas** - Text-based musical notation system
162
- - **neumalang** - Parser and interpreter for neuma notation with DSL support
107
+ ### 3. Notation & Parsing Layer
108
+ - [**neumas + neumalang**](docs/subsystems/neumas.md) - Compact text-based musical notation system with parser and interpreter for converting notation to structured musical data, with DSL support.
163
109
 
164
- #### 4. Generation & Transformation Layer
165
- - **series** - Lazy sequence generators with functional operations
166
- - Map, filter, transpose, repeat, and combination operations
167
- - Infinite and finite series support
168
- - **generative** - Algorithmic composition tools
169
- - **Markov chains**: Probabilistic sequence generation
170
- - **Variatio**: Cartesian product parameter variations
171
- - **Rules**: L-system-like production systems with growth/pruning
172
- - **GenerativeGrammar**: Formal grammar-based generation
173
- - **Darwin**: Genetic algorithms for evolutionary composition
174
- - **matrix** - Matrix operations for musical gestures
175
- - Matrix-to-P (point sequence) conversion
176
- - Gesture condensation and transformation
110
+ ### 4. Generation & Transformation Layer
111
+ - [**series**](docs/subsystems/series.md) - Lazy functional sequence generators with map/filter operations, numeric generators, buffering, quantization, and timed merging. Transpose, repeat, and combination operations; infinite and finite series support.
112
+ - [**generative**](docs/subsystems/generative.md) - Algorithmic composition tools: Markov chains (probabilistic sequence generation), Variatio (Cartesian product parameter variations), GenerativeGrammar (formal grammar-based generation), and Darwin (genetic algorithms for evolutionary composition).
113
+ - [**matrix**](docs/subsystems/matrix.md) - Matrix operations for musical gestures: matrix-to-P (point sequence) conversion for sequencer playback, gesture condensation and transformation. Treats sonic gestures as geometric objects.
177
114
 
178
- #### 5. Output & Communication Layer
179
- - **transcription** - Musical event transformation system
180
- - Ornament expansion (trills, mordents, turns)
181
- - GDV to MIDI/MusicXML conversion
182
- - Dynamic articulation rendering
183
- - **musicxml** - MusicXML score generation
184
- - Multi-part score creation
185
- - Notation directives (dynamics, tempo, articulations)
186
- - Standard MusicXML 3.0 output
187
- - **midi** - MIDI voice management
188
- - Polyphonic voice allocation
189
- - Channel management
190
- - Note-on/note-off scheduling
115
+ ### 5. Output & Communication Layer
116
+ - [**transcription**](docs/subsystems/transcription.md) - Musical event transformation system with ornament expansion (trills, mordents, turns), GDV to MIDI/MusicXML conversion, and dynamic articulation rendering. Expansion for MIDI or preservation as notation symbols for MusicXML.
117
+ - [**musicxml**](docs/subsystems/musicxml-builder.md) - MusicXML score generation. Hierarchical structure, multiple voices, multi-part scores, articulations, dynamics, tempo, and notation directives. Standard MusicXML 3.0 output.
118
+ - [**midi**](docs/subsystems/midi.md) - MIDI voice management with polyphonic voice allocation, channel management, note-on/note-off scheduling, automatic note tracking, and MIDI input recording with precise timestamping.
191
119
 
192
- #### 6. Musical Knowledge Layer
193
- - **music** - Scales, tuning systems, intervals, and chord structures
194
- - Equal temperament and just intonation support
195
- - Modal scales (major, minor, chromatic, etc.)
196
- - Chord definitions and harmonic analysis
197
- - **datasets** - Musical data structures (GDV, PDV, Score)
198
- - GDV (Grade-Duration-Velocity): Scale-relative representation
199
- - PDV (Pitch-Duration-Velocity): Absolute pitch representation
200
- - Score: Timeline-based multi-track composition structure
120
+ ### 6. Musical Knowledge Layer
121
+ - [**music**](docs/subsystems/music.md) - Scales, tuning systems, intervals, and chord structures. Equal temperament and just intonation support; modal scales (major, minor, chromatic, etc.); chord definitions, harmonic analysis, and chord navigation.
122
+ - [**datasets**](docs/subsystems/datasets.md) - Type-safe musical event representations: GDV (Grade-Duration-Velocity, scale-relative), PDV (Pitch-Duration-Velocity, absolute), PS, P, V. Conversions, validation, Score container (timeline-based multi-track composition), and advanced queries.
201
123
 
202
- #### 7. Development & Interaction Layer
203
- - **repl** - Interactive Read-Eval-Print Loop for live composition
124
+ ### 7. Development & Interaction Layer
125
+ - [**repl**](docs/subsystems/repl.md) - Interactive Read-Eval-Print Loop for live composition. TCP-based server for real-time code evaluation and error handling. Consumed by external REPL clients (editor extensions, custom evaluators).
204
126
 
205
- ## Core Subsystems
127
+ ## Where to start
206
128
 
207
- ### MIDI - Voice Management & Recording
129
+ The layers above are the order the framework is BUILT in, bottom-up by
130
+ dependency. It is not the order to read it in. These are:
208
131
 
209
- Polyphonic voice management for MIDI output with automatic note tracking, and MIDI input recording with precise timestamping.
132
+ **New to MusaDSL?** Start with one of the [examples](#examples) and the
133
+ architecture above, then read in this order — which cuts across the layers on
134
+ purpose, because output is the fastest way to hear that something works:
210
135
 
211
- **📖 [Complete Documentation](docs/subsystems/midi.md)**
136
+ 1. [midi](docs/subsystems/midi.md) — getting a sound out
137
+ 2. [sequencer](docs/subsystems/sequencer.md) — putting it in time
138
+ 3. [series](docs/subsystems/series.md) — generating the material
139
+ 4. [datasets](docs/subsystems/datasets.md) — what an event is made of
212
140
 
213
- ### Sequencer - Temporal Engine
141
+ **Want to compose?**
214
142
 
215
- Event scheduling engine with musical time (bars/beats), precise tick-based timing, and DSL for temporal composition.
143
+ 1. [neumas](docs/subsystems/neumas.md) the notation
144
+ 2. [music](docs/subsystems/music.md) — scales and chords
145
+ 3. [generative](docs/subsystems/generative.md) — Markov, Variatio, grammars, Darwin
146
+ 4. [musicxml-builder](docs/subsystems/musicxml-builder.md) — if the piece has to be read on paper
147
+ 5. The [22 demo projects](https://github.com/javier-sy/musadsl-demo), which are
148
+ complete pieces rather than snippets
216
149
 
217
- **📖 [Complete Documentation](docs/subsystems/sequencer.md)**
150
+ **Live coding?**
218
151
 
219
- ### Transport - Timing & Clocks
152
+ 1. [repl](docs/subsystems/repl.md) the server your editor talks to
153
+ 2. A MusaLCE client (VSCode, Bitwig, Live)
154
+ 3. [sequencer](docs/subsystems/sequencer.md) — its DSL is what you type live
155
+ 4. [transport](docs/subsystems/transport.md) — syncing to a DAW's clock
220
156
 
221
- Comprehensive timing infrastructure connecting clock sources to the sequencer. Supports multiple clock types (TimerClock, InputMidiClock, ExternalTickClock, DummyClock) and manages playback lifecycle with precise timing control.
157
+ **Extending the DSL?** These two are the foundation the framework is written on,
158
+ and they are the last thing to read rather than the first:
222
159
 
223
- **📖 [Complete Transport Documentation](docs/subsystems/transport.md)**
160
+ 1. [core-extensions](docs/subsystems/core-extensions.md) — the refinements and
161
+ metaprogramming everything else assumes
162
+ 2. [datasets](docs/subsystems/datasets.md) — read as an extension point: how a
163
+ Hash becomes a musical event, and how to add your own
224
164
 
165
+ **Writing a whole piece rather than a snippet?**
166
+ [project structure](docs/guides/project-structure.md) is how a musa-dsl project is
167
+ laid out — the split between infrastructure and score, reaching one from the
168
+ other, stopping cleanly, and shaping form as events rather than as absolute
169
+ positions. Conventions, not API: none of it is enforced, and all of it follows
170
+ from something that is.
225
171
 
226
- ### Series - Sequence Generators
172
+ **Looking for a name you half remember?** [vocabulary](docs/vocabulary.md) is
173
+ every name the guides above teach, on one page, by subsystem. It answers *what is
174
+ there* — the one question you cannot look up — and it is generated from the
175
+ published API and the guides themselves, so it cannot drift from either.
227
176
 
228
- Lazy functional sequence generators with map/filter operations, numeric generators, buffering, quantization, and timed merging.
177
+ **And one that is not a stage of any of them.**
178
+ [idioms](docs/idioms.md) is for the moment of writing, whichever path brought you
179
+ there: it is organised by the SHAPE of the problem, and each entry names a reflex
180
+ — something a competent programmer writes before asking what MusaDSL calls it.
181
+ The reflex always works, which is the problem: it produces code that runs, sounds
182
+ right, passes every test, and is foreign to the framework. Read it from the
183
+ symptom, when you are about to make the mistake rather than after.
229
184
 
230
- **📖 [Complete Documentation](docs/subsystems/series.md)**
185
+ ## Documentation
231
186
 
232
- ### Neumas & Neumalang - Musical Notation
187
+ The subsystem guides linked above are the conceptual documentation: when each
188
+ one is the answer, how to think about it, and the traps. Every Ruby block in
189
+ them is executed by `tools/doc-examples.rb`, and every output they declare is
190
+ compared with what the code actually returns -- so a page that has drifted fails
191
+ the suite rather than misleading a reader.
233
192
 
234
- Compact text-based musical notation system with parser for converting notation to structured musical data.
193
+ The API reference is generated from the inline YARD documentation, whose
194
+ `@example` blocks are held to the same standard:
235
195
 
236
- **📖 [Complete Documentation](docs/subsystems/neumas.md)**
237
-
238
- ### Datasets - Sonic Data Structures
239
-
240
- Type-safe musical event representations (GDV, PDV, PS, P, V) with conversions, validation, Score container, and advanced queries.
241
-
242
- **📖 [Complete Documentation](docs/subsystems/datasets.md)**
243
-
244
- ### Matrix - Sonic Gesture Conversion
245
-
246
- Convert matrix representations to point sequences for sequencer playback, treating sonic gestures as geometric objects.
247
-
248
- **📖 [Complete Documentation](docs/subsystems/matrix.md)**
249
-
250
- ### Transcription - MIDI & MusicXML Output
251
-
252
- Convert between representations with ornament expansion for MIDI or preservation as notation symbols for MusicXML.
253
-
254
- **📖 [Complete Documentation](docs/subsystems/transcription.md)**
255
-
256
- ### Music - Scales & Chords
257
-
258
- Comprehensive scale and chord systems with equal temperament, custom tunings, chord navigation, and extensible definitions.
259
-
260
- **📖 [Complete Documentation](docs/subsystems/music.md)**
261
-
262
- ### Generative - Algorithmic Composition
263
-
264
- Algorithmic composition tools: Markov chains, Variatio, Rules (L-systems), GenerativeGrammar, and Darwin (genetic algorithms).
265
-
266
- **📖 [Complete Documentation](docs/subsystems/generative.md)**
267
-
268
- ### MusicXML Builder - Music Notation Export
269
-
270
- Comprehensive MusicXML score generation with hierarchical structure, multiple voices, articulations, and dynamics.
271
-
272
- **📖 [Complete Documentation](docs/subsystems/musicxml-builder.md)**
196
+ ```bash
197
+ bundle exec yard doc
198
+ bundle exec yard server
199
+ ```
273
200
 
274
- ### REPL - Live Coding Infrastructure
201
+ Then open http://localhost:8808.
275
202
 
276
- TCP-based server for live coding with MusaLCE clients (VSCode, Atom, Bitwig, Live), real-time code evaluation and error handling.
203
+ ## Contributing
277
204
 
278
- **📖 [Complete Documentation](docs/subsystems/repl.md)**
205
+ Contributions are welcome. Fork the repository, create a feature branch, make
206
+ your changes with tests, and open a pull request.
279
207
 
280
- ### Core Extensions - Advanced Metaprogramming
208
+ **Repository:** https://github.com/javier-sy/musa-dsl
281
209
 
282
- Ruby refinements and metaprogramming utilities: Arrayfy, Hashify, ExplodeRanges, DeepCopy, DynamicProxy, AttributeBuilder, Logger.
210
+ ## Examples & Works
283
211
 
284
- **📖 [Complete Documentation](docs/subsystems/core-extensions.md)**
212
+ Listen to compositions created with Musa-DSL: [yeste.studio](https://yeste.studio)
285
213
 
286
214
  ## Author
287
215
 
288
- * [Javier Sánchez Yeste](https://github.com/javier-sy)
216
+ * [Javier Sánchez Yeste](https://github.com/javier-sy) -- javier (at) yeste.studio
217
+
218
+ Special thanks to [JetBrains](https://www.jetbrains.com/?from=Musa-DSL) for
219
+ providing an Open Source project license for RubyMine during several years.
289
220
 
290
221
  ## License
291
222
 
data/README.yard.md ADDED
@@ -0,0 +1,37 @@
1
+ # Musa-DSL — API reference
2
+
3
+ A Ruby framework and DSL for algorithmic sound and musical thinking and
4
+ composition. It builds complex temporal structures independently of the audio
5
+ rendering engine: sequencing and transport, lazy series, a text notation
6
+ (neumalang), scales and chords, generative tools, and transcription to MIDI and
7
+ MusicXML.
8
+
9
+ **This page is the API reference** — classes, methods, signatures, and the
10
+ `@example` blocks attached to them. Every one of those examples is executed and
11
+ its declared output compared against what the code actually returns, so what you
12
+ read here has been run.
13
+
14
+ ## The conceptual documentation is not here
15
+
16
+ Knowing a signature is not knowing when to reach for it. The guides that answer
17
+ *when is this the answer, and when is it not* — one per subsystem, plus a
18
+ catalogue of idioms organised by the shape of the problem — live in the
19
+ repository, where their cross-references work:
20
+
21
+ **https://github.com/javier-sy/musa-dsl**
22
+
23
+ They also travel inside the gem itself, under `docs/`, so they are readable
24
+ offline from the installed copy and always match the version you have.
25
+
26
+ ## Installing
27
+
28
+ ```ruby
29
+ gem 'musa-dsl'
30
+ ```
31
+
32
+ Requires Ruby ~> 3.4.
33
+
34
+ ---
35
+
36
+ Copyright (c) 2016-2026 [Javier Sánchez Yeste](https://yeste.studio),
37
+ licensed under LGPL-3.0-or-later.
@@ -1,6 +1,6 @@
1
- # Tutorial: Not So Quick Start
1
+ # Neuma notation
2
2
 
3
- Here's a more detailed example showing the Neuma notation system:
3
+ A more detailed example showing the Neuma notation system:
4
4
 
5
5
  ```ruby
6
6
  require 'musa-dsl'
@@ -20,7 +20,10 @@ decoder = Decoders::NeumaDecoder.new(
20
20
 
21
21
  # Define a melody using neuma notation with duration and velocity
22
22
  # Format: (grade duration velocity)
23
- # Durations: 1/4 = quarter, 1/2 = half, 1 = whole
23
+ # Durations are multiples of base_duration, which here is 1r -- a bar. So the
24
+ # numbers below are fractions of a bar: 1/4 of a bar, 1/2 of a bar, a whole
25
+ # bar. In 4/4 those are a quarter, a half and a whole note; in another meter
26
+ # they are not, because a bar and a whole note are only the same in 4/4.
24
27
  # Velocities: pp, p, mp, mf, f, ff
25
28
  melody = "(0 1/4 p) (+2 1/4 mp) (+2 1/4 mf) (-1 1/2 f) " \
26
29
  "(0 1/4 mf) (+4 1/4 mp) (+5 1/2 f) (+7 1/4 ff) " \
@@ -1,6 +1,6 @@
1
- # Quick Start
1
+ # Sequencer DSL with interacting voices
2
2
 
3
- Here's a complete example showcasing the sequencer DSL with multiple melodic lines that interact with each other:
3
+ A complete example showcasing the sequencer DSL with multiple melodic lines that interact with each other:
4
4
 
5
5
  ```ruby
6
6
  require 'musa-dsl'