1 of 215

Humdrum Workshop

Music Encoding Conference

19 Juliol 2021, 15:30-18:00

Alacant, Espanya

w/ Craig Stuart Sapp

2 of 215

Humdrum data format

3 of 215

Humdrum data

4C

4c

4cc

=3

T

4 = quarter note

C = C below middle C

cc = C above middle C

= = barline

T = trill (major second)

4 of 215

Start of data (“exclusive interpretations”)

End of data (“spine terminators”) star-dash (not underscore)

**kern = “core” of music

**text = lyric text

5 of 215

Start of data (“exclusive interpretations)

End of data (“spine terminators”) star-dash (not underscore)

**kern = “core” of music

**text = lyric text

“Tandem interpretations”

*clefF4 = bass clef

*clefG2 = treble clef

*M2/4 = 2/4 time signature

Data modifiers

6 of 215

Data rows indicate simultaneities in score

7 of 215

Data columns indicate parts (or streams of other parallel data) in score

8 of 215

9 of 215

http://bit.ly/twinkle-humdrum

10 of 215

Introduction to Humdrum music encoding

  • Summary of music encoding with Humdrum, including interactive examples:

11 of 215

Verovio Humdrum Viewer

http://verovio.humdrum.org

12 of 215

Verovio Humdrum Viewer

Digital score

Graphical score

13 of 215

Hide digital score

  • Press alt-y (or option-y on Macs) to hide digital score (press alt-y again to show digital score)

14 of 215

Hide digital score from URL

15 of 215

Erase the score

  • Press alt-e (or option-e on Macs) to erase digital score.

16 of 215

Erase the score from URL

  • https://verovio.humdrum.org?k=e
  • Suppresses the splash music

17 of 215

Erase the score from the toolbar

  • Or click on the eraser icon in the toolbar to erase the score:

18 of 215

Hello World

Dash (minus sign), not underscore

19 of 215

Hello World (2)

  • Add a final barline

20 of 215

Hello World (3)

  • Add a clef

21 of 215

Hello World (4)

  • Add a fermata

22 of 215

Hello World (5)

  • Add lyrics

One (or more) tabs between columns

23 of 215

Hello World (6)

  • Add dynamics

24 of 215

Editing Humdrum Scores in VHV

25 of 215

Arrow Key Navigation

26 of 215

VHV note navigation

27 of 215

Moving Melodically

  • Click on a note in the score
  • Move forward melodically with the right arrow key
  • Move backward melodically with the left arrow key

Esc key

To exit

editing

28 of 215

Moving Harmonically

  • Click on a note in the score
  • Move higher in the score harmonically with the up arrow key
  • Move lower in the score harmonically with the down arrow key

Esc key

To exit

editing

29 of 215

Graphically

editing pitch/accidentals

30 of 215

Exercise: Editing pitches in Bach chorales

Click on “Scores” in menu then click on “Bach 370 chorales”

Or click on link at top of page to go to the first chorale in the repertory

31 of 215

Humdrum diatonic pitch names

c, d, e, f, g, a, b = Middle C octave (C4-B4 in scientific pitch

notation)

C, D, E, F, G, A, B = Octave lower (C3-B3)

Doubling lower case names raises the octave; doubling upper case names lowers the octave

32 of 215

Special pitch encodings

r = rest

rc = rest + pitch: rest displayed at given pitch height on staff

rr = force display of rest as a whole-measure rest

R = not a real pitch: visual pitch only (percussion notation)

RR = semi-pitched: not real pitch but relative pitch is accurate

(semi-pitched percussion)

33 of 215

Changing pitch graphically

  • Click on a note in the score
  • Move pitch higher by holding down the shift + up arrow key
  • Move pitch lower by holding down the shift + down arrow key
  • Move up a third: 3 shift + up arrow key

34 of 215

Humdrum **kern Accidentals

# = sharp

## = double sharp

- = flat

-- = double flat

#y = invisible sharp #X = visible sharp

natural-sharp (double sharp cancellation)

editorial accidentals

n = natural

35 of 215

Automatic / Explicit display of accidentals

Implicit visual

accidentals

explicit

very

explicit

36 of 215

VHV graphical editing of accidentals

# = toggle sharp

- = toggle flat

2# = double sharp

2- = double flat

n = toggle natural

x = toggle forced display of accidental

i = toggle regular/editorial accidental

37 of 215

Slurs

38 of 215

Adding slurs graphically

  • Click on a note and press the “s” key to add a slur to the next note

39 of 215

Slur over multiple notes

  • Type a number from 2 though 9 to include two through nine following notes in the slur after a selected note

