Package eu.bandm.music.entities
Class FunctionalPitchModOctave
java.lang.Object
eu.bandm.tscore.base.Entity<E>
eu.bandm.music.entities.PitchModOctave<FunctionalPitchModOctave>
eu.bandm.music.entities.FunctionalPitchModOctave
- All Implemented Interfaces:
PitchIndication
,Translet.Parseable<FunctionalPitchModOctave>
,Comparable<FunctionalPitchModOctave>
public class FunctionalPitchModOctave
extends PitchModOctave<FunctionalPitchModOctave>
implements PitchIndication, Comparable<FunctionalPitchModOctave>
A pitch class mod octave which combines a "natural" note name [dt "Stammton"],
given as an instance of
WhiteKeyModOctave
,
with an alteration (normally in the range -2 to +2).
These instances are in many cases the fundamental means for speficying pitch
inputs, e.g. by parsing source texts. They can be accessed by very different
names in different (human) languages.
Named instances are pre-constructed in the conventional range, from zero to two
accidentals, but this is not a limit for the construction of accidentals and
functional pitches.
Currently only the German language names are supported.
Many languages do not have dedicated names, but append some representation of the accidental
to the name of the white key, like "c#" or "c sharp" in English.-
Field Summary
Modifier and TypeFieldDescriptionprotected final Accidental
The alteration, normally only in the range -2 to 2.(package private) static Map<WhiteKeyModOctave,
List<FunctionalPitchModOctave>> Holds all functional pitches by the white key they are derived fromstatic final EntityCatalog<FunctionalPitchModOctave>
Catalog for all named functional pitches.protected final WhiteKeyModOctave
The white key / "natural" pitch from which this functional pitch is derived.Fields inherited from class eu.bandm.tscore.base.Entity
documentations
-
Constructor Summary
ModifierConstructorDescriptionprotected
FunctionalPitchModOctave
(WhiteKeyModOctave wk, int alt, EntityCatalog<FunctionalPitchModOctave> catalog, String lang, String name) Auxilliary constructor, accidental shift given directly by integer value (normally in the range -2..+2).protected
FunctionalPitchModOctave
(WhiteKeyModOctave wk, Accidental alt, EntityCatalog<FunctionalPitchModOctave> catalog, @Opt String lang, @Opt String name) Full constructor, setting all Parameters. -
Method Summary
Modifier and TypeMethodDescriptionprotected static Translet.Parser<FunctionalPitchModOctave>
_x_upperInitialParser
(String lang, boolean upper) Deliver a parser with lower or upper initial characters, in the given language.int
Technically required, to make "TreeMaps" etc.Return the accidental.int
Return the distance from c in fifth.int
Return the distance from c in half tones.Return the natural key from which this pitch class is derived.lowerInitialParser
(String lang) Deliver a parser with lower initial characters, in the given language.minus
(FunctionalPitchModOctave other) The interval we have to go up from some pitch of the given parameter pitch class to the nearest pitch of this pitch class.toString()
Get any name, preferable in theEntityCatalog.symbolic
language, as defined inMuLi.get(String...)
.upperInitialParser
(String lang) Deliver a parser with upper initial characters, in the given language.static FunctionalPitchModOctave
valueOf
(int wk, int alt) Deliver the functional pitch class derived from the given white key mod octave and the given chromatic shift by accidental.static FunctionalPitchModOctave
valueOf
(WhiteKeyModOctave wk, int alt) Deliver the functional pitch class derived from the given white key mod octave and the given chromatic shift by accidental.static FunctionalPitchModOctave
valueOf
(WhiteKeyModOctave wk, Accidental alt) Deliver the functional pitch class derived from the given white key mod octave and the given chromatic shift by accidental.Methods inherited from class eu.bandm.tscore.base.Entity
addName, dump, dump, getCatalog, getDocumentation, getDocumentation, getDocumentations, getName, getName, getNames, getParser, getParser, setDocumentation, toString
-
Field Details
-
natural
The white key / "natural" pitch from which this functional pitch is derived. -
alteration
The alteration, normally only in the range -2 to 2. -
catalog
Catalog for all named functional pitches. There is no name for e.g. "c###" -
byWhiteKeys
Holds all functional pitches by the white key they are derived from
-
-
Constructor Details
-
FunctionalPitchModOctave
protected FunctionalPitchModOctave(WhiteKeyModOctave wk, int alt, EntityCatalog<FunctionalPitchModOctave> catalog, String lang, String name) Auxilliary constructor, accidental shift given directly by integer value (normally in the range -2..+2). -
FunctionalPitchModOctave
protected FunctionalPitchModOctave(WhiteKeyModOctave wk, Accidental alt, EntityCatalog<FunctionalPitchModOctave> catalog, @Opt @Opt String lang, @Opt @Opt String name) Full constructor, setting all Parameters. If name==null, this is a synthetic pitch class with more than 2 chromatic shifcts ("f triple sharp" / "fisisis") which will not be adressable by a name but only by "valueOf()".- Parameters:
wk
- the white key from which this pitch is derived.alt
- the accidental to apply, may by Accidental.naturalcatalog
- where to store this new Entitylang
- language of the given namename
- given name
-
-
Method Details
-
get_natural
Return the natural key from which this pitch class is derived. -
get_accidental
Return the accidental. Will be Accidental.natural if no shift by accidental applies. -
compareTo
Technically required, to make "TreeMaps" etc. Semantically not very sensible, because very different comparison orders are sensible.- Specified by:
compareTo
in interfaceComparable<FunctionalPitchModOctave>
-
get_halfTonesFromC
public int get_halfTonesFromC()Return the distance from c in half tones. This is a rather arbitrary measure, and is valid only modulo 12. -
get_fifthsFromC
public int get_fifthsFromC()Return the distance from c in fifth. This is a precise measure and not subject to any modulo. -
minus
The interval we have to go up from some pitch of the given parameter pitch class to the nearest pitch of this pitch class. -
lowerInitialParser
Deliver a parser with lower initial characters, in the given language. -
upperInitialParser
Deliver a parser with upper initial characters, in the given language. -
_x_upperInitialParser
protected static Translet.Parser<FunctionalPitchModOctave> _x_upperInitialParser(String lang, boolean upper) Deliver a parser with lower or upper initial characters, in the given language. -
toString
Description copied from class:Entity
Get any name, preferable in theEntityCatalog.symbolic
language, as defined inMuLi.get(String...)
. If this fails, get built-inObject.toString()
conversion result.- Overrides:
toString
in classEntity<FunctionalPitchModOctave>
-
valueOf
Deliver the functional pitch class derived from the given white key mod octave and the given chromatic shift by accidental. If no such instance exists, a new one (synthetic and adressable only by a "valueOf()" method) is created and cached.- Parameters:
wk
- the white key by its distance from c (from 0 to 6)alt
- the alteration, given numerically.
-
valueOf
Deliver the functional pitch class derived from the given white key mod octave and the given chromatic shift by accidental. If no such instance exists, a new one (synthetic and adressable only by a "valueOf()" method) is created and cached.- Parameters:
wk
- the white key, given as an object.alt
- the alteration, given as an object.
-
valueOf
Deliver the functional pitch class derived from the given white key mod octave and the given chromatic shift by accidental.- Parameters:
wk
- the white key given as an object.alt
- the alteration, given numerically.
-