musa-dsl 0.43.0 → 0.49.0

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.

Potentially problematic release.


This version of musa-dsl might be problematic. Click here for more details.

Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -2
  3. data/README.md +90 -171
  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/idioms.md +332 -0
  8. data/docs/subsystems/core-extensions.md +147 -129
  9. data/docs/subsystems/datasets.md +131 -39
  10. data/docs/subsystems/generative.md +35 -167
  11. data/docs/subsystems/matrix.md +41 -9
  12. data/docs/subsystems/midi.md +67 -4
  13. data/docs/subsystems/music.md +105 -26
  14. data/docs/subsystems/musicxml-builder.md +91 -30
  15. data/docs/subsystems/neumas.md +130 -40
  16. data/docs/subsystems/repl.md +42 -32
  17. data/docs/subsystems/sequencer.md +276 -110
  18. data/docs/subsystems/series.md +115 -23
  19. data/docs/subsystems/transcription.md +25 -3
  20. data/docs/subsystems/transport.md +88 -19
  21. data/lib/musa-dsl/core-ext/arrayfy.rb +5 -1
  22. data/lib/musa-dsl/core-ext/attribute-builder.rb +7 -4
  23. data/lib/musa-dsl/core-ext/deep-copy.rb +81 -24
  24. data/lib/musa-dsl/core-ext/dynamic-proxy.rb +4 -4
  25. data/lib/musa-dsl/core-ext/hashify.rb +9 -2
  26. data/lib/musa-dsl/core-ext/inspect-nice.rb +1 -1
  27. data/lib/musa-dsl/core-ext/smart-proc-binder.rb +26 -10
  28. data/lib/musa-dsl/core-ext/with.rb +25 -12
  29. data/lib/musa-dsl/datasets/dataset.rb +17 -9
  30. data/lib/musa-dsl/datasets/delta-d.rb +11 -11
  31. data/lib/musa-dsl/datasets/e.rb +72 -21
  32. data/lib/musa-dsl/datasets/gdv.rb +119 -87
  33. data/lib/musa-dsl/datasets/gdvd.rb +62 -26
  34. data/lib/musa-dsl/datasets/helper.rb +40 -10
  35. data/lib/musa-dsl/datasets/p.rb +60 -24
  36. data/lib/musa-dsl/datasets/pdv.rb +90 -19
  37. data/lib/musa-dsl/datasets/ps.rb +10 -5
  38. data/lib/musa-dsl/datasets/score/queriable.rb +55 -20
  39. data/lib/musa-dsl/datasets/score/render.rb +22 -5
  40. data/lib/musa-dsl/datasets/score/to-mxml/process-pdv.rb +287 -263
  41. data/lib/musa-dsl/datasets/score/to-mxml/process-ps.rb +139 -128
  42. data/lib/musa-dsl/datasets/score/to-mxml/process-time.rb +342 -324
  43. data/lib/musa-dsl/datasets/score/to-mxml/to-mxml.rb +61 -10
  44. data/lib/musa-dsl/datasets/score.rb +99 -30
  45. data/lib/musa-dsl/generative/darwin.rb +35 -28
  46. data/lib/musa-dsl/generative/generative-grammar.rb +49 -17
  47. data/lib/musa-dsl/generative/markov.rb +49 -9
  48. data/lib/musa-dsl/generative/variatio.rb +26 -6
  49. data/lib/musa-dsl/generative.rb +0 -1
  50. data/lib/musa-dsl/logger/logger.rb +42 -16
  51. data/lib/musa-dsl/matrix/matrix.rb +49 -20
  52. data/lib/musa-dsl/midi/midi-recorder.rb +31 -12
  53. data/lib/musa-dsl/midi/midi-voices.rb +204 -20
  54. data/lib/musa-dsl/music/chord-definition.rb +63 -25
  55. data/lib/musa-dsl/music/chords.rb +107 -30
  56. data/lib/musa-dsl/music/scale_kinds/chromatic_scale_kind.rb +6 -6
  57. data/lib/musa-dsl/music/scale_kinds/major_scale_kind.rb +9 -6
  58. data/lib/musa-dsl/music/scale_kinds/minor_harmonic_scale_kind.rb +10 -5
  59. data/lib/musa-dsl/music/scale_kinds/minor_natural_scale_kind.rb +9 -6
  60. data/lib/musa-dsl/music/scale_systems/equally_tempered_12_tone_scale_system.rb +3 -3
  61. data/lib/musa-dsl/music/scale_systems/twelve_semitones_scale_system.rb +2 -2
  62. data/lib/musa-dsl/music/scales.rb +265 -88
  63. data/lib/musa-dsl/musicxml/builder/attributes.rb +134 -55
  64. data/lib/musa-dsl/musicxml/builder/backup-forward.rb +26 -0
  65. data/lib/musa-dsl/musicxml/builder/direction.rb +41 -21
  66. data/lib/musa-dsl/musicxml/builder/helper.rb +7 -4
  67. data/lib/musa-dsl/musicxml/builder/measure.rb +31 -3
  68. data/lib/musa-dsl/musicxml/builder/note-complexities.rb +14 -7
  69. data/lib/musa-dsl/musicxml/builder/part-group.rb +11 -1
  70. data/lib/musa-dsl/musicxml/builder/part.rb +14 -0
  71. data/lib/musa-dsl/musicxml/builder/pitched-note.rb +11 -3
  72. data/lib/musa-dsl/musicxml/builder/rest.rb +6 -3
  73. data/lib/musa-dsl/musicxml/builder/score-partwise.rb +22 -1
  74. data/lib/musa-dsl/musicxml/builder/typed-text.rb +8 -6
  75. data/lib/musa-dsl/musicxml/builder/unpitched-note.rb +4 -2
  76. data/lib/musa-dsl/neumalang/neumalang.rb +43 -16
  77. data/lib/musa-dsl/neumas/array-to-neumas.rb +36 -18
  78. data/lib/musa-dsl/neumas/neuma-decoder.rb +3 -3
  79. data/lib/musa-dsl/neumas/neuma-gdv-decoder.rb +16 -2
  80. data/lib/musa-dsl/neumas/neuma-gdvd-decoder.rb +19 -14
  81. data/lib/musa-dsl/neumas/neumas.rb +25 -17
  82. data/lib/musa-dsl/neumas/string-to-neumas.rb +89 -18
  83. data/lib/musa-dsl/repl/repl.rb +100 -91
  84. data/lib/musa-dsl/sequencer/base-sequencer-implementation-every.rb +22 -6
  85. data/lib/musa-dsl/sequencer/base-sequencer-implementation-move.rb +4 -2
  86. data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-helper.rb +62 -35
  87. data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-timed.rb +8 -3
  88. data/lib/musa-dsl/sequencer/base-sequencer-implementation-play.rb +95 -20
  89. data/lib/musa-dsl/sequencer/base-sequencer-implementation.rb +39 -9
  90. data/lib/musa-dsl/sequencer/base-sequencer-tick-based.rb +50 -14
  91. data/lib/musa-dsl/sequencer/base-sequencer-tickless-based.rb +84 -24
  92. data/lib/musa-dsl/sequencer/base-sequencer.rb +159 -39
  93. data/lib/musa-dsl/sequencer/sequencer-dsl.rb +39 -7
  94. data/lib/musa-dsl/series/array-to-serie.rb +15 -5
  95. data/lib/musa-dsl/series/base-series.rb +97 -14
  96. data/lib/musa-dsl/series/buffer-serie.rb +6 -0
  97. data/lib/musa-dsl/series/main-serie-constructors.rb +233 -69
  98. data/lib/musa-dsl/series/main-serie-operations.rb +163 -52
  99. data/lib/musa-dsl/series/proxy-serie.rb +157 -13
  100. data/lib/musa-dsl/series/quantizer-serie.rb +44 -4
  101. data/lib/musa-dsl/series/queue-serie.rb +33 -8
  102. data/lib/musa-dsl/series/series-composer.rb +94 -40
  103. data/lib/musa-dsl/series/timed-serie.rb +1 -1
  104. data/lib/musa-dsl/transcription/from-gdv-to-midi.rb +117 -12
  105. data/lib/musa-dsl/transcription/from-gdv-to-musicxml.rb +7 -0
  106. data/lib/musa-dsl/transcription/from-gdv.rb +1 -1
  107. data/lib/musa-dsl/transcription/transcription.rb +23 -11
  108. data/lib/musa-dsl/transport/clock.rb +8 -3
  109. data/lib/musa-dsl/transport/dummy-clock.rb +46 -9
  110. data/lib/musa-dsl/transport/external-tick-clock.rb +30 -23
  111. data/lib/musa-dsl/transport/input-midi-clock.rb +22 -15
  112. data/lib/musa-dsl/transport/timer-clock.rb +40 -6
  113. data/lib/musa-dsl/transport/timer.rb +6 -4
  114. data/lib/musa-dsl/transport/transport.rb +80 -36
  115. data/lib/musa-dsl/version.rb +1 -1
  116. data/lib/musa-dsl.rb +9 -6
  117. data/tools/doc-examples.rb +744 -0
  118. metadata +6 -6
  119. data/docs/README.md +0 -84
  120. data/docs/api-reference.md +0 -86
  121. 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: 489a7b49196f4a1ff58782264f6b1d36da306d6a64671785b4aa904567461b4c
