Module: Musa::Datasets::Score::Queriable

Included in:
Musa::Datasets::Score
Defined in:
lib/musa-dsl/datasets/score/queriable.rb

Overview

Query extensions for Score result sets.

Queriable provides mixins that extend query results from Score methods with convenient filtering, grouping, and sorting capabilities.

Two result types are supported:

These modules are applied automatically to query results and provide chainable query methods for further filtering.

The examples below are written against a score holding a chord at 0r and a single note at 1r:

score = Score.new({ 0r => [{ pitch: 60, duration: 1r, velocity: 1 }.extend(PDV),
                           { pitch: 64, duration: 1r, staccato: true }.extend(PDV)],
                    1r => [{ pitch: 67, duration: 1r }.extend(PDV)] })
events = score.at(0r)
results = score.between(0r, 4r)