[Open all] [Close all] [Open all source code] [Close all source code]

The Convert class manages data conversions for the humlib library.

 

Convert Public functions

encodeXml — Encode a string for XML printing.
getGcd — Return the Greatest Common Divisor of two numbers.
getHumNumAttributes — Returns XML attributes for a HumNum number.
getKernPitchAttributes — // Convert::getKernPitchAttributes -- pc = pitch class numacc = numeric accidental (-1=flat, 0=natural, 1=sharp) explicit = force showing of accidental oct = octave number (middle C = 4) base40 = base-40 enumeration of pitch (valid if abs(numacc) <= 2)
getKernSlurEndElisionLevel — Returns the number of '&' characters before the last ')' character in a kern token.
getKernSlurStartElisionLevel — Returns the number of '&' characters before the last '(' character in a kern token.
getLcm — Return the Least Common Multiple of a list of numbers.
hasKernSlurEnd — Returns true if the input string has a '('.
hasKernSlurStart — Returns true if the input string has a '('.
isKernNote — Returns true if the input string represents a **kern note (i.
isKernNoteAttack — Returns true if the input string represents a **kern note (not null or rest) and is not a secondary tied note.
isKernRest — Returns true if the input string represents a **kern rest.
isKernSecondaryTiedNote — Returns true if the input string represents a **kern note (i.
kernToAccidentalCount — Convert a kern token into a count of accidentals in the first subtoken.
kernToBase12 — Convert **kern pitch to a base-12 integer.
kernToBase12PC — Convert **kern pitch to a base-12 pitch-class.
kernToBase40 — Convert **kern pitch to a base-40 integer.
kernToBase40PC — Convert **kern pitch to a base-40 pitch class.
kernToBase7 — Convert **kern pitch to a base-7 integer.
kernToDiatonicLC — Similar to kernToDiatonicUC, but the returned pitch name is lower case.
kernToDiatonicPC — Convert a kern token into a diatonic note pitch-class where 0="C", 1="D", ..., 6="B".
kernToDiatonicUC — Convert a kern token into a diatonic note pitch-class.
kernToMidiNoteNumber — Convert **kern to MIDI note number (middle C = 60).
kernToOctaveNumber — Convert a kern token into an octave number.
kernToScientificPitch — Convert a **kern pitch to ScientificPitch notation, which is the diatonic letter name, followed by a possible accidental, then an optional separator string, and finally the octave number.
pitchToWbh — Convert a given diatonic pitch class and accidental adjustment to an integer.
recipToDuration — Convert **recip rhythmic values into rational number durations in terms of quarter notes.
repeatString — Returns a string which repeats the given pattern by the given count.
replaceOccurrences — Similar to s// regular expressions operator.
splitString — Splits a string into a list of strings separated by the given character.
trimWhiteSpace — remove spaces, tabs and/or newlines from the beginning and end of input string.