musa-dsl 0.30.2 → 0.40.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.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.version +6 -0
  4. data/.yardopts +7 -0
  5. data/README.md +227 -6
  6. data/docs/README.md +83 -0
  7. data/docs/api-reference.md +86 -0
  8. data/docs/getting-started/quick-start.md +93 -0
  9. data/docs/getting-started/tutorial.md +58 -0
  10. data/docs/subsystems/core-extensions.md +316 -0
  11. data/docs/subsystems/datasets.md +465 -0
  12. data/docs/subsystems/generative.md +290 -0
  13. data/docs/subsystems/matrix.md +63 -0
  14. data/docs/subsystems/midi.md +123 -0
  15. data/docs/subsystems/music.md +233 -0
  16. data/docs/subsystems/musicxml-builder.md +264 -0
  17. data/docs/subsystems/neumas.md +71 -0
  18. data/docs/subsystems/repl.md +135 -0
  19. data/docs/subsystems/sequencer.md +98 -0
  20. data/docs/subsystems/series.md +302 -0
  21. data/docs/subsystems/transcription.md +152 -0
  22. data/docs/subsystems/transport.md +177 -0
  23. data/lib/musa-dsl/core-ext/array-explode-ranges.rb +68 -0
  24. data/lib/musa-dsl/core-ext/arrayfy.rb +110 -0
  25. data/lib/musa-dsl/core-ext/attribute-builder.rb +91 -30
  26. data/lib/musa-dsl/core-ext/deep-copy.rb +125 -2
  27. data/lib/musa-dsl/core-ext/dynamic-proxy.rb +78 -0
  28. data/lib/musa-dsl/core-ext/extension.rb +53 -0
  29. data/lib/musa-dsl/core-ext/hashify.rb +162 -1
  30. data/lib/musa-dsl/core-ext/inspect-nice.rb +154 -0
  31. data/lib/musa-dsl/core-ext/smart-proc-binder.rb +117 -0
  32. data/lib/musa-dsl/core-ext/with.rb +114 -0
  33. data/lib/musa-dsl/datasets/dataset.rb +109 -0
  34. data/lib/musa-dsl/datasets/delta-d.rb +78 -0
  35. data/lib/musa-dsl/datasets/e.rb +186 -2
  36. data/lib/musa-dsl/datasets/gdv.rb +279 -2
  37. data/lib/musa-dsl/datasets/gdvd.rb +201 -0
  38. data/lib/musa-dsl/datasets/helper.rb +75 -0
  39. data/lib/musa-dsl/datasets/p.rb +177 -2
  40. data/lib/musa-dsl/datasets/packed-v.rb +91 -0
  41. data/lib/musa-dsl/datasets/pdv.rb +136 -1
  42. data/lib/musa-dsl/datasets/ps.rb +134 -4
  43. data/lib/musa-dsl/datasets/score/queriable.rb +143 -1
  44. data/lib/musa-dsl/datasets/score/render.rb +105 -1
  45. data/lib/musa-dsl/datasets/score/to-mxml/process-pdv.rb +138 -1
  46. data/lib/musa-dsl/datasets/score/to-mxml/process-ps.rb +111 -0
  47. data/lib/musa-dsl/datasets/score/to-mxml/process-time.rb +200 -1
  48. data/lib/musa-dsl/datasets/score/to-mxml/to-mxml.rb +145 -1
  49. data/lib/musa-dsl/datasets/score.rb +279 -0
  50. data/lib/musa-dsl/datasets/v.rb +88 -0
  51. data/lib/musa-dsl/generative/darwin.rb +180 -1
  52. data/lib/musa-dsl/generative/generative-grammar.rb +359 -0
  53. data/lib/musa-dsl/generative/markov.rb +133 -3
  54. data/lib/musa-dsl/generative/rules.rb +258 -4
  55. data/lib/musa-dsl/generative/variatio.rb +217 -2
  56. data/lib/musa-dsl/logger/logger.rb +267 -2
  57. data/lib/musa-dsl/matrix/matrix.rb +256 -10
  58. data/lib/musa-dsl/midi/midi-recorder.rb +108 -1
  59. data/lib/musa-dsl/midi/midi-voices.rb +265 -4
  60. data/lib/musa-dsl/music/chord-definition.rb +233 -1
  61. data/lib/musa-dsl/music/chord-definitions.rb +33 -6
  62. data/lib/musa-dsl/music/chords.rb +308 -2
  63. data/lib/musa-dsl/music/equally-tempered-12-tone-scale-system.rb +315 -0
  64. data/lib/musa-dsl/music/scales.rb +957 -40
  65. data/lib/musa-dsl/musicxml/builder/attributes.rb +483 -3
  66. data/lib/musa-dsl/musicxml/builder/backup-forward.rb +166 -1
  67. data/lib/musa-dsl/musicxml/builder/direction.rb +243 -0
  68. data/lib/musa-dsl/musicxml/builder/helper.rb +240 -0
  69. data/lib/musa-dsl/musicxml/builder/measure.rb +284 -0
  70. data/lib/musa-dsl/musicxml/builder/note-complexities.rb +324 -8
  71. data/lib/musa-dsl/musicxml/builder/note.rb +285 -0
  72. data/lib/musa-dsl/musicxml/builder/part-group.rb +108 -1
  73. data/lib/musa-dsl/musicxml/builder/part.rb +139 -0
  74. data/lib/musa-dsl/musicxml/builder/pitched-note.rb +124 -0
  75. data/lib/musa-dsl/musicxml/builder/rest.rb +93 -0
  76. data/lib/musa-dsl/musicxml/builder/score-partwise.rb +276 -0
  77. data/lib/musa-dsl/musicxml/builder/typed-text.rb +62 -1
  78. data/lib/musa-dsl/musicxml/builder/unpitched-note.rb +83 -0
  79. data/lib/musa-dsl/neumalang/neumalang.rb +675 -0
  80. data/lib/musa-dsl/neumas/array-to-neumas.rb +149 -0
  81. data/lib/musa-dsl/neumas/neuma-decoder.rb +253 -0
  82. data/lib/musa-dsl/neumas/neuma-gdv-decoder.rb +142 -2
  83. data/lib/musa-dsl/neumas/neuma-gdvd-decoder.rb +82 -0
  84. data/lib/musa-dsl/neumas/neumas.rb +67 -0
  85. data/lib/musa-dsl/neumas/string-to-neumas.rb +233 -1
  86. data/lib/musa-dsl/repl/repl.rb +550 -0
  87. data/lib/musa-dsl/sequencer/base-sequencer-implementation-every.rb +118 -2
  88. data/lib/musa-dsl/sequencer/base-sequencer-implementation-move.rb +149 -2
  89. data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-helper.rb +296 -0
  90. data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-timed.rb +88 -2
  91. data/lib/musa-dsl/sequencer/base-sequencer-implementation-play.rb +161 -0
  92. data/lib/musa-dsl/sequencer/base-sequencer-implementation.rb +263 -0
  93. data/lib/musa-dsl/sequencer/base-sequencer-tick-based.rb +173 -1
  94. data/lib/musa-dsl/sequencer/base-sequencer-tickless-based.rb +177 -0
  95. data/lib/musa-dsl/sequencer/base-sequencer.rb +710 -10
  96. data/lib/musa-dsl/sequencer/sequencer-dsl.rb +210 -0
  97. data/lib/musa-dsl/sequencer/timeslots.rb +79 -0
  98. data/lib/musa-dsl/series/array-to-serie.rb +37 -1
  99. data/lib/musa-dsl/series/base-series.rb +843 -5
  100. data/lib/musa-dsl/series/buffer-serie.rb +48 -0
  101. data/lib/musa-dsl/series/hash-or-array-serie-splitter.rb +41 -0
  102. data/lib/musa-dsl/series/main-serie-constructors.rb +398 -2
  103. data/lib/musa-dsl/series/main-serie-operations.rb +538 -16
  104. data/lib/musa-dsl/series/proxy-serie.rb +67 -0
  105. data/lib/musa-dsl/series/quantizer-serie.rb +45 -7
  106. data/lib/musa-dsl/series/queue-serie.rb +65 -0
  107. data/lib/musa-dsl/series/series-composer.rb +701 -0
  108. data/lib/musa-dsl/series/timed-serie.rb +473 -28
  109. data/lib/musa-dsl/transcription/from-gdv-to-midi.rb +404 -1
  110. data/lib/musa-dsl/transcription/from-gdv-to-musicxml.rb +118 -0
  111. data/lib/musa-dsl/transcription/from-gdv.rb +84 -1
  112. data/lib/musa-dsl/transcription/transcription.rb +265 -0
  113. data/lib/musa-dsl/transport/clock.rb +125 -0
  114. data/lib/musa-dsl/transport/dummy-clock.rb +89 -2
  115. data/lib/musa-dsl/transport/external-tick-clock.rb +91 -0
  116. data/lib/musa-dsl/transport/input-midi-clock.rb +133 -1
  117. data/lib/musa-dsl/transport/timer-clock.rb +183 -1
  118. data/lib/musa-dsl/transport/timer.rb +83 -0
  119. data/lib/musa-dsl/transport/transport.rb +318 -0
  120. data/lib/musa-dsl/version.rb +1 -1
  121. data/lib/musa-dsl.rb +132 -25
  122. data/musa-dsl.gemspec +12 -10
  123. metadata +87 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46593c12b7c6a2d9174c26a523395a0a5232761893d8421b8c6f3805d6c78073