4
+ data.tar.gz: '099acf5b2ed77c18494bcfecc7b73cf375cf37a46c6e2ba940df3a5015934d60'
5
5
  SHA512:
6
- metadata.gz: 296f17a87edaf39c519c3054bfc790445aa45aa5295aee76b978c831465a6e4a312b2c541fc9d99424e7365ff9726055e05537ddb6b7b362ee5fb69bb5b3e83d
7
- data.tar.gz: 571a82f51bc2e5d61c77f214629d727c8c47ed1c7a8d0ba6c4ac7c3019ccd4ba93f7a6f85b81e7041fdb773aa11607ab1606a7a2f9adbee252ccc72e8e516a76
6
+ metadata.gz: 94c57a46910a986ed39c997ed9680a8a232e6b38d892cc6780c03ef5a01c30f7f70ab3db3fa4cfbdb792b9e575191ef90ac8f6a380c7bd7cf8b74098e55acd1a
7
+ data.tar.gz: 394f30c7fc69e0e0474b75778440ac56a2e7847ab50c0f374e84c5893ded282e379bdc731b00dcedf2c4808fc918dcbfc4682f4b71ef3818d57c9daafe8f11e0
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
95
-
96
- A complete working example with multiple interacting voice lines, demonstrating sequencer DSL, timing control, and shared state.
61
+ ## Examples
97
62
 
