-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
498 lines (411 loc) · 13.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
## bach-370-chorales Makefile
##
## Programmer: Craig Stuart Sapp <[email protected]>
## Creation Date: Sun May 25 23:27:32 PDT 2014
## Last Modified: Sun May 25 23:27:35 PDT 2014
## Filename: Makefile
## Syntax: GNU makefile
##
## Description:
##
## Makefile for basic processing Humdrum data files for J.S. Bach's
## 4-part chorales.
##
## To run this makefile, type "make" (without quotes) to see a list
## of the makefile actions which can be done.
##
# targets which don't actually refer to files/directories:
.PHONY : abc kernscores lilypond lilypond-gs mei mei-gs midi midi-norep musedata musedata-gs musicxml musicxml-gs notearray pdf-abc pdf-abs-gs pdf-lilypond pdf-lilypond-gs pdf-musedata pdf-musedata-gs
all:
@echo ''
@echo 'Run this makefile with one of the following labels:'
@echo ' "make update" : download any new changes from online repository.'
@echo ' "make clean" : delete data directories created by this makefile.'
@echo ''
@echo 'Commands requiring the Humdrum Toolkit to be installed:'
@echo ' "make census" : run the census command on all files.'
@echo ''
@echo 'Commands requiring Humdrum Extras to be installed.'
@echo ' "make abc" : convert to ABC+ files.'
@echo ' "make abc-gs" : create Grand-Staff ABC+ files.'
@echo ' "make kernscores" : download equivalent from kernscores.'
@echo ' "make mei" : convert to MEI files.'
@echo ' "make mei-gs" : convert to MEI (Grand Staff layout).'
@echo ' "make midi" : convert to MIDI files (full repeats)'
@echo ' "make midi-norep" : convert to MIDI files (no repeats)'
@echo ' "make musedata" : convert to MuseData files.'
@echo ' "make musedata-gs" : create Grand-Staff MuseData files.'
@echo ' "make musicxml" : convert to MusicXML files.'
@echo ' "make musicxml-gs" : convert to Grand-Staff format.'
@echo ' "make notearray" : create notearray files.'
@echo ' "make searchindex" : create themax search index.'
@echo ''
@echo 'Commands requiring other software to be installed.'
@echo ' "make pdf-abc" : convert to PDF files with abcm2ps.'
@echo ' "make pdf-abc-gs" : PDF files in Grand Staff layout.'
@echo ' "make pdf-lilypond": convert to PDF files with lilypond.'
@echo ' "make pdf-lilypond-gs": PDF files in Grand Staff layout.'
@echo ' "make pdf-musedata": convert to PDF files with muse2ps.'
@echo ' "make pdf-musedata-gs": PDF files in Grand Staff layout.'
@echo ''
############################################################################
##
## General make commands:
##
##############################
#
# make update -- Download any changes in the Github repositories for
# each composer. To download for the first time, type:
# git clone https://github.com/craigsapp/bach-370-chorales
#
update: github-pull
pull: github-pull
github: github-pull
githubupdate: github-pull
githubpull: github-pull
github-pull:
git pull
##############################
#
# make clean -- Remove all automatically generated or downloaded data files.
# Make sure that you have not added your own content into the directories
# in which these derivative files are located; otherwise, these will be
# deleted as well.
#
clean:
-rm -rf abc
-rm -rf abc-gs
-rm -rf kernscores
-rm -rf lilypond
-rm -rf lilypond-gs
-rm -rf mei
-rm -rf mei-gs
-rm -rf midi
-rm -rf midi-norep
-rm -rf musedata
-rm -rf musedata-gs
-rm -rf musicxml
-rm -rf musicxml-gs
-rm -rf notearray
-rm -rf pdf-abc
-rm -rf pdf-abc-gs
-rm -rf pdf-lilypond
-rm -rf pdf-lilypond-gs
-rm -rf pdf-musedata
-rm -rf pdf-musedata-gs
-rm searchindex.dat
############################################################################
##
## Humdrum Extras related make commands:
##
##############################
#
# make midi -- Create midi files for chorales, expanding repeats.
#
midi:
mkdir -p midi
for file in kern/*.krn; \
do \
echo Processing $$file; \
thrux $$file | hum2mid --autopan -o midi/`basename $$file .krn`.mid \
--timbres "Bass:i68,v70;Tenor:i70,v75;Alto:i71,v55;Soprano:i74,v80"; \
done
@echo "Created midi directory for converted data"
##############################
#
# make midi-norep -- Create notearray files (useful for processing data
# in matlab). Output is stored in a directory called "notearray".
#
midinorep: midi-norep
midi-norep:
mkdir -p midi-norep
for file in kern/*.krn; \
do \
echo Processing $$file; \
thrux -v norep $$file | hum2mid --autopan -o midi-norep/`basename $$file .krn`.mid \
--timbres "Bass:i68,v70;Tenor:i70,v75;Alto:i71,v55;Soprano:i74,v80"; \
done
@echo "Created midi-norep directory for converted data"
##############################
#
# make notearray -- Create notearray files (useful for processing data
# in matlab). Output is stored in a directory called "notearray".
#
notearray:
mkdir -p notearray
for file in kern/*.krn; \
do \
echo Processing $$file; \
notearray -jicale --mel $$file \
> notearray/`basename $$file .krn`.dat; \
done
@echo "Created notearray directory for converted data"
##############################
#
# make abc -- Create ABC+ files (useful for printing with abcm2ps).
# Output is stored in a directory called "abc".
#
abc:
mkdir -p abc
for file in kern/*.krn; \
do \
echo Processing $$file; \
hum2abc $$file \
> abc/`basename $$file .krn`.abc; \
done
@echo "Created abc directory for converted data"
##############################
#
# make pdf-abc -- Create PDF files with abcm2ps.
# Output is stored in a directory called "pdf-abc".
#
pdf-abc:
mkdir -p pdf-abc
for file in kern/*.krn; \
do \
echo Processing $$file; \
hum2abc $$file | \
abcm2ps - -O - | \
ps2pdf -sPAPERSIZE=letter - \
> pdf-abc/`basename $$file .krn`.pdf; \
done
@echo "Created pdf-abc directory for converted data"
#
# Grand-Staff layout of parts:
#
pdf-abc-gs:
mkdir -p pdf-abc-gs
for file in kern/*.krn; \
do \
echo Processing $$file; \
satb2gs $$file | hum2abc | \
abcm2ps - -O - | \
ps2pdf -sPAPERSIZE=letter - \
> pdf-abc-gs/`basename $$file .krn`.pdf; \
done
@echo "Created pdf-abc-gs directory for converted data"
##############################
#
# make musedata -- Create musedata files (useful for printing with muse2ps).
# Output is stored in a directory called "musedata".
#
musedata:
mkdir -p musedata
for file in kern/*.krn; \
do \
echo Processing $$file; \
autostem $$file | hum2muse \
> musedata/`basename $$file .krn`.msd; \
done
@echo "Created musedata directory for converted data"
musedata-gs:
mkdir -p musedata-gs
for file in kern/*.krn; \
do \
echo Processing $$file; \
satb2gs $$file | autostem | hum2muse \
> musedata-gs/`basename $$file .krn`.msd; \
done
@echo "Created musedata-gs directory for converted data"
##############################
#
# make pdf-musedata -- Create PDF files of graphical notation using muse2ps:
# http://muse2ps.ccarh.org
# https://github.com/musedata/muse2ps
# Output is stored in a directory called "pdf-musedata".
#
# To print with this method, you need to install muse2ps from the above
# website, as well as the GhostScript package. In linux, the ps2pdf
# program can be installed with "yum install ghostscript", or
# "apt-get install ghostscript". In OS X if you have installed homebrew:
# "brew install ghostscript", or "port install ghostscript" if you are
# using MacPorts.
#
pdf-musedata:
mkdir -p pdf-musedata
for file in kern/*.krn; \
do \
echo Processing $$file; \
autostem $$file | hum2muse | muse2ps =z16j \
| ps2pdf -sPAPERSIZE=letter - \
> pdf-musedata/`basename $$file .krn`.pdf; \
done
@echo "Created pdf-musedata directory for converted data"
#
# Grand-Staff layout of parts:
#
pdf-musedata-gs:
mkdir -p pdf-musedata-gs
for file in kern/*.krn; \
do \
echo Processing $$file; \
satb2gs $$file | autostem | hum2muse | muse2ps =z18jv120,140 \
| ps2pdf -sPAPERSIZE=letter - \
> pdf-musedata-gs/`basename $$file .krn`.pdf; \
done
@echo "Created pdf-musedata-gs directory for converted data"
##############################
#
# make mei -- Create MEI files (useful for printing with verovio).
# Output is stored in a directory called "mei".
#
MEI: mei
mei:
mkdir -p mei
for file in kern/*.krn; \
do \
echo Processing $$file; \
autostem $$file | hum2mei \
> mei/`basename $$file .krn`.mei; \
done
@echo "Created mei directory for converted data"
#
# Grand-Staff layout of parts:
#
MEI-gs: mei-gs
mei-gs:
mkdir -p mei-gs
for file in kern/*.krn; \
do \
echo Processing $$file; \
satb2gs $$file | autostem | hum2mei \
> mei-gs/`basename $$file .krn`.mei; \
done
@echo "Created mei-gs directory for converted data"
##############################
#
# make musicxml -- Create MusicXML files, which are useful for processing with
# various programs/systems. Output is stored in a directory called "musicxml".
#
musicxml:
mkdir -p musicxml
for file in kern/*.krn; \
do \
echo Processing $$file; \
autostem $$file | hum2xml \
> musicxml/`basename $$file .krn`.xml; \
done
@echo "Created musicxml directory for converted data"
#
# Grand-Staff layout of parts:
#
musicxml-gs:
mkdir -p musicxml-gs
for file in kern/*.krn; \
do \
echo Processing $$file; \
satb2gs $$file | autostem | hum2xml \
> musicxml-gs/`basename $$file .krn`.xml; \
done
@echo "Created musicxml-gs directory for converted data"
##############################
#
# make lilypond -- Create lilypond files.
# Output is stored in a directory called "lilypond".
#
lilypond:
mkdir -p lilypond
for file in kern/*.krn; \
do \
echo Processing $$file; \
autostem $$file | hum2xml | musicxml2ly - -o- \
> lilypond/`basename $$file .krn`.ly; \
done
@echo "Created lilypond directory for converted data"
#
# Grand-Staff layout of parts:
#
lilypond-gs:
mkdir -p lilypond-gs
for file in kern/*.krn; \
do \
echo Processing $$file; \
satb2gs $$file | autostem | hum2xml | musicxml2ly - -o- \
> lilypond-gs/`basename $$file .krn`.ly; \
done
@echo "Created lilypond-gs directory for converted data"
##############################
#
# make pdf-lilypond -- Create lilypond files.
# Output is stored in a directory called "lilypond".
#
pdf-lilypond:
mkdir -p pdf-lilypond
for file in kern/*.krn; \
do \
echo Processing $$file; \
autostem $$file | hum2xml | musicxml2ly - -o- \
| lilypond -f pdf -o pdf-lilypond/`basename $$file .krn` - ; \
done
@echo "Created pdf-lilypond directory for converted data"
#
# Grand-Staff layout of parts:
#
pdf-lilypond-gs:
mkdir -p pdf-lilypond-gs
for file in kern/*.krn; \
do \
echo Processing $$file; \
satb2gs $$file | autostem | hum2xml | musicxml2ly - -o- \
| lilypond -f pdf -o pdf-lilypond-gs/`basename $$file .krn` -;\
done
@echo "Created pdf-lilypond-gs directory for converted data"
##############################
#
# make kernscores -- Download scores from the kernScores website
# (http://kern.humdrum.org). In theory these are the same as the
# files in the kern directory.
#
kernscores:
mkdir -p kernscores; (cd kernscores; humsplit h://370chorales)
##############################
#
# make searchindex -- Create a themax search index file. The searchindex.dat
# file can be used with the themax program to search for melodic/rhythmic
# patterns in the data, such as searching for two successive rising
# perfect fourths:
#
# Counting the number of occurrences within the data (all voices):
# themax -I "+P4 +P4" searchindex.dat --total
#
# Count the number of matches by each voice separately:
# grep ::1 searchindex.dat | themax -I "+P4 +P4" --count
# (finds 53 matches in the bass part)
# grep ::2 searchindex.dat | themax -I "+P4 +P4" --count
# (finds 9 matches in the tenor part)
# grep ::3 searchindex.dat | themax -I "+P4 +P4" --count
# (finds 0 matches in the alto part)
# grep ::4 searchindex.dat | themax -I "+P4 +P4" --count
# (finds 2 matches in the soprano part)
#
# Counting the number of matches in a file:
# themax -I "+P4 +P4" searchindex.dat --count
#
# Showing the note-number location of the matches:
# themax -I "+P4 +P4" searchindex.dat --loc
#
# Resolve note-number locations to measure/beat locations:
# themax -I "+P4 +P4" searchindex.dat --loc | theloc
#
# Extract measures which contain the matches in a particular chorale:
# tindex kern/chor200.krn | themax -I "+P4 +P4" --loc | theloc --mark | myank --marks
#
#
searchindex:
tindex kern/*.krn > searchindex.dat
############################################################################
##
## standard Humdrum Toolkit related make commands:
##
##############################
#
# make census -- Count notes in all score for all composers.
#
census:
census -k kern/*.krn
#############################################################################
##
## Maintenance
##
krns:
(cd kern; humcat -s chor*.krn > ../all.krns)