4
- data.tar.gz: 9d299fff075bced81094b0db3e6c9ded3bcd0cc77d92720fbd3158bee1897cf5
3
+ metadata.gz: 603ecc3ddd2b6bcead498e08a747035df5ff2c2e87e4f527c66c48d5631ab435
4
+ data.tar.gz: 37dde89a2c5ff9dda9691ff245fa06b4e870475fb7320ef10bca5ef0a7a84ed2
5
5
  SHA512:
6
- metadata.gz: 48853c7eb338546219b24985b93690cc5051f37df4288e0d53711ab16afa45beb0be8fc60f87a5605d2187b2bd3bf3bc49dfef3eaba903965f3c29b6f5fdb93b
7
- data.tar.gz: 32e28f2f7a897d3f025d3eda37ba4558b609fa1b8d44b0645ce3361bed7ea865798cbb9c8ad90feff473c84fc43a6aedee307058b2ca8148691ee667e601dc44
6
+ metadata.gz: 8b1bd0544fd6b6fe611718809e50422e3accf376e88da0832e7b22b7f5b279eb52d9cab2fe3c3f75d2e996e17f0c1a604a2e56676249c946dae533988db8a54c
7
+ data.tar.gz: 4c4dbcbfb7243f751205f275eaba483e8d29ce3ca5f59e600a1b8be9d1687c0815572916415b4dfbb0ac14ae7f2bbaec3ee610af2922fe8ab9de42e4ab3a04b2
data/.gitignore CHANGED
@@ -9,4 +9,6 @@ Gemfile.lock
9
9
  bin
