Module: Musicality
- Defined in:
- lib/musicality/errors.rb,
lib/musicality/version.rb,
lib/musicality/pitch_class.rb,
lib/musicality/pitch_classes.rb,
lib/musicality/project/project.rb,
lib/musicality/notation/model/key.rb,
lib/musicality/project/file_raker.rb,
lib/musicality/notation/model/keys.rb,
lib/musicality/notation/model/link.rb,
lib/musicality/notation/model/mark.rb,
lib/musicality/notation/model/note.rb,
lib/musicality/notation/model/part.rb,
lib/musicality/notation/model/marks.rb,
lib/musicality/notation/model/meter.rb,
lib/musicality/notation/model/pitch.rb,
lib/musicality/notation/model/score.rb,
lib/musicality/project/create_tasks.rb,
lib/musicality/project/file_cleaner.rb,
lib/musicality/notation/model/change.rb,
lib/musicality/notation/model/meters.rb,
lib/musicality/notation/model/pitches.rb,
lib/musicality/notation/model/symbols.rb,
lib/musicality/notation/util/function.rb,
lib/musicality/printing/lilypond/clef.rb,
lib/musicality/project/auditions_task.rb,
lib/musicality/composition/model/scale.rb,
lib/musicality/notation/model/audition.rb,
lib/musicality/notation/model/dynamics.rb,
lib/musicality/composition/model/rhythm.rb,
lib/musicality/notation/util/transition.rb,
lib/musicality/performance/model/attack.rb,
lib/musicality/printing/lilypond/errors.rb,
lib/musicality/composition/dsl/score_dsl.rb,
lib/musicality/notation/model/instrument.rb,
lib/musicality/notation/model/instruments.rb,
lib/musicality/notation/parsing/note_node.rb,
lib/musicality/notation/parsing/parseable.rb,
lib/musicality/performance/midi/midi_util.rb,
lib/musicality/notation/parsing/link_nodes.rb,
lib/musicality/notation/parsing/pitch_node.rb,
lib/musicality/notation/util/interpolation.rb,
lib/musicality/composition/dsl/part_methods.rb,
lib/musicality/notation/model/articulations.rb,
lib/musicality/notation/parsing/key_parsing.rb,
lib/musicality/notation/util/value_computer.rb,
lib/musicality/performance/midi/midi_events.rb,
lib/musicality/performance/model/separation.rb,
lib/musicality/composition/dsl/score_methods.rb,
lib/musicality/composition/model/scale_class.rb,
lib/musicality/notation/parsing/link_parsing.rb,
lib/musicality/notation/parsing/mark_parsing.rb,
lib/musicality/notation/parsing/note_parsing.rb,
lib/musicality/performance/util/optimization.rb,
lib/musicality/composition/model/rhythm_class.rb,
lib/musicality/composition/util/probabilities.rb,
lib/musicality/notation/parsing/meter_parsing.rb,
lib/musicality/notation/parsing/pitch_parsing.rb,
lib/musicality/performance/midi/midi_settings.rb,
lib/musicality/performance/supercollider/node.rb,
lib/musicality/composition/convenience_methods.rb,
lib/musicality/composition/model/scale_classes.rb,
lib/musicality/composition/util/random_sampler.rb,
lib/musicality/notation/parsing/duration_nodes.rb,
lib/musicality/performance/midi/part_sequencer.rb,
lib/musicality/performance/model/note_sequence.rb,
lib/musicality/performance/supercollider/group.rb,
lib/musicality/performance/supercollider/synth.rb,
lib/musicality/printing/lilypond/key_engraving.rb,
lib/musicality/printing/lilypond/part_engraver.rb,
lib/musicality/composition/sequencing/note_fifo.rb,
lib/musicality/composition/sequencing/sequencer.rb,
lib/musicality/composition/util/adding_sequence.rb,
lib/musicality/composition/util/note_generation.rb,
lib/musicality/notation/parsing/segment_parsing.rb,
lib/musicality/notation/util/piecewise_function.rb,
lib/musicality/performance/midi/score_sequencer.rb,
lib/musicality/performance/supercollider/bundle.rb,
lib/musicality/performance/supercollider/server.rb,
lib/musicality/printing/lilypond/note_engraving.rb,
lib/musicality/printing/lilypond/score_engraver.rb,
lib/musicality/composition/sequencing/note_array.rb,
lib/musicality/notation/parsing/duration_parsing.rb,
lib/musicality/performance/midi/score_sequencing.rb,
lib/musicality/performance/supercollider/message.rb,
lib/musicality/printing/lilypond/meter_engraving.rb,
lib/musicality/printing/lilypond/pitch_engraving.rb,
lib/musicality/printing/lilypond/score_engraving.rb,
lib/musicality/composition/util/compound_sequence.rb,
lib/musicality/performance/supercollider/synthdef.rb,
lib/musicality/composition/sequencing/sequenceable.rb,
lib/musicality/composition/util/repeating_sequence.rb,
lib/musicality/notation/conversion/score_converter.rb,
lib/musicality/performance/supercollider/conductor.rb,
lib/musicality/performance/supercollider/performer.rb,
lib/musicality/printing/lilypond/lilypond_settings.rb,
lib/musicality/composition/util/biinfinite_sequence.rb,
lib/musicality/notation/conversion/score_conversion.rb,
lib/musicality/notation/conversion/tempo_conversion.rb,
lib/musicality/notation/parsing/convenience_methods.rb,
lib/musicality/performance/model/duration_functions.rb,
lib/musicality/notation/conversion/change_conversion.rb,
lib/musicality/notation/parsing/articulation_parsing.rb,
lib/musicality/performance/conversion/score_collator.rb,
lib/musicality/performance/supercollider/add_actions.rb,
lib/musicality/performance/supercollider/sc_drum_kits.rb,
lib/musicality/notation/conversion/note_time_converter.rb,
lib/musicality/printing/lilypond/pitch_class_engraving.rb,
lib/musicality/performance/supercollider/synthdefs/bass.rb,
lib/musicality/performance/supercollider/synthdefs/toms.rb,
lib/musicality/performance/supercollider/synthdefs/claps.rb,
lib/musicality/performance/supercollider/synthdefs/kicks.rb,
lib/musicality/performance/supercollider/synthdefs/mario.rb,
lib/musicality/performance/supercollider/synthdefs/other.rb,
lib/musicality/performance/conversion/glissando_converter.rb,
lib/musicality/performance/supercollider/score_conducting.rb,
lib/musicality/performance/supercollider/synthdefs/hihats.rb,
lib/musicality/performance/supercollider/synthdefs/pianos.rb,
lib/musicality/performance/supercollider/synthdefs/snares.rb,
lib/musicality/performance/supercollider/synthdefs/volume.rb,
lib/musicality/performance/conversion/portamento_converter.rb,
lib/musicality/performance/supercollider/synthdef_settings.rb,
lib/musicality/performance/supercollider/synthdefs/cymbals.rb,
lib/musicality/composition/sequencing/drum_machine/drum_kit.rb,
lib/musicality/composition/generation/counterpoint_generator.rb,
lib/musicality/composition/generation/random_rhythm_generator.rb,
lib/musicality/composition/sequencing/drum_machine/drum_parts.rb,
lib/musicality/performance/conversion/note_sequence_extractor.rb,
lib/musicality/notation/parsing/numbers/positive_float_parsing.rb,
lib/musicality/composition/sequencing/drum_machine/drum_machine.rb,
lib/musicality/composition/sequencing/drum_machine/drum_pattern.rb,
lib/musicality/notation/parsing/numbers/positive_integer_parsing.rb,
lib/musicality/notation/parsing/numbers/nonnegative_float_parsing.rb,
lib/musicality/notation/parsing/numbers/positive_rational_parsing.rb,
lib/musicality/notation/parsing/numbers/nonnegative_integer_parsing.rb,
lib/musicality/notation/parsing/numbers/nonnegative_rational_parsing.rb,
lib/musicality/composition/sequencing/drum_machine/drum_patterns/pop_drum_patterns.rb
Defined Under Namespace
Modules: Articulations, Attack, BiInfiniteSequence, Clef, DrumKits, DrumParts, DrumPatterns, DurationFunctions, Dynamics, Instruments, Interpolation, Keys, Marks, Meters, Optimization, Parseable, Parsing, PitchClasses, Pitches, ScaleClasses, Separation, Sequenceable, SuperCollider, Tasks
Classes: AddingSequence, Audition, Change, CompoundSequence, CounterpointGenerator, DecreasingError, DomainError, DrumKit, DrumMachine, DrumPattern, Duration, DurationMismatchError, EmptyError, Function, GlissandoConverter, Instrument, Key, LilypondSettings, Link, Mark, Meter, MidiEvent, MidiSettings, MidiUtil, NegativeError, NonIncreasingError, NonIntegerError, NonPositiveError, NonRationalError, NonZeroError, NotValidError, Note, NoteArray, NoteFIFO, NoteSequence, NoteSequenceExtractor, NoteTimeConverter, ParseError, Part, PartEngraver, PartSequencer, Pitch, PitchClass, PortamentoConverter, Probabilities, Project, RandomRhythmGenerator, RandomSampler, RepeatingSequence, Rhythm, RhythmClass, Scale, ScaleClass, Score, ScoreCollator, ScoreConverter, ScoreDSL, ScoreEngraver, ScoreNotValidError, ScoreSequencer, Segment, Sequencer, Tempo, Transition, ValueComputer
Constant Summary
collapse
- VERSION =
"0.12.2"
- PITCH_CLASSES =
PitchClasses.constants.map { |sym| PitchClasses.const_get(sym) }.sort
- ARTICULATION_SYMBOLS =
These symbols all need to match the notation parsers
{
Articulations::TENUTO => "-",
Articulations::ACCENT => ">",
Articulations::MARCATO => "^",
Articulations::PORTATO => "_",
Articulations::STACCATO => ".",
Articulations::STACCATISSIMO => "!",
}
- LINK_SYMBOLS =
{
Link::Tie => "~",
Link::Glissando => ";",
Link::Portamento => ":",
}
- MARK_SYMBOLS =
{
Mark::Slur::Begin => "(",
Mark::Slur::End => ")",
}
- CLEFS =
[Clef::TREBLE, Clef::ALTO, Clef::BASS, Clef::TENOR]
- UnsupportedDurationError =
Class.new(RuntimeError)
- DRUM_PARTS =
DrumParts.constants.map { |sym| DrumParts.const_get(sym) }
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.dh(*pitch_groups) ⇒ Object
43
44
45
|
# File 'lib/musicality/composition/convenience_methods.rb', line 43
def dh(*pitch_groups)
pitch_groups.map {|pg| Note.dotted_half(pg) }
end
|
.dq(*pitch_groups) ⇒ Object
33
34
35
|
# File 'lib/musicality/composition/convenience_methods.rb', line 33
def dq(*pitch_groups)
pitch_groups.map {|pg| Note.dotted_quarter(pg) }
end
|
.ds(*pitch_groups) ⇒ Object
13
14
15
|
# File 'lib/musicality/composition/convenience_methods.rb', line 13
def ds(*pitch_groups)
pitch_groups.map {|pg| Note.dotted_sixteenth(pg) }
end
|
.e(*pitch_groups) ⇒ Object
18
19
20
|
# File 'lib/musicality/composition/convenience_methods.rb', line 18
def e(*pitch_groups)
pitch_groups.map {|pg| Note.eighth(pg) }
end
|
.h(*pitch_groups) ⇒ Object
38
39
40
|
# File 'lib/musicality/composition/convenience_methods.rb', line 38
def h(*pitch_groups)
pitch_groups.map {|pg| Note.half(pg) }
end
|
.make_note(dur, pitch_group) ⇒ Object
3
4
5
6
7
8
9
|
# File 'lib/musicality/composition/util/note_generation.rb', line 3
def make_note dur, pitch_group
if dur > 0
Musicality::Note.new(dur,pitch_group)
else
Musicality::Note.new(-dur)
end
end
|
.make_notes(rhythm, pitch_groups) ⇒ Object
Whichever is longer, rhythm or pitch_groups, is iterated over once while the smaller will cycle as necessary.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/musicality/composition/util/note_generation.rb', line 14
def make_notes rhythm, pitch_groups
m,n = rhythm.size, pitch_groups.size
raise EmptyError, "rhythm is empty" if m == 0
raise EmptyError, "pitch_groups is empty" if n == 0
if m > n
Array.new(m) do |i|
make_note(rhythm[i],pitch_groups[i % n])
end
else
Array.new(n) do |i|
make_note(rhythm[i % m],pitch_groups[i])
end
end
end
|
.q(*pitch_groups) ⇒ Object
28
29
30
|
# File 'lib/musicality/composition/convenience_methods.rb', line 28
def q(*pitch_groups)
pitch_groups.map {|pg| Note.quarter(pg) }
end
|
.s(*pitch_groups) ⇒ Object
8
9
10
|
# File 'lib/musicality/composition/convenience_methods.rb', line 8
def s(*pitch_groups)
pitch_groups.map {|pg| Note.sixteenth(pg) }
end
|
.transpose(notes, diff) ⇒ Object
3
4
5
|
# File 'lib/musicality/composition/convenience_methods.rb', line 3
def transpose notes, diff
notes.map {|n| n.transpose(diff) }
end
|
.w(*pitch_groups) ⇒ Object
48
49
50
|
# File 'lib/musicality/composition/convenience_methods.rb', line 48
def w(*pitch_groups)
pitch_groups.map {|pg| Note.whole(pg) }
end
|
Instance Method Details
#de(*pitch_groups) ⇒ Object
23
24
25
|
# File 'lib/musicality/composition/convenience_methods.rb', line 23
def de(*pitch_groups)
pitch_groups.map {|pg| Note.dotted_eighth(pg) }
end
|