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

None

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

census

None

Use python to create census equivalents

cents

interval.ChromaticInterval.cents

cleave

None

kern specific, not needed

context

None

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

None

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

TODO:

Will be “analysis.kkdiss”.

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

None

Use python commands to extract objects with certain properties

fields

None

Not needed.

fin2hum

music21.converter.parse (filename)

Enigma Transport Format did not take off and is rarely used. An Enigma to music21 converter is very low priority. 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

None

Not needed. The spineParser will report errors when parsing.

humsed

None

Not needed.

humver

None

Not needed.

infot

None

Use general purpose python information theory models

iv

intervalVector()

kern

None

Output to Humdrum is not 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

None

not needed; try: for i in range(s.flat.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

None

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

recode

“if”

record

None yet…

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

None

Use re module in Python core, not music21

reihe

TwelveToneRow

rend

None

Not needed. Object properties perform the same function.

rid

None

Not needed. Use getElementsByClass() or getElementsNotOfClass() instead

scramble

None

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

None

Download http://www.mindrot.org/projects/py-editdist/ ; Possibly to be embedded later esp. for different costs…

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

None

see midireset above; -i will not be supported

timebase

None

Not needed. stream.getElementsByOffset() will cover most uses

tonh

german()

trans

.transpose(Interval)

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

urrhythm

To-Do

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

veritas

None

Not needed. use import md5 or other checksum files

vox

None

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

xdelta

None

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

yank

“if”

ydelta

None

Not needed.

Functions

music21.humdrum.parseData(data)

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

music21.humdrum.parseFile(filename)

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