samer@0: ## jrp-scores Makefile samer@0: ## samer@0: ## Programmer: Craig Stuart Sapp samer@0: ## Creation Date: Thu Dec 26 16:48:50 PST 2013 samer@0: ## Last Modified: Mon Dec 30 07:56:34 PST 2013 samer@0: ## Filename: Makefile samer@0: ## Syntax: GNU makefile samer@0: ## samer@0: ## Description: samer@0: ## samer@0: ## Makefile for basic processing of JRP meta-repository data files. samer@0: ## To run this makefile, type (without quotes) one of the following samer@0: ## commands in a bash terminal (usually the default terminal shell samer@0: ## in linux, and also /Applications/Utilities/Terminal.app in OS X samer@0: ## computers). samer@0: ## samer@0: ## "make" -- Download any updates to online JRP files. samer@0: ## samer@0: ## "make update" -- Download any updates to online JRP files. samer@0: ## samer@0: ## "make clean" -- Delete directories of data created by this makefile, samer@0: ## such as kern-reduced, pdf, and midi which may be found samer@0: ## in each composer's directory. samer@0: ## samer@0: ## "make notitle" -- Make a version of the files where the title is samer@0: ## removed from the filename. samer@0: ## samer@0: ## =============================================================== samer@0: ## samer@0: ## Make commands which require Humdrum Extras to be installed: samer@0: ## samer@0: ## "make reduced" -- Create reduced-rhythm versions of the data files samer@0: ## by dividing note durations by 4 so that whole notes become samer@0: ## quarter notes. This is necessary to use the data with rhythm samer@0: ## analysis tools in the standard Humdrum Toolkit. samer@0: ## samer@0: ## "make notext" -- Remove **text spines from data and store samer@0: ## output in kern-notext directories for each composer directory. samer@0: ## samer@0: ## "make genres" -- Groups work by genre by downloading from kernScores. samer@0: ## samer@0: ## "make notearray" -- Create note array files. samer@0: ## samer@0: ## =============================================================== samer@0: ## samer@0: ## If Humdrum Extras is not installed, you can use web downloaded versions samer@0: ## of the above make commands: samer@0: ## samer@0: ## "make web-pdf" -- Download PDF graphical music scores from the JRP website. samer@0: ## samer@0: ## "make web-pdf-notext" -- Download PDFs of graphical music scores from JRP samer@0: ## website which do not include lyrics. samer@0: ## samer@0: ## "make web-reduced" -- Same as "make reduced", but download from the samer@0: ## JRP website without the need to have Humdrum Extras installed. samer@0: ## samer@0: ## "make web-musedata" -- Download MuseData files used to create PDF files. samer@0: ## samer@0: ## =============================================================== samer@0: ## samer@0: ## Humdrum Toolkit dependent make commands: samer@0: ## samer@0: ## "make census" -- Run census -k on all files. samer@0: ## samer@0: ## samer@0: samer@0: samer@0: # targets which don't actually refer to files/directories: samer@0: .PHONY : samer@0: samer@0: all: samer@0: @echo '' samer@0: @echo 'Run this makefile with one of the following labels:' samer@0: @echo ' "make update" : download any new changes in online data repository.' samer@0: @echo ' "make notitle" : remove titles from filenames.' samer@0: @echo ' "make clean" : delete data directories created by this makefile.' samer@0: @echo '' samer@0: @echo 'Comands requiring Humdrum Extras to be installed.' samer@0: @echo ' "make reduced" : create rhythmically reduced kern files.' samer@0: @echo ' "make notext" : remove lyrics from scores.' samer@0: @echo ' "make genres" : group works by genre.' samer@0: @echo ' "make notearray" : create notearray files.' samer@0: @echo '' samer@0: @echo 'JRP website downloads:' samer@0: @echo ' "make web-pdf" : download score PDFs from JRP website.' samer@0: @echo ' "make web-pdf-notext" : download score PDFs without lyrics.' samer@0: @echo ' "make web-reduced" : download rhythmically reduced kern files.' samer@0: @echo ' "make web-musedata" : download MuseData files from JRP website.' samer@0: @echo '' samer@0: samer@0: BASEURL = http://josquin.stanford.edu samer@0: DATAURL = $(BASEURL)/data? samer@0: PDFTYPE = notationwitheditorialwithtext samer@0: PDFNOTEXT = notationwitheditorialnotext samer@0: REDUCED = humdrumreduced samer@0: samer@0: # If wget is not present on the computer, try using curl since the samer@0: # computer is most likely an OS X one: samer@0: samer@0: WGET = `which wget` samer@0: ifeq ($(WGET),) samer@0: WGET = curl samer@0: else samer@0: WGET = wget -O- samer@0: endif samer@0: samer@0: ############################################################################ samer@0: ## samer@0: ## General make commands: samer@0: ## samer@0: samer@0: samer@0: ############################## samer@0: # samer@0: # make update -- Download any changes in the Github repositories for samer@0: # each composer. samer@0: # samer@0: samer@0: update: github-pull samer@0: githubupdate: github-pull samer@0: githubpull: github-pull samer@0: github-pull: samer@0: git pull --recurse-submodules samer@0: git submodule foreach git pull samer@0: samer@0: samer@0: samer@0: ############################## samer@0: # samer@0: # make clean -- Remove all automatically generated or downloaded data files. samer@0: # Make sure that you have not added your own content into the directories samer@0: # in which these derivative files are located; otherwise, these will be samer@0: # deleted as well. samer@0: # samer@0: samer@0: clean: samer@0: -rm -rf [A-Z]??/kern-reduced samer@0: -rm -rf [A-Z]??/kern-notext samer@0: -rm -rf [A-Z]??/kern-notitle samer@0: -rm -rf [A-Z]??/midi samer@0: -rm -rf [A-Z]??/pdf samer@0: -rm -rf [A-Z]??/pdf-notext samer@0: -rm -rf [A-Z]??/notearray samer@0: -rm -rf [A-Z]??/musedata samer@0: -rm -rf Zma samer@0: -rm -rf Zmo samer@0: -rm -rf Zso samer@0: -rm -rf Joa samer@0: -rm -rf Job samer@0: samer@0: samer@0: ############################## samer@0: # samer@0: # make kern-notext -- Remove titles from filenames and store in a samer@0: # directory called kern-notext within each composer directory. samer@0: # samer@0: samer@0: notitle: kern-notitle samer@0: no-title: kern-notitle samer@0: kern-no-title: kern-notitle samer@0: kernnotitle: kern-notitle samer@0: kern-notitle: samer@0: for dir in [A-Z]??/kern; \ samer@0: do \ samer@0: echo Processing composer $$dir; \ samer@0: (cd $$dir; mkdir -p ../kern-notitle; \ samer@0: for file in *.krn; \ samer@0: do \ samer@0: cp $$file ../kern-notitle/`echo $$file | sed 's/-.*krn//'`.krn; \ samer@0: done \ samer@0: ) \ samer@0: done samer@0: samer@0: samer@0: samer@0: ############################################################################ samer@0: ## samer@0: ## Web downloading related make commands: samer@0: ## samer@0: samer@0: samer@0: ######################################## samer@0: # samer@0: # make web-midi -- Download PDF files of graphical music notation samer@0: # which are generated from the source **kern Humdrum data. samer@0: # samer@0: samer@0: midi: web-midi samer@0: webmidi: web-midi samer@0: web-midi: samer@0: for dir in [A-Z]??/kern; \ samer@0: do \ samer@0: echo Processing composer $$dir; \ samer@0: (cd $$dir; mkdir -p ../midi; \ samer@0: for file in *.krn; \ samer@0: do \ samer@0: echo " Downloading MIDI for $$file ..."; \ samer@0: $(WGET) "$(DATAURL)a=midi&f=$$file" \ samer@0: > ../midi/`basename $$file .krn`.mid; \ samer@0: done \ samer@0: ) \ samer@0: done samer@0: samer@0: samer@0: samer@0: ######################################## samer@0: # samer@0: # make web-pdf -- Download PDF files of graphical music notation samer@0: # which are generated from the source **kern Humdrum data. samer@0: # samer@0: samer@0: pdf: web-pdf samer@0: webpdf: web-pdf samer@0: web-pdf: samer@0: for dir in [A-Z]??/kern; \ samer@0: do \ samer@0: echo Processing composer $$dir; \ samer@0: (cd $$dir; mkdir -p ../pdf; \ samer@0: for file in *.krn; \ samer@0: do \ samer@0: echo " Downloading PDF for $$file ..."; \ samer@0: $(WGET) "$(DATAURL)a=$(PDFTYPE)&f=$$file" \ samer@0: > ../pdf/`basename $$file .krn`.pdf; \ samer@0: done \ samer@0: ) \ samer@0: done samer@0: samer@0: samer@0: samer@0: ######################################## samer@0: # samer@0: # make web-pdf-notext -- Download PDF files of graphical music notation, samer@0: # removing any lyrics from the music. samer@0: # samer@0: samer@0: pdfnotext: web-pdf-notext samer@0: pdf-notext: web-pdf-notext samer@0: webpdfnotext: webpdf-notext samer@0: webpdf-notext: web-pdf-notext samer@0: web-pdfnotext: web-pdf-notext samer@0: web-pdf-notext: samer@0: for dir in [A-Z]??/kern; \ samer@0: do \ samer@0: echo Processing composer $$dir; \ samer@0: (cd $$dir; mkdir -p ../pdf-notext; \ samer@0: for file in *.krn; \ samer@0: do \ samer@0: echo " Downloading PDF for $$file ..."; \ samer@0: $(WGET) "$(DATAURL)a=$(PDFNOTEXT)&f=$$file" \ samer@0: > ../pdf-notext/`basename $$file .krn`.pdf; \ samer@0: done \ samer@0: ) \ samer@0: done samer@0: samer@0: samer@0: samer@0: samer@0: samer@0: ############################################################################ samer@0: ## samer@0: ## Humdrum Extras related make commands: samer@0: ## samer@0: samer@0: samer@0: ############################## samer@0: # samer@0: # make kern-reduced -- Create Humdrum **kern data which does not contain any samer@0: # rational reciprocal rhythms. Standard **recip data cannot represent samer@0: # non-integer subdivisions of the whole note (excluding augmentation samer@0: # dots). The extended reciprocal value for a triplet whole note is samer@0: # 3%2 which means that the duration is 2/3rds of a whole note. samer@0: # samer@0: # After running "make reduced", a subdirectory called "kern-reduced" samer@0: # will be generated in each composer directory (parallel to the samer@0: # "kern" subdirectories that contain the original Humdrum **kern data samer@0: # for the scores. samer@0: # samer@0: # This label requires that the "rscale" tool from the Humdrum Extras samer@0: # package is installed (see https://github.com/craigsapp/humextra). samer@0: # If you do not have it installed, instead run "make webreduced"). samer@0: # samer@0: samer@0: reduced: kern-reduced samer@0: kernreduced: kern-reduced samer@0: kern-reduced: samer@0: for dir in [A-Z]??/kern; \ samer@0: do \ samer@0: echo Processing composer $$dir; \ samer@0: (cd $$dir; mkdir -p ../kern-reduced; \ samer@0: for file in *.krn; \ samer@0: do \ samer@0: rscale -f 1/4 $$file > ../kern-reduced/$$file; \ samer@0: done \ samer@0: ) \ samer@0: done samer@0: samer@0: # samer@0: # make webreduced -- same result as "make reduced" but download data from samer@0: # JRP website (much slower, but no extra software installation is required). samer@0: # samer@0: samer@0: webkernreduced: web-kern-reduced samer@0: webreduced: web-kern-reduced samer@0: web-kernreduced: web-kern-reduced samer@0: webkern-reduced: web-kern-reduced samer@0: web-kern-reduced: samer@0: for dir in [A-Z]??/kern; \ samer@0: do \ samer@0: echo Processing composer $$dir; \ samer@0: (cd $$dir; mkdir -p ../kern-reduced; \ samer@0: for file in *.krn; \ samer@0: do \ samer@0: echo " Downloading file $$file ..."; \ samer@0: $(WGET) "$(DATAURL)a=$(REDUCED)&f=$$file" \ samer@0: > ../kern-reduced/$$file; \ samer@0: done \ samer@0: ) \ samer@0: done samer@0: samer@0: musedata: web-musedata samer@0: webmusedata: web-musedata samer@0: web-musedata: web-musedata samer@0: web-musedata: samer@0: for dir in [A-Z]??/kern; \ samer@0: do \ samer@0: echo Processing composer $$dir; \ samer@0: (cd $$dir; mkdir -p ../musedata; \ samer@0: for file in *.krn; \ samer@0: do \ samer@0: echo " Downloading file $$file ..."; \ samer@0: $(WGET) "$(DATAURL)a=musedata&f=$$file" \ samer@0: > ../musedata/`basename $$file .krn`.msd; \ samer@0: done \ samer@0: ) \ samer@0: done samer@0: samer@0: samer@0: samer@0: ############################## samer@0: # samer@0: # make kern-notext -- Remove **text spines from data and store in samer@0: # directory called "kern-notext". samer@0: # samer@0: samer@0: kernnotext: kern-notext samer@0: kern-notext: samer@0: for dir in [A-Z]??/kern; \ samer@0: do \ samer@0: echo Processing composer $$dir; \ samer@0: (cd $$dir; mkdir -p ../kern-notext; \ samer@0: for file in *.krn; \ samer@0: do \ samer@0: extractx -i '**kern' $$file > ../kern-notext/$$file; \ samer@0: done \ samer@0: ) \ samer@0: done samer@0: samer@0: samer@0: samer@0: ############################## samer@0: # samer@0: # make notearray -- Create note array files. Output is stored in a directory samer@0: # called "notearray" in each composer directory. samer@0: # samer@0: samer@0: notearray: samer@0: for dir in [A-Z]??/kern; \ samer@0: do \ samer@0: echo Processing composer $$dir; \ samer@0: (cd $$dir; mkdir -p ../notearray; \ samer@0: for file in *.krn; \ samer@0: do \ samer@0: notearray -jicale --mel $$file \ samer@0: | egrep -v 'LO:LB|break.*default' \ samer@0: > ../notearray/`basename $$file .krn`.dat; \ samer@0: done \ samer@0: ) \ samer@0: done samer@0: samer@0: samer@0: samer@0: ############################## samer@0: # samer@0: # make genres -- Download scores organized by genres from the samer@0: # kernScores website. samer@0: # samer@0: samer@0: genres: Zma Zmo Zso samer@0: samer@0: # samer@0: # Download files from kernScores related to masses (excluding fragments): samer@0: # samer@0: samer@0: zma: Zma samer@0: Zma: samer@0: mkdir -p Zma/kern; (cd Zma/kern; humsplit h://jrp/Zma) samer@0: samer@0: # samer@0: # Download files from kernScores related to motets: samer@0: # samer@0: samer@0: zmo: Zmo samer@0: Zmo: samer@0: mkdir -p Zmo/kern; (cd Zmo/kern; humsplit h://jrp/Zmo) samer@0: samer@0: # samer@0: # Download files from kernScores related to songs: samer@0: # samer@0: samer@0: zso: Zso samer@0: Zso: samer@0: mkdir -p Zso/kern; (cd Zso/kern; humsplit h://jrp/Zso) samer@0: samer@0: # samer@0: # Download securely attributed works of Josquin: samer@0: # samer@0: samer@0: joa: Joa samer@0: Joa: samer@0: mkdir -p Joa/kern; (cd Joa/kern; humsplit h://jrp/Joa) samer@0: samer@0: # samer@0: # Download not securely attributed works of Josquin: samer@0: # samer@0: samer@0: job: Job samer@0: Job: samer@0: mkdir -p Job/kern; (cd Job/kern; humsplit h://jrp/Job) samer@0: samer@0: joab: Joa Job samer@0: Joab: Joa Job samer@0: samer@0: samer@0: ############################################################################ samer@0: ## samer@0: ## standard Humdrum Toolkit related make commands: samer@0: ## samer@0: samer@0: samer@0: ############################## samer@0: # samer@0: # make census -- Count notes in all score for all composers. samer@0: # samer@0: samer@0: census: samer@0: (for i in [A-Z]??/kern; do cat $$i/*.krn; done) | census -k samer@0: samer@0: samer@0: