Package eu.bandm.music.entities
Class RunningOctaveCollector<P extends PitchModOctave & Comparable<P>>
java.lang.Object
eu.bandm.music.entities.RunningOctaveCollector<P>
- Type Parameters:
P
- the type of the pitch classes.
Collects and distributes the octave information over a sequence of incomplete
pitch information.
"Running octave" is a principle for the convenience of noatation, well proven
in musictex, musixtex, lilypond etc.
It means that partial information which gives only a pitch class means
the concrete pitch with the minimal distance to its predecessor.
Ergo only functional intervals up to a fourth are generated in this case.
For its definition/realization, it requires a notion of "nearest" pitch w.r.t a particular pitch of the predecessor and a particular pitchModOctave. The CWN convention, as implemened here, requires that there are "WhiteKeys" as the basis for notation, and "nearest" is defined on these.
The input grammar accepted by this pre-processor is
pitch ::= (octUp | octDown)? pitchModOctave | pitchModOctave octaveRegisterUsage: Create an instance, apply the
Translet.Parser
resturned by
parser()
, and finally call reify(MessageReceiver,Iterable,Map)
.-
Field Summary
Modifier and TypeFieldDescriptionprotected final Map<Event,
OctaveRegister> Intermediate store between parsing and reification: explicit changes of octave.Intermediate store between parsing and reification: explicit additional octave jump.(package private) final String
Construction parameter: inut string meaning "one octave lower than the min distance."(package private) final String
Construction parameter: inut string meaning "one octave higher than the min distance."(package private) final Translet.Parser<OctaveRegister>
Construction parameter: parser for an explicit octave register.(package private) final Translet.Parser<P>
Construction parameter: parser for the pitch class.Intermediate store between parsing and reification: pitches by events.(package private) final Function<P,
WhiteKeyModOctave> Function to get from the pitch type (which is a parameter) to a whitekey. -
Constructor Summary
ConstructorDescriptionRunningOctaveCollector
(Translet.Parser<P> parserPitchClass, Translet.Parser<OctaveRegister> parserOctaveRegister, String octDown, String octUp, Function<P, WhiteKeyModOctave> stripAlterations) Only constructor, set all parameters. -
Method Summary
Modifier and TypeMethodDescriptionfinal Translet.Parser<?>
parser()
Return the parser.void
reify
(MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>> msg, Iterable<Event> evs, Map<Event, PitchAndOctave<OctaveRegister, P>> result) Steps through the sequence of events "evs" and combines the already parsed pitch and the (partial) "explicit octave" and "jump" information into the combined data type, taking the "shortest notational distance" as a default.
-
Field Details
-
parserPitchClass
Construction parameter: parser for the pitch class. -
parserOctaveRegister
Construction parameter: parser for an explicit octave register. -
octUp
Construction parameter: inut string meaning "one octave higher than the min distance." -
octDown
Construction parameter: inut string meaning "one octave lower than the min distance." -
stripAlterations
Function to get from the pitch type (which is a parameter) to a whitekey. -
pitches
Intermediate store between parsing and reification: pitches by events. -
explicitOcts
Intermediate store between parsing and reification: explicit changes of octave. -
jumps
Intermediate store between parsing and reification: explicit additional octave jump.
-
-
Constructor Details
-
RunningOctaveCollector
public RunningOctaveCollector(Translet.Parser<P> parserPitchClass, Translet.Parser<OctaveRegister> parserOctaveRegister, String octDown, String octUp, Function<P, WhiteKeyModOctave> stripAlterations) Only constructor, set all parameters.
-
-
Method Details
-
parser
Return the parser. Must be applied to the parameter track of the voice, and stores the results in the intermediate storages for a subsequent call ofreify(MessageReceiver,Iterable,Map)
-
reify
public void reify(MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>> msg, Iterable<Event> evs, Map<Event, PitchAndOctave<OctaveRegister, P>> result) Steps through the sequence of events "evs" and combines the already parsed pitch and the (partial) "explicit octave" and "jump" information into the combined data type, taking the "shortest notational distance" as a default.
-