Module: HeadMusic::Notation::ABC

Defined in:
lib/head_music/notation/abc.rb,
lib/head_music/notation/abc/token.rb,
lib/head_music/notation/abc/parser.rb,
lib/head_music/notation/abc/writer.rb,
lib/head_music/notation/abc/preflight.rb,
lib/head_music/notation/abc/body_lexer.rb,
lib/head_music/notation/abc/voice_state.rb,
lib/head_music/notation/abc/chord_reader.rb,
lib/head_music/notation/abc/pitch_writer.rb,
lib/head_music/notation/abc/volta_passes.rb,
lib/head_music/notation/abc/chord_scanner.rb,
lib/head_music/notation/abc/pitch_builder.rb,
lib/head_music/notation/abc/repeat_tagger.rb,
lib/head_music/notation/abc/voice_registry.rb,
lib/head_music/notation/abc/duration_writer.rb,
lib/head_music/notation/abc/duration_resolver.rb

Overview

Parses ABC notation into HeadMusic::Content flows

Defined Under Namespace

Classes: BodyLexer, BookParser, ChordReader, ChordScanner, DurationResolver, DurationWriter, Header, KeyMapper, ParseError, Parser, PitchBuilder, PitchWriter, Preflight, RenderError, RepeatTagger, Token, UnsupportedFeatureError, VoiceRegistry, VoiceState, VoltaPasses, Writer

Class Method Summary collapse

Class Method Details

.parse(abc_string) ⇒ Object

Parses exactly one tune. Raises when the input holds more than one.



4
5
6
# File 'lib/head_music/notation/abc.rb', line 4

def self.parse(abc_string)
  Parser.new(abc_string).flow
end

.parse_book(abc_string) ⇒ Object

Parses a tune book — one or more blank-line-separated tunes.



9
10
11
# File 'lib/head_music/notation/abc.rb', line 9

def self.parse_book(abc_string)
  BookParser.new(abc_string).flows
end

.render(flow, **options) ⇒ Object

transposed: says the flow's pitches are already the written ones, so that K: names the key its player reads.



15
16
17
# File 'lib/head_music/notation/abc.rb', line 15

def self.render(flow, **options)
  Writer.new(flow, **options).to_s
end