music21.humdrum

Files in this package deal specifically with making life easier for people who have previously used humdrum or need to import humdrum data (in spines, etc.) into music21.

Humdrum programs and their closest music21 equivalents:

Humdrum

music21

notes

assemble

Not needed

Use python commands to unite objects and s.insert(0, p) to put a part at the beginning of a multipart score.

census

Not needed

Use python to create census equivalents

cents

interval.ChromaticInterval.cents

cleave

Not needed

kern specific, not needed

context

Not needed

Use object.next and object.prev to get some context for many objects and getContextByClass() to find the most recent object of a given type

correl

Not needed

Use numpy.corrcoef() or other, more sophisticated code

deg

Several tools, see Notes

Closest is getScaleDegreeAndAccidentalFromPitch(). See also stream.Stream.analyze(‘key’)

degree

see above for “deg”

diss

Spectral analysis. Out of scope for m21

Would be “analysis.kkdiss” for Kameoka and Kuriyagawa.

ditto

see Notes

chordify() and the offsetTree objects accomplish similar things. Use copy.copy(object) or copy.deepcopy(object) to get another copy of an object

encode

midi.(severaltools)

Multifunction humdrum program. See the midi directory for some replacements. Or for simple conversion, converter.parse and show(‘midi’) do this automatically

extract

Not needed

Use python commands to extract objects with certain properties

fields

Not needed

fin2hum

music21.converter.parse (filename)

Enigma Transport Format did not take off and is rarely used. Software to convert Enigma to MusicXML is available from recordare

freq

see frequency()

hint

see Notes

attachIntervalsBetweenStreams() See alpha.trecento.capua demo to show how it can be done.

hum2fin

.write(‘musicxml’)

Writes to musicXML. A music21 to Enigma converter will not be written (obsolete format)

humdrum

Not needed

The spineParser will report errors when parsing.

humsed

Not needed

humver

Not needed

infot

Not needed

Use general purpose python information theory models

iv

intervalVector()

kern

None

Output to Humdrum is not currently supported

key

analyze() (‘key’)

melac

see Notes

thomassenMelodicAccent(). incorporates humdrum additions for giving accent of the first and last notes.

metpos

1 / obj.beatStrength()

the beatStrength of an object is essentially something similar but inverted. beatStrength handles irregular meters.

midi

.show(‘midi’)

midireset

None

Not needed for now because we do not write directly to MIDI. A midi.allOff() will be needed for direct midi access…

mint

interval.Interval(note1, note2)

Or melodicIntervals()

nf

normalOrder()

Also primeForm(), intervalVector(), forteClass(), getZRelation() etc.

num

Not needed

try: for i in range(len(s.recurse().getElementsByClass(X))) etc.

patt

search.*

see also, for instance, trecento.find_trecento_fragments for an example of a pattern searching module

pattern

search.*

see patt above

pc

pitchClass()

pcset

see Pitch.* and Chord.*

Pitch.pitchClass and pitchClassString, Chord.normalOrder, .primeForm, .intervalVector, etc.

perform

.show(‘midi’)

pf

primeForm()

Also normalOrder() etc.

pitch

nameWithOctave()

proof

Not needed

See humdrum command above; However, something like this could be useful for each encoding format.

recode

“if”

record

via music21j

Not yet determined if it is a good idea to record directly to music21 within music21 – our MIDI to music21 converter should suffice. But note that audioSearch.recording gives recording transcription abilities

regexp

Not needed

Use re module in Python core, not music21

reihe

TwelveToneRow

rend

Not needed

Object properties perform the same function.

rid

Not needed

Use getElementsByClass() or getElementsNotOfClass() instead

scramble

Not needed

Use random module in Python core, not music21. However, see composition tools for some sophisticated scrambling methods

semits

see Notes

ps(), midiNote() or chromatic(). See also music21.pitch.Accidental, esp. the .alter property.

simil

Many implementations

smf

.write(‘midi’)

See midi above

solfa

solfeg()

Use variant=’humdrum’ to get exact humdrum solfeg syllables

solfg

french()

Also .dutch, .italian, .spanish

strophe

assembleLyrics()

You probably won’t need this though

synco

To-Do

Will be “analysis.leeLHiggins” but not yet written – low priority

tacet

Not needed

see midireset above; -i will not be supported

timebase

Not needed

stream.getElementsByOffset() will cover most uses

tonh

german()

trans

.transpose(Interval)

Note: transpose(), Stream: transpose(), etc

urrhythm

To-Do

will be “analysis.jl_urrhythm(Stream)” but not yet written – low priority

veritas

Not needed

Use import md5 or other checksum files

vox

Not needed

len(Chord.pitches()) works for a chord. Stream has many methods for performing this function.

xdelta

Not needed

Use stream[i + 1].property - stream[i].property for similar effects.

yank

“if”

ydelta

Not needed

Functions

music21.humdrum.parseData(data)

shortcut to HumdrumDataCollection. Most users will call converter.parse() instead.

Deprecated v6. – call converter.parse() instead. To be removed v.7

music21.humdrum.parseFile(filename)

shortcut to HumdrumFile. Most users will call converter.parse() instead.

Deprecated v6. – call converter.parse() instead. To be removed v.7