-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
652 lines (519 loc) · 16.1 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
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
## jrp-scores Makefile
##
## Programmer: Craig Stuart Sapp <[email protected]>
## Creation Date: Thu Dec 26 16:48:50 PST 2013
## Last Modified: Mon Dec 30 07:56:34 PST 2013
## Filename: Makefile
## Syntax: GNU makefile
##
## Description:
##
## Makefile for basic processing of JRP meta-repository data files.
## To run this makefile, type (without quotes) one of the following
## commands in a bash terminal (usually the default terminal shell
## in linux, and also /Applications/Utilities/Terminal.app in OS X
## computers).
##
## "make" -- Download any updates to online JRP files.
##
## "make update" -- Download any updates to online JRP files.
##
## "make clean" -- Delete directories of data created by this makefile,
## such as kern-reduced, pdf, and midi which may be found
## in each composer's directory.
##
## "make notitle" -- Make a version of the files where the title is
## removed from the filename.
##
## ===============================================================
##
## Make commands which require Humdrum Extras to be installed:
##
## "make reduced" -- Create reduced-rhythm versions of the data files
## by dividing note durations by 4 so that whole notes become
## quarter notes. This is necessary to use the data with rhythm
## analysis tools in the standard Humdrum Toolkit.
##
## "make notext" -- Remove **text spines from data and store
## output in kern-notext directories for each composer directory.
##
## "make genres" -- Groups work by genre by downloading from kernScores.
##
## "make notearray" -- Create note array files.
##
## ===============================================================
##
## If Humdrum Extras is not installed, you can use web downloaded versions
## of the above make commands:
##
## "make web-pdf" -- Download PDF graphical music scores from the JRP website.
##
## "make web-pdf-notext" -- Download PDFs of graphical music scores from JRP
## website which do not include lyrics.
##
## "make web-reduced" -- Same as "make reduced", but download from the
## JRP website without the need to have Humdrum Extras installed.
##
## "make web-musedata" -- Download MuseData files used to create PDF files.
##
## ===============================================================
##
## Humdrum Toolkit dependent make commands:
##
## "make census" -- Run census -k on all files.
##
##
BINDIR = binx
# targets which don't actually refer to files/directories:
.PHONY :
all:
@echo ''
@echo 'Run this makefile with one of the following labels:'
@echo ' "make update" : download any new changes in online data repository.'
@echo ' "make notitle" : remove titles from filenames.'
@echo ' "make clean" : delete data directories created by this makefile.'
@echo ''
@echo 'Comands requiring Humdrum Extras to be installed.'
@echo ' "make reduced" : create rhythmically reduced kern files.'
@echo ' "make notext" : remove lyrics from scores.'
@echo ' "make genres" : group works by genre.'
@echo ' "make notearray" : create notearray files.'
@echo ''
@echo 'JRP website downloads:'
@echo ' "make web-pdf" : download score PDFs from JRP website.'
@echo ' "make web-pdf-notext" : download score PDFs without lyrics.'
@echo ' "make web-reduced" : download rhythmically reduced kern files.'
@echo ' "make web-musedata" : download MuseData files from JRP website.'
@echo ''
BASEURL = https://josquin.stanford.edu
DATAURL = $(BASEURL)/data?
PDFTYPE = notationwitheditorialwithtext
PDFNOTEXT = notationwitheditorialnotext
REDUCED = humdrumreduced
# If wget is not present on the computer, try using curl since the
# computer is most likely an OS X one:
WGET = `which wget`
ifeq ($(WGET),)
WGET = curl
else
WGET = wget -O-
endif
############################################################################
##
## General make commands:
##
##############################
#
# make update -- Download any changes in the Github repositories for
# each composer.
#
update: github-pull
githubupdate: github-pull
githubpull: github-pull
github-pull:
git pull --recurse-submodules
git submodule update --init --recursive
##############################
#
# 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 [A-Z]??/kern-reduced
-rm -rf [A-Z]??/kern-notext
-rm -rf [A-Z]??/kern-notitle
-rm -rf [A-Z]??/midi
-rm -rf [A-Z]??/pdf
-rm -rf [A-Z]??/pdf-notext
-rm -rf [A-Z]??/notearray
-rm -rf [A-Z]??/musedata
-rm -rf Zma
-rm -rf Zmo
-rm -rf Zso
-rm -rf Joa
-rm -rf Job
##############################
#
# make kern-notext -- Remove titles from filenames and store in a
# directory called kern-notext within each composer directory.
#
notitle: kern-notitle
no-title: kern-notitle
kern-no-title: kern-notitle
kernnotitle: kern-notitle
kern-notitle:
for dir in [A-Z]??/kern; \
do \
echo Processing composer $$dir; \
(cd $$dir; mkdir -p ../kern-notitle; \
for file in *.krn; \
do \
cp $$file ../kern-notitle/`echo $$file | sed 's/-.*krn//'`.krn; \
done \
) \
done
############################################################################
##
## Web downloading related make commands:
##
########################################
#
# make web-midi -- Download PDF files of graphical music notation
# which are generated from the source **kern Humdrum data.
#
midi: web-midi
webmidi: web-midi
web-midi:
for dir in [A-Z]??/kern; \
do \
echo Processing composer $$dir; \
(cd $$dir; mkdir -p ../midi; \
for file in *.krn; \
do \
echo " Downloading MIDI for $$file ..."; \
$(WGET) "$(DATAURL)a=midi&f=$$file" \
> ../midi/`basename $$file .krn`.mid; \
done \
) \
done
########################################
#
# make web-pdf -- Download PDF files of graphical music notation
# which are generated from the source **kern Humdrum data.
#
pdf: web-pdf
webpdf: web-pdf
web-pdf:
for dir in [A-Z]??/kern; \
do \
echo Processing composer $$dir; \
(cd $$dir; mkdir -p ../pdf; \
for file in *.krn; \
do \
echo " Downloading PDF for $$file ..."; \
$(WGET) "$(DATAURL)a=$(PDFTYPE)&f=$$file" \
> ../pdf/`basename $$file .krn`.pdf; \
done \
) \
done
########################################
#
# make web-pdf-notext -- Download PDF files of graphical music notation,
# removing any lyrics from the music.
#
pdfnotext: web-pdf-notext
pdf-notext: web-pdf-notext
webpdfnotext: webpdf-notext
webpdf-notext: web-pdf-notext
web-pdfnotext: web-pdf-notext
web-pdf-notext:
for dir in [A-Z]??/kern; \
do \
echo Processing composer $$dir; \
(cd $$dir; mkdir -p ../pdf-notext; \
for file in *.krn; \
do \
echo " Downloading PDF for $$file ..."; \
$(WGET) "$(DATAURL)a=$(PDFNOTEXT)&f=$$file" \
> ../pdf-notext/`basename $$file .krn`.pdf; \
done \
) \
done
############################################################################
##
## Humdrum Extras related make commands:
##
##############################
#
# make kern-reduced -- Create Humdrum **kern data which does not contain any
# rational reciprocal rhythms. Standard **recip data cannot represent
# non-integer subdivisions of the whole note (excluding augmentation
# dots). The extended reciprocal value for a triplet whole note is
# 3%2 which means that the duration is 2/3rds of a whole note.
#
# After running "make reduced", a subdirectory called "kern-reduced"
# will be generated in each composer directory (parallel to the
# "kern" subdirectories that contain the original Humdrum **kern data
# for the scores.
#
# This label requires that the "rscale" tool from the Humdrum Extras
# package is installed (see https://github.com/craigsapp/humextra).
# If you do not have it installed, instead run "make webreduced").
#
reduced: kern-reduced
kernreduced: kern-reduced
kern-reduced:
for dir in [A-Z]??/kern; \
do \
echo Processing composer $$dir; \
(cd $$dir; mkdir -p ../kern-reduced; \
for file in *.krn; \
do \
rscale -f 1/4 $$file > ../kern-reduced/$$file; \
done \
) \
done
#
# make webreduced -- same result as "make reduced" but download data from
# JRP website (much slower, but no extra software installation is required).
#
webkernreduced: web-kern-reduced
webreduced: web-kern-reduced
web-kernreduced: web-kern-reduced
webkern-reduced: web-kern-reduced
web-kern-reduced:
for dir in [A-Z]??/kern; \
do \
echo Processing composer $$dir; \
(cd $$dir; mkdir -p ../kern-reduced; \
for file in *.krn; \
do \
echo " Downloading file $$file ..."; \
$(WGET) "$(DATAURL)a=$(REDUCED)&f=$$file" \
> ../kern-reduced/$$file; \
done \
) \
done
musedata: web-musedata
webmusedata: web-musedata
web-musedata: web-musedata
web-musedata:
for dir in [A-Z]??/kern; \
do \
echo Processing composer $$dir; \
(cd $$dir; mkdir -p ../musedata; \
for file in *.krn; \
do \
echo " Downloading file $$file ..."; \
$(WGET) "$(DATAURL)a=musedata&f=$$file" \
> ../musedata/`basename $$file .krn`.msd; \
done \
) \
done
##############################
#
# make kern-notext -- Remove **text spines from data and store in
# directory called "kern-notext".
#
kernnotext: kern-notext
kern-notext:
for dir in [A-Z]??/kern; \
do \
echo Processing composer $$dir; \
(cd $$dir; mkdir -p ../kern-notext; \
for file in *.krn; \
do \
extractx -i '**kern' $$file > ../kern-notext/$$file; \
done \
) \
done
##############################
#
# make notearray -- Create note array files. Output is stored in a directory
# called "notearray" in each composer directory.
#
notearray:
for dir in [A-Z]??/kern; \
do \
echo Processing composer $$dir; \
(cd $$dir; mkdir -p ../notearray; \
for file in *.krn; \
do \
notearray -jicale --mel $$file \
| egrep -v 'LO:LB|break.*default' \
> ../notearray/`basename $$file .krn`.dat; \
done \
) \
done
########################################
#
# make web-mp3 -- Download MP3 files generated with timidity
# which are generated from MIDI files of the source **kern Humdrum data.
#
mp3: web-mp3
web-mp3:
$(BINDIR)/download-mp3s
##############################
#
# make genres -- Download scores organized by genres from the
# kernScores website.
#
genres: Zma Zmo Zso
#
# Download files from kernScores related to masses (excluding fragments):
#
zma: Zma
Zma:
mkdir -p Zma/kern; (cd Zma/kern; humsplit h://jrp/Zma)
#
# Download files from kernScores related to motets:
#
zmo: Zmo
Zmo:
mkdir -p Zmo/kern; (cd Zmo/kern; humsplit h://jrp/Zmo)
#
# Download files from kernScores related to songs:
#
zso: Zso
Zso:
mkdir -p Zso/kern; (cd Zso/kern; humsplit h://jrp/Zso)
#
# Download securely attributed works of Josquin:
#
joa: Joa
Joa:
mkdir -p Joa/kern; (cd Joa/kern; humsplit h://jrp/Joa)
#
# Download not securely attributed works of Josquin:
#
job: Job
Job:
mkdir -p Job/kern; (cd Job/kern; humsplit h://jrp/Job)
joab: Joa Job
Joab: Joa Job
############################################################################
##
## standard Humdrum Toolkit related make commands:
##
##############################
##
## make census -- Count notes in all score for all composers.
##
census:
(for i in [A-Z]??/kern; do cat $$i/*.krn; done) | census -k
##############################
##
## make index -- create index for accessing scores from Github.
##
index: humdrum-index jrp-index
humdrum-index:
$(BINDIR)/makehmdindex > index.hmd
worklist: jrp-index
jrp-index:
$(BINDIR)/makeworklist > worklist.json
##############################
##
## make notecounts -- count notes for all files.
##
note-count: notecounts
note-counts: notecounts
notecount: notecounts
nc: notecounts
notecounts:
@$(BINDIR)/getNoteCount
##############################
##
## make notecounts-by-composer -- count notes for all files by composer.
##
note-count-by-composer: notecountsbycomposer
note-counts-by-composer: notecountsbycomposer
note-count-composer: notecountsbycomposer
note-counts-composer: notecountsbycomposer
notecount-composer: notecountsbycomposer
notecountcomposer: notecountsbycomposer
note-count-by-composers: notecountsbycomposer
note-counts-by-composers: notecountsbycomposer
note-count-composers: notecountsbycomposer
note-counts-composers: notecountsbycomposer
notecount-composers: notecountsbycomposer
notecountcomposers: notecountsbycomposer
ncc: notecountsbycomposer
notecountsbycomposer:
@$(BINDIR)/getNoteCount -c
##############################
##
## make filenames -- Extract the full filenames for each work ID.
##
fn: filenames
filename: filenames
filenames: work-id-list
@$(BINDIR)/getWorkIdList | $(BINDIR)/getFilenames
##############################
##
## make filenames-with-ids -- Extract the full filenames for each work ID, but prefix
## filenames with Work IDs column (separated by tabs).
##
fnp: filenames-with-ids
fwi: filenames-with-ids
filename-with-id: filenames-with-ids
filenames-with-ids:
@$(BINDIR)/getWorkIdList | $(BINDIR)/getFilenames -p
##############################
##
## make work-id-list -- Download work ID list from the JRP metatdata works spreadsheet.
##
wid: work-id-list
wil: work-id-list
works-id-list: work-id-list
work-id-list:
@$(BINDIR)/getWorkIdList > work-ids.txt
##############################
##
## make end -- make a list of the encoding dates of each file for
## placement in the "Date added" column of the Works worksheet.
##
end:
@$(BINDIR)/getWorkIdList | $(BINDIR)/getEncodingDate
##############################
##
## make endp -- make a list of the encoding dates of each file for
## placement in the "Date added" column of the Works worksheet.
## Prefix the ID number of the file.
##
endp:
@$(BINDIR)/getWorkIdList | $(BINDIR)/getEncodingDate -p
##############################
##
## make eev -- make a list of the encoding dates of each file for
## placement in the "Date changed" column of the Works worksheet.
##
eev:
@$(BINDIR)/getWorkIdList | $(BINDIR)/getElectronicVersion
##############################
##
## make eevp -- make a list of the electronic version of each file for
## placement in the "Date changed" column of the Works worksheet.
## Prefix the ID number of the file.
##
eevp:
@$(BINDIR)/getWorkIdList | $(BINDIR)/getElectronicVersion -p
##############################
##
## make text -- Check if files have **text spines or note.
## Place in the "Texted" column of the Works worksheet.
##
texted: text
text:
@$(BINDIR)/getWorkIdList | $(BINDIR)/getTexted
##############################
##
## make textp -- Check if files have **text spines or note.
## Place in the "Texted" column of the Works worksheet.
## Prefix the ID number of the file.
##
texted-p: textp
textedp: textp
text-p: textp
textp:
@$(BINDIR)/getWorkIdList | $(BINDIR)/getTexted -p
##############################
##
## make extant-voices -- Count the number of **kern spines in files.
## Place in the "Extant voices" column of the Works worksheet.
##
ev: extant-voices
extant-voice: extant-voices
extant-voices:
@$(BINDIR)/getWorkIdList | $(BINDIR)/getExtantVoices
##############################
##
## make textp -- Check if files have **text spines or note.
## Place in the "Texted" column of the Works worksheet.
## Prefix the ID number of the file.
##
evp: extant-voices-p
extant-voice-p: extant-voices-p
extant-voices-p:
@$(BINDIR)/getWorkIdList | $(BINDIR)/getExtantVoices -p