4s

40 of 215

Slur orientation

  • Click on a slur and press “b” to place below, or “a” to place above

b

  • “c” will clear the orientation marker
  • “sift-D” will delete the slur

41 of 215

Moving slur ends

  • Left/right arrow moves the left end of the slur by one note
  • # left/right arrow moves by # notes at a time

  • Shift-left/right arrow moves the right end of the slur by one note
  • # shift-left/right arrow moves the # notes at a time.

N.B.: Graphical editing of slurs cannot be done across spine manipulation boundaries (yet).

42 of 215

Articulations

43 of 215

Articulations

  • Click on a note and type articulation character:
  • ' ⇒ staccato
  • ` ⇒ staccatissimo
  • ; ⇒ fermata
  • ~ ⇒ tenuto
  • ^ ⇒ accent

  • T or t ⇒ Major/minor second trill
  • M or m = Major/minor second mordent
  • W or w = Major or minor second lower mordent

44 of 215

Multiple articulations

  • Type a repetition number before accent character to repeat (2–9).

9~

45 of 215

Pedaling

46 of 215

Adding Pedal-down graphically

  • Click on a note (on either staff) and press the letter “p” (lower case)
  • This will add a pedal interpretation line above the current note’s line

p

p

47 of 215

Adding Pedal-up graphically

  • Click on a note (on either staff) that ends at the same time as the pedal up, then press the “P” key (uppercase).
  • This will add a pedal interpretation line after the current note’s duration

P

48 of 215

Adding Pedal up/down manually

  • Click on line immediately after where you want the pedal line.
  • Press shift-i (I). This will cause an empty interpretation line to be added above the current line.
  • Then type “ped” for a pedal down or “Xped” for a pedal up:

49 of 215

Figured bass

50 of 215

Adding figured bass

51 of 215

Add new column for figured bass

extract -s 1,0,2-4

52 of 215

Fill in figured bass

53 of 215

Harmony

54 of 215

Adding harmony

55 of 215

Adding harmony spine

extract -s 0,1-4

56 of 215

Add **harm data to empty spine

extract -s 0,1-4

57 of 215

Mensural music

58 of 215

Mensural music (**mens)

Embedded

Verovio

option

59 of 215

Ligatures in CMN

60 of 215

Coloration in CMN

61 of 215

Marking / coloring notes

62 of 215

Basic marks

  • Click on a note and press the “@” key to add a mark to a note
  • Default color for marked notes is red:

63 of 215

Multiple marks

64 of 215

Color interpretation

65 of 215

Color spine

66 of 215

Highlighting measures

67 of 215

Scroll to measure on loading

68 of 215

Highlighting one measure

69 of 215

Editing Tips

70 of 215

Freezing Notation

71 of 215

Freeze notation

  • When editing long scores, notation rendering slows down
  • Press alt-f to “freeze” notation rendering
  • Then editing text will be more responsive
  • Press alt-f again to “unfreeze” notation

unfrozen:

frozen:

72 of 215

!!ignore / !!Xignore

73 of 215

Selective rendering

  • Long scores can be selectively edited by adding !!ignore line to regions that should not be rendered, with !!Xignore to cance ignore.

74 of 215

Kernview filter

75 of 215

Editing one part of a full score

76 of 215

Visualizing Layers

77 of 215

Visualizing layer information

  • Press alt-l (lower case “L”) to color layers
  • Black = layer 1, Green = layer 2, Pink = layer 3

78 of 215

Save/Load Buffers

79 of 215

Saving editor contents to local buffer

80 of 215

Loading editor contents from local buffer

81 of 215

Google Spreadsheet

interaction

82 of 215

Spreadsheet toolbar

83 of 215

Upload data and edit

84 of 215

Download edited data

85 of 215

Download invalid data

  • If spreadsheet data is invalid, it will not be downloaded to VHV.

  • Shift-click on download button to force invalid data to be downloaded.

  • Then fix errors in VHV editor.

86 of 215

Filtering

87 of 215

VHV architecture

Ace text editor

Verovio toolkit

Humlib

(filtering & conversion to MEI)

graphic

notation

SVG

MEI

Humdrum

Compile filter (alt-c)

88 of 215

satb2gs

89 of 215

satb2gs filter

satb2gs

Filter active

Click on circle icon

To cycle toolbar to

Filter toolbar

Activate filter

(press enter)

90 of 215

Embedded filters

!!!filter: satb2gs | extract -s 2

!!!filter: transpose -k g

91 of 215

extract

92 of 215

extract filter

93 of 215

Adding lyrics

94 of 215

Add an empty spine (column) to score

extract -s 1-4,0

  • 0 in extract filter’s spine list adds an empty spine
  • Not visible initially (ignored when rendering)

95 of 215

Compiling a filter

  • Type alt-c to compile the filter
  • Filtering output replaced text editor’s contents

New spine appears after compiling

96 of 215

Change data type from **blank to **text

97 of 215

myank

98 of 215

myank: “measure yank”

99 of 215

msearch

100 of 215

msearch: “music search”

101 of 215

msearch (2)

msearch -p cfacfagfef | myank --marks -d

102 of 215

search toolbar

Equivalent to myank --marks -d

Equivalent to msearch -p cfacfagfef

103 of 215

colortriads

104 of 215

colortriads

105 of 215

autostem

106 of 215

autostem

  • Add/remove stems from notes
  • Typically VHV online scores contain no stem directions
  • Only encoded when an exception to stem placement rules
  • Alllow for better output from transpose filter

autostem -r

Removes stems

Apply and compile

107 of 215

autobeam

108 of 215

autobeam

109 of 215

transpose

110 of 215

transpose

transpose -k d

111 of 215

Input data

112 of 215

Humdrum

113 of 215

Loading Humdrum files from URL

114 of 215

Loading Humdrum files from built-in repertories

115 of 215

Drag-and-Drop Humdrum files

116 of 215

MusicXML

117 of 215

MusicXML import

  • Either copy MusicXML text and paste into text editor
  • Or drag-and-drop a MusicXML file onto the VHV page to load MusicXML data.

118 of 215

Convert MusicXML into Humdrum

119 of 215

Humdrum conversion

120 of 215

Outputs

121 of 215

MEI data

122 of 215

Convert Humdrum to MEI data with alt-m

123 of 215

Convert Humdrum to MEI data with alt-m

124 of 215

Click on note to locate MEI source

125 of 215

Save editor contents (to browser downloads)

126 of 215

MusicXML data

127 of 215

Converting and Saving MusicXML data

128 of 215

Viewing MusicXML conversion in MuseScore

129 of 215

PDF files

130 of 215

Saving PDF file

131 of 215

Saving PDF file (2)

132 of 215

Musical excerpts

133 of 215

SVG excerpt

134 of 215

PDF excerpt

135 of 215

Loading into MS Word

136 of 215

VHV online scores

137 of 215

Online scores

Associated

website

Associated repository

138 of 215

List of Mozart piano sonatas

  • Click on “Allegro” to load that movement

  • Or press “esc” key to exit from worklist without loading a score.

139 of 215

Mozart piano sonata movement

Work/

movement

navigator

shift+

left/right

arrow keys

are shortcuts

Shift-up

returns to

worklist

140 of 215

View source scan

View > Show source scan

Keyboard shortcut: alt-p

141 of 215

Where digital scores are stored

142 of 215

Keyscapes

143 of 215

Saving to HTML in VHV

144 of 215

Save as HTML

145 of 215

Open HTML file in web browser

146 of 215

Humdrum Notation Plugin

16:30

147 of 215

Basic verovio usage

<html>

<head>

<script src="http://verovio-script.humdrum.org/scripts/verovio-toolkit-wasm.js"></script>

</head>

<body>

<h1> Musical Example</h2>

<div id="notation"></div>

<script type="text/x-html" id="my-score">

**kern

*clefG2

*M4/

1c;

==

*-

</script>

<script>

let tk;

document.addEventListener("DOMContentLoaded", (event) => {

Module.onRuntimeInitialized = async _ => {

tk = new verovio.toolkit();

let humdrumdata = document.querySelector("#my-score")

.textContent.replace(/^\s+/, "");;

let options = {

scale: 120,

pageWidth: 3200,

pageHeight: 60000,

adjustPageHeight: 1,

spacingSystem: 18,

evenNoteSpacing: 1,

};

let element = document.querySelector("#notation");

let svg = tk.renderData(humdrumdata, options);

element.innerHTML = svg;

}});

</script>

</body>

</html>

148 of 215

Web worker

User interface thread

Web worker thread

Verovio toolkit

Input data

Output SVG

149 of 215

Humdrum Notation Plugin

  • After editing music in VHV, what to do with it?

  • Humdrum files typically used off-line for computational analysis.

  • Humdrum Notation Plugin allows you to easily display music notation on your own website

  • Javascript interface to verovio

150 of 215

Embedding data directly into webpage

<html>

<head>

<title>My Score</title>

<script src="https://plugin.humdrum.org/scripts/humdrum-notation-plugin-worker.js">

</script>

</head>

<body>

<h1>A musical example:</h1>

<script>

displayHumdrum({

source: "my-score",

autoResize: "true",

header: "true"

});

</script>

<script type="text/x-humdrum" id="my-score">

**kern

*clefG2

*M4/4

1c;

==

*-</script>

</body>

</html>

151 of 215

Source code for webpage

<html>

<head>

<title>My Score</title>

<script src="https://plugin.humdrum.org/scripts/humdrum-notation-plugin-worker.js">

</script>

</head>

<body>

<h1>A musical example:</h1>

<script>

displayHumdrum({

source: "my-score",

autoResize: "true",

header: "true"

});

</script>

<script type="text/x-humdrum" id="my-score">

**kern

*clefG2

*M4/4

1c;

==

*-</script>

</body>

</html>

embedded Humdrum

data

Find Humdrum data script labeled “example” and create notation (inserted at location of Humdrum script element).

Humdrum Notation Plugin script

152 of 215

Loading data from URL

<html>

<head>

<title>My Score</title>

<script src="https://plugin.humdrum.org/scripts/humdrum-notation-plugin-worker.js">

</script>

</head>

<body>

<h1>Another musical example:</h1>

<script>

displayHumdrum({

source: "my-score",

scale: 25,

url: "https://raw.githubusercontent.com/craigsapp/mozart-piano-sonatas/master/kern/sonata06-3c.krn"

});

</script>

<script type="text/x-humdrum" id="my-score"></script>

</body>

</html>

Note: no data since it comes from URL

153 of 215

Passing filter parameters

<script>

displayHumdrum({

source: "example3",

scale: 25,

uri: "github://craigsapp/bach-370-chorales/kern/chor001.krn",

filter: "extract -k4 | transpose -kc | msearch -q gfedc"

});

</script>

154 of 215

Command-line Tools

17:00

155 of 215

Installing command-line tools

git clone https://github.com/humdrum-tools/humdrum-tools

cd humdrum-tools

make update

make

make install

cd $(which cint | sed s/humextra.*//)

make update

make

Update software at a later date:

156 of 215

Downloading repertories

mkdir chorales

cd chorales

humsplit h://chorales

ls

157 of 215

How many notes

notecount *.krn

How many notes with written repetitions?

84666

thrux *.krn | notecount

99388

158 of 215

Most common sonorities

159 of 215

Most common sonorities (2)

tntype *.krn ⇒ Forte-number sonorities (non-inverted)

ridx -H ⇒ Remove Humdrum data structure elements

sortcount -p ⇒ sort and convert to percentages

head -n 20 ⇒ list top 20 sonorities

tntype *.krn | ridx -H | sortcount -p | head -n 20

160 of 215

Most common melodic intervals in Bach chorales

cat *.krn | mint | serialize | ridx -H | grep -v [r[] | sortcount -v --sort interval -T "Chorale melodic intervals" -x interval > /tmp/analysis.html

161 of 215

Most common melodic intervals in soprano part

cat *.krn | extractx -s 4 | mint | serialize | ridx -H | grep -v [r[] | sortcount -v --sort interval -T "soprano melodic intervals" -x interval > /tmp/analysis.html

162 of 215

Dissonance labels

163 of 215

Label frequencies for all works in database

  • dissonant ⇒ do dissonance analysis
  • extractx -i cdata ⇒ extract analysis data from full file
  • serialize ⇒ parwise arrangement of data
  • ridx -H ⇒ remove Humdrum file structure from data
  • grep -v g ⇒ remove suspension agents
  • grep -v “^$” ⇒ remove some blank lines
  • sortcount -pv ⇒ create vega-lite histograms by percentages

164 of 215

Dissonance frequencies in JRP scores

165 of 215

Humdrum-based

websites

17:15

166 of 215

Musical Dice Game

167 of 215

Musical Dice Game

  • Interactive notation generation

  • Single-page website demonstrating Javascript manipulation of Humdrum scores

168 of 215

Musical Dice source code

HTML for website

Hosted with Github Pages

169 of 215

Bach chorales

170 of 215

Example use of Humdrum Notation Plugin

171 of 215

On-demand notation rendering

Chorale #2

displays

after

clicking

on its title:

notation generated on demand

172 of 215

Chorale typesetting page

  • Dynamic typesetting page implemented with JavaScript and utilizing Humlib filters & verovio options.

  • Notation rendered with verovio using Humdrum Nontation Plugin as a front-end.

  • Source code for page:

173 of 215

Create musical examples for your own webpages

  • Copy & paste text in black box for dynamically generated notation.

  • Or download SVG image for static notation.

Notice filter to extract parts

174 of 215

Humdrum data file for website

  • Same data as Bach Chorales on VHV (http://doc.verovio.humdrum.org/repertory/bach-chorales)
  • Single file for all 370 chorales for efficient downloading
  • File size: 884 KB (88 KB compressed)

175 of 215

Tasso in Music Project

176 of 215

Tasso in Music Project website

  • c. 800 musical settings of Tasso poetry by various composers in 16th & 17th centuries.

  • Music notation typeset dynamically (PDF and in webpages) from Humdrum data using verovio.

  • Uses Github Pages and Jekyll

177 of 215

Musical settings by poem

  • Scores organized by poem

  • Up to 26 compositions setting the same poem

178 of 215

Tasso work pages

  • Interactive score created with Humdrum digital scores and rendered with verovio

  • Download of digital scores in various formats (Humdrum, MEI, MIDI, MP3, PDF, MusicXML, Musedata).

  • Critical notes, poem, and translations.

179 of 215

Tasso poetry variants

  • Interactive comparison for literary sources (prints and manuscripts)

  • Source data for webpage:

https://github.com/TassoInMusicProject/tasso-website/blob/gh-pages/data/variorum/Trm0047.aton

  • Compiled TEI files:

https://github.com/TassoInMusicProject/variorum/tree/808630b29678099288c54acce161013363614d5a/data/Trm0047

180 of 215

TiMP editing in VHV

181 of 215

TiMP digital scores on Github

182 of 215

TiMP metadata for website

@@BEGIN: SETTING

@CATALOGNUM: Trm0164a

@RIMETITLE: Vuol che l'ami costei, ma duro freno

@SOLERTI: 164

@COMPOSER: Barbarino, Bartolomeo

@PRINCEPSTITLE: Canzonette a una e due

@PRINCEPSLOC: Venetia

@NORMLOC: Venice

@NORMPUB: Amadino

@NORMPUBSHORT: Amadino

@PRINCEPSPUB: Amadino

@PRINCEPSYEAR: 1616

@PRINCEPSRISM: B 877

@OVOICES: 1+bc

@EXTANTVOICES: 1+bc

@PARTBOOKS:

@EXTPARTBOOKS:

@OCLEFS: C1,F4

@OMENSURATION: C

@OKEYSIG: b-

@FINAL: F

@TIMPEDITOR: Schleuse, Paul

@YOUTUBE: c6vgpu_A5AI

@YOUTUBESTART: 14

@YOUTUBEEND: 212

@NOTE:

@@END: SETTING

183 of 215

Other web resources used to create TiMP website

Jekyll is a static templating system for creating webpages hosted on a server (such as Github Pages). Handlebars is a javascript templating system used to create dynamic content from within a webpage (load data from server, then create HTML content to display data).

Interface to JSON which allows comments within data and easier encoding markup.

Used to create data plots within website

184 of 215

Josquin Research Project

185 of 215

Josquin Research Project

  • Digital scores of music from 1480–1520 era
  • Analytic edition

186 of 215

Josquin Research Project census page

  • 800+ works

  • 1.2 million notes

  • 80 hours of music

  • 6000 pages

187 of 215

Work pages

Data conversions

Vocal ranges

Work-level searching

Work-level analyses

188 of 215

Digital scores on Github

189 of 215

JRP scores in VHV

190 of 215

Chopin First Editions

191 of 215

Chopin First Editions

192 of 215

Work pages

193 of 215

Dynamic layout controls

194 of 215

Musical content searching

:Repertory-level searching

Work-level searching:

195 of 215

Musical content searching (2)

196 of 215

Automatic variant analysis

Kistner

Wessel

Schlesinger

197 of 215

Humdiff filter

198 of 215

Chooser filter

199 of 215

Chopin First Editions Github repository

200 of 215

Polyrhythm Project

201 of 215

Polyrhythm Project Website

202 of 215

Polyrhythm Project example pages

Metadata

Humdrum/Verovio notation

203 of 215

Analytic markup

204 of 215

Polyrhythm project digital scores in VHV

205 of 215

Analysis in VHV

206 of 215

Polyrhythm project digital scores on Github

207 of 215

Ratioscore

208 of 215

Specialized music representations in Humdrum

209 of 215

Specialized music representations in Humdrum

210 of 215

Humdrum notes

211 of 215

Humdrum documentation website

212 of 215

VHV documentation website

213 of 215

VHV issues (report bugs and request features)

214 of 215

**HUG: Humdrum Uers’s Group

215 of 215

Humlib: C++ Humdrum data parser