98
- **📖 [Complete Quick Start Guide](docs/getting-started/quick-start.md)**
63
+ Two complete, runnable examples included here. Pedagogical learning is covered separately in the [musadsl-demo](https://github.com/javier-sy/musadsl-demo) repository.
99
64
 
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,132 @@ 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
143
-
144
- The musa-dsl framework is organized in modular layers:
95
+ ## MusaDSL Architecture
145
96
 
146
- #### 1. Foundation Layer
147
- - **core-ext** - Ruby core extensions (refinements for enhanced syntax)
148
- - **logger** - Structured logging system with severity levels
97
+ The musa-dsl framework is organized in modular layers. Each component has its own detailed documentation.
149
98
 
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)
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.
159
102
 
160
- #### 3. Notation & Parsing Layer
161
- - **neumas** - Text-based musical notation system
162
- - **neumalang** - Parser and interpreter for neuma notation with DSL support
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.
163
106
 
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
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.
177
109
 
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
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.
191
114
 
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
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.
201
119
 
202
- #### 7. Development & Interaction Layer
203
- - **repl** - Interactive Read-Eval-Print Loop for live composition
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.
204
123
 
205
- ## Core Subsystems
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).
206
126
 
207
- ### MIDI - Voice Management & Recording
127
+ ## Where to start
208
128
 
