java.lang.Object
provided.abcMusic.utils.ABCUtil
Singleton utility class that has methods for parsing,
reading file content and getting the list of instruments.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFileContents(String filename)
Returns the contents of a text file, e.g.Get an array of all the available instruments as ABCInstruments where the instrument's value is the MIDI instrument numberdouble
parseFraction(String frac)
Return the evaluation of a string "a/b".double
parseTempo(String tempo, double defaultNotesPerQuarterNote)
Return the tempo given by the input string.
-
Field Details
-
logger
logger to use -
Singleton
Singleton instance of the class
-
-
Constructor Details
-
ABCUtil
private ABCUtil()private constructor
-
-
Method Details
-
parseFraction
Return the evaluation of a string "a/b".- Parameters:
frac
- - a string containing a fraction- Returns:
- - the result of evaluating the fraction
-
parseTempo
Return the tempo given by the input string. The returned value is in the units of quarter notes per minute as is required to configure the MIDI sequence player.
Accepts a tempo in terms of default notes per minute or "a/b=tempo" (a/b notes per minute = default notes per minute where a/b is the default note).
In order to do the conversion to to quarter notes per minute, the value of quarter notes per default note is required.- Parameters:
tempo
- - tempo represented as a string as default note per minute or a particular a/b note per minutedefaultNotesPerQuarterNote
- - default notes per quarter note- Returns:
- - the tempo indicated by the string in quarter notes per minute
-
getFileContents
Returns the contents of a text file, e.g. an abc file, as a single string.- Parameters:
filename
- the name of the file with respect to the default package, where "/" refers to the default package, e.g. a file in the "data" package would "/data/myfile.abc"- Returns:
- the contents of the file
-
getInstruments
Get an array of all the available instruments as ABCInstruments where the instrument's value is the MIDI instrument number- Returns:
- an array of ABCInstruments
-