10
10
  *.mindnode
11
11
  test.musicxml
12
-
12
+ doc
13
+ .yardoc
14
+ *.backup
data/.version ADDED
@@ -0,0 +1,6 @@
1
+ # Configuración de versión para musa-dsl
2
+ GEM_NAME="musa-dsl"
3
+ MODULE_NAME="Musa"
4
+ VERSION_FILE="lib/musa-dsl/version.rb"
5
+ GEMSPEC_FILE="musa-dsl.gemspec"
6
+ TEST_COMMAND="bundle exec rspec"
data/.yardopts ADDED
@@ -0,0 +1,7 @@
1
+ --markup markdown
2
+ --title "Musa-DSL API"
3
+ --readme README.md
4
+ --no-private
5
+ --embed-mixins
6
+ lib/**/*.rb
7
+
data/README.md CHANGED
@@ -1,12 +1,233 @@
1
1
  # Musa-DSL
2
2
 
3
- Work in progress.
3
+ [![Ruby Version](https://img.shields.io/badge/ruby-3.4.7-red.svg)](https://www.ruby-lang.org/)
4
+ [![License](https://img.shields.io/badge/license-LGPL--3.0--or--later-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0.html)
4
5
 
5
- A programming language DSL based on Ruby for sonic and musical composition.
6
- Emphasizes the creation of complex temporal structures independently of the audio rendering engine.
6
+ A Ruby framework and DSL for algorithmic sound and musical thinking and composition.
7
7
 
8
- Some works can be listened on [yeste.studio](https://soundcloud.com/yeste-studio) Soundcloud.
8
+ ## Description
9
9
 
10
- ---
10
+ Musa-DSL is a programming language DSL (Domain-Specific Language) based on Ruby designed for sonic and musical composition. It emphasizes the creation of complex temporal structures independently of the audio rendering engine, providing composers and developers with powerful tools for algorithmic composition, generative music, and musical notation.
11
11
 
12
- Coded on [Jetbrains RubyMine IDE](https://www.jetbrains.com/?from=Musa-DSL). Thanks a lot for your support letting me use an Open Source project free license!
12
+ **Who is it for?**
13
+
14
+ - Composers exploring algorithmic composition
15
+ - Musicians interested in generative music systems
16
+ - Developers building music applications
17
+ - Researchers in computational musicology
18
+ - Live coders and interactive music performers
19
+
20
+ ## Key Features
21
+
22
+ - **Advanced Sequencer** - Precise temporal control for complex polyrhythmic and polytemporal structures
23
+ - **Transport & Timing** - Multiple clock sources (internal, MIDI, external) with microsecond precision
24
+ - **Audio Engine Independent** - Works with any MIDI-capable, OSC-capable or any other output hardware or software system
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)
27
+ - **Matrix Operations** - Mathematical transformations for musical structures
28
+ - **Scale System** - Comprehensive support for scales, tuning systems, and chord structures
29
+ - **Neumalang Notation** - Intuitive text-based and customizable musical (or sound) notation
30
+ - **Transcription System** - Convert musical gestures to MIDI and MusicXML with ornament transcription expansion
31
+
32
+ ## Installation
33
+
34
+ Add to your Gemfile:
35
+
36
+ ```ruby
37
+ gem 'musa-dsl'
38
+ ```
39
+
40
+ Or install directly:
41
+
42
+ ```bash
43
+ gem install musa-dsl
44
+ ```
45
+
46
+ **Requirements:**
47
+ - Ruby ~> 3.4
48
+
49
+ ## Quick Start
50
+
51
+ A complete working example with multiple interacting voice lines, demonstrating sequencer DSL, timing control, and shared state.
52
+
53
+ **📖 [Complete Quick Start Guide](docs/getting-started/quick-start.md)**
54
+
55
+ ## Tutorial
56
+
57
+ Detailed tutorial showing the Neuma notation system for composing melodies with grade-based notation.
58
+
59
+ **📖 [Complete Tutorial](docs/getting-started/tutorial.md)**
60
+
61
+ ## System Architecture
62
+
63
+ MusaDSL is a comprehensive ecosystem consisting of a core framework (musa-dsl) and associated projects for communication, development, and integration.
64
+
65
+ ### MusaDSL Ecosystem
66
+
67
+ **Core Framework:**
68
+ - [**musa-dsl**](https://github.com/javier-sy/musa-dsl) - Main DSL framework for algorithmic composition and musical thinking
69
+
70
+ **MIDI Communication Stack:**
71
+ - [**midi-events**](https://github.com/javier-sy/midi-events) - Low-level MIDI event definitions and protocols
72
+ - [**midi-parser**](https://github.com/javier-sy/midi-parser) - MIDI file parsing and analysis
73
+ - [**midi-communications**](https://github.com/javier-sy/midi-communications) - Cross-platform MIDI I/O abstraction layer
74
+ - [**midi-communications-macos**](https://github.com/javier-sy/midi-communications-macos) - macOS-specific MIDI native implementation
75
+
76
+ **Live Coding Environment (MusaLCE):**
77
+ - [**musalce-server**](https://github.com/javier-sy/musalce-server) - Live coding evaluation server with hot-reload capabilities
78
+ - [**MusaLCEClientForVSCode**](https://github.com/javier-sy/MusaLCEClientForVSCode) - Visual Studio Code extension for live coding
79
+ - [**MusaLCEClientForAtom**](https://github.com/javier-sy/MusaLCEClientForAtom) - Atom editor plugin for live coding
80
+ - [**MusaLCEforBitwig**](https://github.com/javier-sy/MusaLCEforBitwig) - Bitwig Studio integration for live coding
81
+ - [**MusaLCEforLive**](https://github.com/javier-sy/MusaLCEforLive) - Ableton Live integration for live coding
82
+
83
+ ### musa-dsl Internal Architecture
84
+
85
+ The musa-dsl framework is organized in modular layers:
86
+
87
+ #### 1. Foundation Layer
88
+ - **core-ext** - Ruby core extensions (refinements for enhanced syntax)
89
+ - **logger** - Structured logging system with severity levels
90
+
91
+ #### 2. Temporal & Scheduling Layer
92
+ - **sequencer** - Event scheduling engine with microsecond precision
93
+ - Tick-based (quantized) and tickless (continuous) timing modes
94
+ - Series playback with automatic duration management
95
+ - Support for polyrhythms and polytemporal structures
96
+ - **transport** - High-level playback control with clock synchronization
97
+ - BPM management and tempo changes
98
+ - Start/stop/pause/continue controls
99
+ - Multiple clock source support (internal, MIDI, external)
100
+
101
+ #### 3. Notation & Parsing Layer
102
+ - **neumas** - Text-based musical notation system
103
+ - **neumalang** - Parser and interpreter for neuma notation with DSL support
104
+
105
+ #### 4. Generation & Transformation Layer
106
+ - **series** - Lazy sequence generators with functional operations
107
+ - Map, filter, transpose, repeat, and combination operations
108
+ - Infinite and finite series support
109
+ - **generative** - Algorithmic composition tools
110
+ - **Markov chains**: Probabilistic sequence generation
111
+ - **Variatio**: Cartesian product parameter variations
112
+ - **Rules**: L-system-like production systems with growth/pruning
113
+ - **GenerativeGrammar**: Formal grammar-based generation
114
+ - **Darwin**: Genetic algorithms for evolutionary composition
115
+ - **matrix** - Matrix operations for musical gestures
116
+ - Matrix-to-P (point sequence) conversion
117
+ - Gesture condensation and transformation
118
+
119
+ #### 5. Output & Communication Layer
120
+ - **transcription** - Musical event transformation system
121
+ - Ornament expansion (trills, mordents, turns)
122
+ - GDV to MIDI/MusicXML conversion
123
+ - Dynamic articulation rendering
124
+ - **musicxml** - MusicXML score generation
125
+ - Multi-part score creation
126
+ - Notation directives (dynamics, tempo, articulations)
127
+ - Standard MusicXML 3.0 output
128
+ - **midi** - MIDI voice management
129
+ - Polyphonic voice allocation
130
+ - Channel management
131
+ - Note-on/note-off scheduling
132
+
133
+ #### 6. Musical Knowledge Layer
134
+ - **music** - Scales, tuning systems, intervals, and chord structures
135
+ - Equal temperament and just intonation support
136
+ - Modal scales (major, minor, chromatic, etc.)
137
+ - Chord definitions and harmonic analysis
138
+ - **datasets** - Musical data structures (GDV, PDV, Score)
139
+ - GDV (Grade-Duration-Velocity): Scale-relative representation
140
+ - PDV (Pitch-Duration-Velocity): Absolute pitch representation
141
+ - Score: Timeline-based multi-track composition structure
142
+
143
+ #### 7. Development & Interaction Layer
144
+ - **repl** - Interactive Read-Eval-Print Loop for live composition
145
+
146
+ ## Core Subsystems
147
+
148
+ ### MIDI - Voice Management & Recording
149
+
150
+ Polyphonic voice management for MIDI output with automatic note tracking, and MIDI input recording with precise timestamping.
151
+
152
+ **📖 [Complete Documentation](docs/subsystems/midi.md)**
153
+
154
+ ### Sequencer - Temporal Engine
155
+
156
+ Event scheduling engine with musical time (bars/beats), precise tick-based timing, and DSL for temporal composition.
157
+
158
+ **📖 [Complete Documentation](docs/subsystems/sequencer.md)**
159
+
160
+ ### Transport - Timing & Clocks
161
+
162
+ 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.
163
+
164
+ **📖 [Complete Transport Documentation](docs/subsystems/transport.md)**
165
+
166
+
167
+ ### Series - Sequence Generators
168
+
169
+ Lazy functional sequence generators with map/filter operations, numeric generators, buffering, quantization, and timed merging.
170
+
171
+ **📖 [Complete Documentation](docs/subsystems/series.md)**
172
+
173
+ ### Neumas & Neumalang - Musical Notation
174
+
175
+ Compact text-based musical notation system with parser for converting notation to structured musical data.
176
+
177
+ **📖 [Complete Documentation](docs/subsystems/neumas.md)**
178
+
179
+ ### Datasets - Sonic Data Structures
180
+
181
+ Type-safe musical event representations (GDV, PDV, PS, P, V) with conversions, validation, Score container, and advanced queries.
182
+
183
+ **📖 [Complete Documentation](docs/subsystems/datasets.md)**
184
+
185
+ ### Matrix - Sonic Gesture Conversion
186
+
187
+ Convert matrix representations to point sequences for sequencer playback, treating sonic gestures as geometric objects.
188
+
189
+ **📖 [Complete Documentation](docs/subsystems/matrix.md)**
190
+
191
+ ### Transcription - MIDI & MusicXML Output
192
+
193
+ Convert between representations with ornament expansion for MIDI or preservation as notation symbols for MusicXML.
194
+
195
+ **📖 [Complete Documentation](docs/subsystems/transcription.md)**
196
+
197
+ ### Music - Scales & Chords
198
+
199
+ Comprehensive scale and chord systems with equal temperament, custom tunings, chord navigation, and extensible definitions.
200
+
201
+ **📖 [Complete Documentation](docs/subsystems/music.md)**
202
+
203
+ ### Generative - Algorithmic Composition
204
+
205
+ Algorithmic composition tools: Markov chains, Variatio, Rules (L-systems), GenerativeGrammar, and Darwin (genetic algorithms).
206
+
207
+ **📖 [Complete Documentation](docs/subsystems/generative.md)**
208
+
209
+ ### MusicXML Builder - Music Notation Export
210
+
211
+ Comprehensive MusicXML score generation with hierarchical structure, multiple voices, articulations, and dynamics.
212
+
213
+ **📖 [Complete Documentation](docs/subsystems/musicxml-builder.md)**
214
+
215
+ ### REPL - Live Coding Infrastructure
216
+
217
+ TCP-based server for live coding with MusaLCE clients (VSCode, Atom, Bitwig, Live), real-time code evaluation and error handling.
218
+
219
+ **📖 [Complete Documentation](docs/subsystems/repl.md)**
220
+
221
+ ### Core Extensions - Advanced Metaprogramming
222
+
223
+ Ruby refinements and metaprogramming utilities: Arrayfy, Hashify, ExplodeRanges, DeepCopy, DynamicProxy, AttributeBuilder, Logger.
224
+
225
+ **📖 [Complete Documentation](docs/subsystems/core-extensions.md)**
226
+
227
+ ## Author
228
+
229
+ * [Javier Sánchez Yeste](https://github.com/javier-sy)
230
+
231
+ ## License
232
+
233
+ [Musa-DSL](https://github.com/javier-sy/musa-dsl) Copyright (c) 2016-2025 [Javier Sánchez Yeste](https://yeste.studio), licensed under LGPL 3.0 License
data/docs/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # Musa DSL Documentation
2
+
3
+ Complete documentation for the Musa DSL framework for algorithmic sound and musical composition.
4
+
5
+ ## 📚 Documentation Structure
6
+
7
+ ### Getting Started
8
+ - **[Installation](../README.md#installation)** - Set up Musa DSL
9
+ - **[Quick Start](../README.md#quick-start)** - 5-minute introduction
10
+ - **[Not So Quick Start](../README.md#not-so-quick-start)** - Comprehensive tutorial
11
+
12
+ ### Core Subsystems
13
+
14
+ Detailed documentation for each Musa DSL subsystem:
15
+
16
+ | Subsystem | Description | Documentation |
17
+ |-----------|-------------|---------------|
18
+ | **MIDI** | Voice management & recording | [midi.md](subsystems/midi.md) |
19
+ | **Sequencer** | Temporal engine | [sequencer.md](subsystems/sequencer.md) |
20
+ | **Transport** | Timing & clocks | [subsystems/transport.md](subsystems/transport.md) |
21
+ | **Series** | Sequence generators | [series.md](subsystems/series.md) |
22
+ | **Neumas** | Musical notation | [neumas.md](subsystems/neumas.md) |
23
+ | **Datasets** | Sonic data structures | [datasets.md](subsystems/datasets.md) |
24
+ | **Matrix** | Sonic gesture conversion | [matrix.md](subsystems/matrix.md) |
25
+ | **Transcription** | MIDI & MusicXML output | [transcription.md](subsystems/transcription.md) |
26
+ | **Music** | Scales & chords | [music.md](subsystems/music.md) |
27
+ | **Generative** | Algorithmic composition | [generative.md](subsystems/generative.md) |
28
+ | **MusicXML Builder** | Music notation export | [musicxml-builder.md](subsystems/musicxml-builder.md) |
29
+
30
+ ### Advanced Topics
31
+
32
+ For users extending the DSL or integrating deeply:
33
+
34
+ | Topic | Description | Documentation |
35
+ |-------|-------------|---------------|
36
+ | **REPL** | Live coding infrastructure | [repl.md](subsystems/repl.md) |
37
+ | **Core Extensions** | Metaprogramming utilities | [core-extensions.md](subsystems/core-extensions.md) |
38
+
39
+ ## 🎯 Learning Paths
40
+
41
+ ### New to Musa DSL?
42
+ 1. Start with [Quick Start](../README.md#quick-start)
43
+ 2. Read [System Architecture](../README.md#system-architecture)
44
+ 3. Explore subsystems in this order:
45
+ - [MIDI](subsystems/midi.md) - Output basics
46
+ - [Sequencer](subsystems/sequencer.md) - Temporal control
47
+ - [Series](subsystems/series.md) - Sequence generation
48
+ - [Datasets](subsystems/datasets.md) - Data structures
49
+
50
+ ### Want to Compose?
51
+ 1. Learn [Neumas](subsystems/neumas.md) notation
52
+ 2. Explore [Music](subsystems/music.md) (scales & chords)
53
+ 3. Try [Generative](subsystems/generative.md) algorithms
54
+ 4. Use [MusicXML Builder](subsystems/musicxml-builder.md) for scores
55
+
56
+ ### Live Coding?
57
+ 1. Set up [REPL](subsystems/repl.md)
58
+ 2. Configure MusaLCE client (VSCode/Atom/Bitwig/Live)
59
+ 3. Learn [Sequencer](subsystems/sequencer.md) DSL
60
+ 4. Explore [Transport](subsystems/transport.md) for timing
61
+
62
+ ### Extending the DSL?
63
+ 1. Understand [Core Extensions](subsystems/core-extensions.md)
64
+ 2. Study [Datasets](subsystems/datasets.md) extensibility
65
+ 3. Review existing subsystem implementations
66
+ 4. Check YARD documentation for API details
67
+
68
+ ## 📖 Additional Resources
69
+
70
+ - **Main README**: [../README.md](../README.md)
71
+ - **API Reference**: [api-reference.md](api-reference.md) - Complete class/method documentation (RubyDoc.info)
72
+ - **Examples**: See examples/ directory in repository
73
+ - **Source Code**: lib/musa-dsl/
74
+
75
+ ## 🔗 External Links
76
+
77
+ - **GitHub Repository**: https://github.com/javier-sy/musa-dsl
78
+ - **RubyGems**: https://rubygems.org/gems/musa-dsl
79
+ - **Community**: See [Contributing](../README.md#contributing)
80
+
81
+ ---
82
+
83
+ **Navigation**: [← Back to Main README](../README.md) | [↑ Top](#musa-dsl-documentation)
@@ -0,0 +1,86 @@
1
+ # API Reference
2
+
3
+ Complete class and method documentation generated from inline YARD comments.
4
+
5
+ ## Online Documentation
6
+
7
+ **Official API documentation is hosted on RubyDoc.info:**
8
+
9
+ 🔗 **[https://rubydoc.info/gems/musa-dsl](https://rubydoc.info/gems/musa-dsl)**
10
+
11
+ This documentation is automatically generated and updated with each gem release.
12
+
13
+ ## Key Modules
14
+
15
+ ### Foundation
16
+ - [Musa::Extension](https://rubydoc.info/gems/musa-dsl/Musa/Extension) - Ruby refinements and metaprogramming
17
+ - [Musa::Logger](https://rubydoc.info/gems/musa-dsl/Musa/Logger) - Structured logging
18
+
19
+ ### Temporal & Scheduling
20
+ - [Musa::Sequencer](https://rubydoc.info/gems/musa-dsl/Musa/Sequencer) - Event scheduling engine
21
+ - [Musa::Transport](https://rubydoc.info/gems/musa-dsl/Musa/Transport) - Playback lifecycle
22
+ - [Musa::Clock](https://rubydoc.info/gems/musa-dsl/Musa/Clock) - Timing sources
23
+
24
+ ### Notation & Parsing
25
+ - [Musa::Neumas](https://rubydoc.info/gems/musa-dsl/Musa/Neumas) - Musical notation
26
+ - [Musa::Neumalang](https://rubydoc.info/gems/musa-dsl/Musa/Neumalang) - Notation parser
27
+
28
+ ### Generation & Transformation
29
+ - [Musa::Series](https://rubydoc.info/gems/musa-dsl/Musa/Series) - Sequence generators
30
+ - [Musa::Generative](https://rubydoc.info/gems/musa-dsl/Musa/Generative) - Algorithmic composition
31
+ - [Musa::Matrix](https://rubydoc.info/gems/musa-dsl/Musa/Matrix) - Gesture conversion
32
+
33
+ ### Output & Communication
34
+ - [Musa::Transcription](https://rubydoc.info/gems/musa-dsl/Musa/Transcription) - Event transformation
35
+ - [Musa::MusicXML::Builder](https://rubydoc.info/gems/musa-dsl/Musa/MusicXML/Builder) - Score generation
36
+ - [Musa::MIDIVoices](https://rubydoc.info/gems/musa-dsl/Musa/MIDIVoices) - Voice management
37
+ - [Musa::MIDIRecorder](https://rubydoc.info/gems/musa-dsl/Musa/MIDIRecorder) - MIDI recording
38
+
39
+ ### Musical Knowledge
40
+ - [Musa::Scales](https://rubydoc.info/gems/musa-dsl/Musa/Scales) - Scale systems
41
+ - [Musa::Chords](https://rubydoc.info/gems/musa-dsl/Musa/Chords) - Chord structures
42
+ - [Musa::Datasets](https://rubydoc.info/gems/musa-dsl/Musa/Datasets) - Data structures
43
+
44
+ ### Development
45
+ - [Musa::REPL](https://rubydoc.info/gems/musa-dsl/Musa/REPL) - Live coding server
46
+
47
+ ## Generating Documentation Locally
48
+
49
+ If you want to generate the API documentation locally:
50
+
51
+ ### Install YARD
52
+
53
+ ```bash
54
+ gem install yard
55
+ ```
56
+
57
+ ### Generate Documentation
58
+
59
+ ```bash
60
+ cd /path/to/musa-dsl
61
+ yard doc
62
+ ```
63
+
64
+ This creates documentation in the `doc/` directory (not versioned in git).
65
+
66
+ ### Browse Documentation
67
+
68
+ ```bash
69
+ yard server
70
+ ```
71
+
72
+ Then open http://localhost:8808 in your browser.
73
+
74
+ ## Documentation Coverage
75
+
76
+ Check which code is documented:
77
+
78
+ ```bash
79
+ yard stats --list-undoc
80
+ ```
81
+
82
+ ## See Also
83
+
84
+ - **Conceptual Documentation**: [subsystems/](subsystems/) - Guides and tutorials for each subsystem
85
+ - **Getting Started**: [getting-started/](getting-started/) - Quick start and tutorials
86
+ - **Main Documentation**: [README.md](README.md) - Documentation hub
@@ -0,0 +1,93 @@
1
+ # Quick Start
2
+
3
+ Here's a complete example showcasing the sequencer DSL with multiple melodic lines that interact with each other:
4
+
5
+ ```ruby
6
+ require 'musa-dsl'
7
+ require 'midi-communications'
8
+
9
+ # Include all Musa DSL components
10
+ include Musa::All
11
+
12
+ # Setup MIDI output
13
+ output = MIDICommunications::Output.gets # Interactively select output
14
+
15
+ # Create clock and transport with sequencer
16
+ # 4 beats per bar, 24 ticks per beat
17
+ clock = TimerClock.new(bpm: 120, ticks_per_beat: 24)
18
+ transport = Transport.new(clock, 4, 24)
19
+
20
+ # Create scale for our composition
21
+ scale = Scales.et12[440.0].major[60] # C major starting at middle C
22
+
23
+ # Setup three MIDI voices on different channels
24
+ voices = MIDIVoices.new(
25
+ sequencer: transport.sequencer,
26
+ output: output,
27
+ channels: [0, 1, 2] # Channels for beat, melody, and harmony
28
+ )
29
+ beat_voice = voices.voices[0]
30
+ melody_voice = voices.voices[1]
31
+ harmony_voice = voices.voices[2]
32
+
33
+ # Shared state: current melody note (so harmony can follow)
34
+ current_melody_note = nil
35
+
36
+ # Program the sequencer using DSL
37
+ transport.sequencer.with do
38
+ # Line 1: Beat every 4 bars (for 32 bars total)
39
+ at 1 do
40
+ every 4, duration: 32 do
41
+ beat_voice.note pitch: 36, velocity: 100, duration: 1/8r # Kick drum
42
+ end
43
+ end
44
+
45
+ # Line 2: Ascending melody (bars 1-16) then descending (bars 17-32)
46
+ at 1 do
47
+ # Ascending: move from grade 0 to grade 14 over 16 bars
48
+ move(from: 0, to: 14, duration: 16, every: 1/4r) do |grade|
49
+ pitch = scale[grade.round].pitch
50
+ current_melody_note = grade.round # Share with harmony line
51
+ melody_voice.note pitch: pitch, velocity: 80, duration: 1/8r
52
+ end
53
+ end
54
+
55
+ at 17 do
56
+ # Descending: move from grade 14 to grade 0 over 16 bars
57
+ move(from: 14, to: 0, duration: 16, every: 1/4r) do |grade|
58
+ pitch = scale[grade.round].pitch
59
+ current_melody_note = grade.round # Share with harmony line
60
+ melody_voice.note pitch: pitch, velocity: 80, duration: 1/8r
61
+ end
62
+ end
63
+
64
+ # Line 3: Harmony playing 3rd or 5th every 2 bars (for 32 bars total)
65
+ at 1 do
66
+ use_third = true # Alternate between 3rd and 5th
67
+
68
+ every 2, duration: 32 do
69
+ if current_melody_note
70
+ # Calculate harmony: 3rd is +2 grades, 5th is +4 grades
71
+ harmony_grade = current_melody_note + (use_third ? 2 : 4)
72
+ harmony_pitch = scale[harmony_grade].pitch
73
+
74
+ # Play long note (whole note duration)
75
+ harmony_voice.note pitch: harmony_pitch, velocity: 70, duration: 1
76
+
77
+ # Alternate for next time
78
+ use_third = !use_third
79
+ end
80
+ end
81
+ end
82
+ end
83
+
84
+ # Start playback
85
+ transport.start
86
+ ```
87
+
88
+ This example demonstrates:
89
+ - **Multiple independent voice lines** scheduled in the sequencer
90
+ - **`move` function** to smoothly animate pitch values over time
91
+ - **`every` for repeating events** at regular intervals
92
+ - **Shared state between voices** (harmony follows melody)
93
+ - **Precise timing control** with bars and beats
@@ -0,0 +1,58 @@
1
+ # Tutorial: Not So Quick Start
2
+
3
+ Here's a more detailed example showing the Neuma notation system:
4
+
5
+ ```ruby
6
+ require 'musa-dsl'
7
+ require 'midi-communications'
8
+
9
+ # Include all Musa DSL components
10
+ include Musa::All
11
+
12
+ using Musa::Extension::Neumas
13
+
14
+ # Create a decoder with a major scale
15
+ scale = Scales.et12[440.0].major[60]
16
+ decoder = Decoders::NeumaDecoder.new(
17
+ scale,
18
+ base_duration: 1r # Base duration for explicit duration values
19
+ )
20
+
21
+ # Define a melody using neuma notation with duration and velocity
22
+ # Format: (grade duration velocity)
23
+ # Durations: 1/4 = quarter, 1/2 = half, 1 = whole
24
+ # Velocities: pp, p, mp, mf, f, ff
25
+ melody = "(0 1/4 p) (+2 1/4 mp) (+2 1/4 mf) (-1 1/2 f) " \
26
+ "(0 1/4 mf) (+4 1/4 mp) (+5 1/2 f) (+7 1/4 ff) " \
27
+ "(+5 1/4 f) (+4 1/4 mf) (+2 1/4 mp) (0 1 p)"
28
+
29
+ # Decode to GDV (Grade-Duration-Velocity) events
30
+ gdv_notes = Neumalang.parse(melody, decode_with: decoder)
31
+
32
+ # Convert GDV to PDV (Pitch-Duration-Velocity) for playback
33
+ pdv_notes = gdv_notes.map { |note| note.to_pdv(scale) }
34
+
35
+ # Setup MIDI output and sequencer
36
+ output = MIDICommunications::Output.gets # Interactively select output
37
+
38
+ # Create clock and transport with sequencer
39
+ clock = TimerClock.new(bpm: 120, ticks_per_beat: 24)
40
+ transport = Transport.new(clock, 4, 24)
41
+
42
+ # Setup MIDI voices for output
43
+ voices = MIDIVoices.new(
44
+ sequencer: transport.sequencer,
45
+ output: output,
46
+ channels: [0]
47
+ )
48
+ voice = voices.voices.first
49
+
50
+ # Play notes using sequencer (automatically manages timing)
51
+ sequencer = transport.sequencer
52
+ sequencer.play(pdv_notes) do |note|
53
+ voice.note pitch: note[:pitch], velocity: note[:velocity], duration: note[:duration]
54
+ end
55
+
56
+ # Start playback
57
+ transport.start
58
+ ```