Module: Musa::Neumas::Decoders
- Defined in:
- lib/musa-dsl/neumas/neuma-decoder.rb,
lib/musa-dsl/neumas/neuma-gdv-decoder.rb,
lib/musa-dsl/neumas/neuma-gdvd-decoder.rb
Overview
Neuma decoder infrastructure for converting neuma notation to musical events.
Provides base classes for decoding neuma notation (a musical representation format) into GDV (Grade-Duration-Velocity) events. The decoder system supports differential decoding where each event is interpreted relative to the previous event.
Architecture Overview
Decoder Hierarchy
ProtoDecoder (abstract)
└── DifferentialDecoder (abstract)
└── Decoder (stateful base)
├── NeumaDecoder (GDV output)
└── NeumaDifferentialDecoder (GDVD output)
Key Concepts
-
Differential Decoding: Each neuma is interpreted relative to previous state
- Grade:
+2means "2 steps up from last note" - Duration:
_2means "double the base duration"
- Grade:
-
Stateful Processing: Decoders maintain
@laststate for differential interpretation -
Subcontexts: Create independent decoder contexts for nested structures
-
Transcription Integration: Optional transcriptor for post-processing (ornaments, etc.)
Processing Pipeline
Neuma Input → process() → apply() → Transcriptor → GDV Output
↓ ↓
Prepare Apply to
attributes last state
Neuma Notation
Neumas are text-based musical notation:
"(0) (+2) (+2) (-1)" # Grade sequence (scale degrees)
"_ _2 _/2" # Duration modifiers
"(0 st) (0 tr) (0 mor)" # Articulation/ornament modifiers, inside the neuma
"(+1_/4)+2_" # Appogiatura (grace note) + main note
Decoders are used by the neuma parsing system:
decoder = Musa::Neumas::Decoders::NeumaDecoder.new(
scale,
base_duration: 1/4r,
transcriptor: transcriptor
)
# Parse and decode neuma string
neumas = "(0) (+2) (+2) (-1) (0)".to_neumas
neumas.each { |neuma| decoder.decode(neuma) }
Defined Under Namespace
Classes: Decoder, DifferentialDecoder, NeumaDecoder, NeumaDifferentialDecoder, ProtoDecoder