209
- Polyphonic voice management for MIDI output with automatic note tracking, and MIDI input recording with precise timestamping.
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:
210
131
 
211
- **📖 [Complete Documentation](docs/subsystems/midi.md)**
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:
212
135
 
213
- ### Sequencer - Temporal Engine
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
214
140
 
215
- Event scheduling engine with musical time (bars/beats), precise tick-based timing, and DSL for temporal composition.
141
+ **Want to compose?**
216
142
 
217
- **📖 [Complete Documentation](docs/subsystems/sequencer.md)**
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
218
149
 
219
- ### Transport - Timing & Clocks
150
+ **Live coding?**
220
151
 
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.
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
222
156
 
223
- **📖 [Complete Transport Documentation](docs/subsystems/transport.md)**
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:
224
159
 
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
225
164
 
226
- ### Series - Sequence Generators
165
+ **And one that is not a stage of any of them.**
166
+ [idioms](docs/idioms.md) is for the moment of writing, whichever path brought you
167
+ there: it is organised by the SHAPE of the problem, and each entry names a reflex
168
+ — something a competent programmer writes before asking what MusaDSL calls it.
169
+ The reflex always works, which is the problem: it produces code that runs, sounds
170
+ right, passes every test, and is foreign to the framework. Read it from the
171
+ symptom, when you are about to make the mistake rather than after.
227
172
 
228
- Lazy functional sequence generators with map/filter operations, numeric generators, buffering, quantization, and timed merging.
173
+ ## Documentation
229
174
 
230
- **📖 [Complete Documentation](docs/subsystems/series.md)**
175
+ The subsystem guides linked above are the conceptual documentation: when each
176
+ one is the answer, how to think about it, and the traps. Every Ruby block in
177
+ them is executed by `tools/doc-examples.rb`, and every output they declare is
178
+ compared with what the code actually returns -- so a page that has drifted fails
179
+ the suite rather than misleading a reader.
231
180
 
232
- ### Neumas & Neumalang - Musical Notation
181
+ The API reference is generated from the inline YARD documentation, whose
182
+ `@example` blocks are held to the same standard:
233
183
 
234
- Compact text-based musical notation system with parser for converting notation to structured musical data.
235
-
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)**
184
+ ```bash
185
+ bundle exec yard doc
186
+ bundle exec yard server
187
+ ```
273
188
 
274
- ### REPL - Live Coding Infrastructure
189
+ Then open http://localhost:8808.
275
190
 
276
- TCP-based server for live coding with MusaLCE clients (VSCode, Atom, Bitwig, Live), real-time code evaluation and error handling.
191
+ ## Contributing
277
192
 
278
- **📖 [Complete Documentation](docs/subsystems/repl.md)**
193
+ Contributions are welcome. Fork the repository, create a feature branch, make
194
+ your changes with tests, and open a pull request.
279
195
 
280
- ### Core Extensions - Advanced Metaprogramming
196
+ **Repository:** https://github.com/javier-sy/musa-dsl
281
197
 
282
- Ruby refinements and metaprogramming utilities: Arrayfy, Hashify, ExplodeRanges, DeepCopy, DynamicProxy, AttributeBuilder, Logger.
198
+ ## Examples & Works
283
199
 
284
- **📖 [Complete Documentation](docs/subsystems/core-extensions.md)**
200
+ Listen to compositions created with Musa-DSL: [yeste.studio](https://yeste.studio)
285
201
 
286
202
  ## Author
287
203
 
288
- * [Javier Sánchez Yeste](https://github.com/javier-sy)
204
+ * [Javier Sánchez Yeste](https://github.com/javier-sy) -- javier (at) yeste.studio
205
+
206
+ Special thanks to [JetBrains](https://www.jetbrains.com/?from=Musa-DSL) for
207
+ providing an Open Source project license for RubyMine during several years.
289
208
 
290
209
  ## License
291
210
 
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'