diff --git a/Music/BoosterMusic/AmazingGraceMid.abc b/Music/BoosterMusic/AmazingGraceMid.abc index 2f88058..ea1a663 100644 --- a/Music/BoosterMusic/AmazingGraceMid.abc +++ b/Music/BoosterMusic/AmazingGraceMid.abc @@ -4,7 +4,6 @@ Q: "English Waltz " 87 C: Traditional M: 3/4 % time signature L: 1/4 % default length -%%staves {RH LH} V: 1 clef=treble %%MIDI channel 4 %%MIDI program 1 4 diff --git a/Music/BoosterMusic/AmazingGrace.mma b/Music/BoosterMusic/AmazingGraceMid.mma similarity index 100% rename from Music/BoosterMusic/AmazingGrace.mma rename to Music/BoosterMusic/AmazingGraceMid.mma diff --git a/Music/Makefile b/Music/Makefile new file mode 100644 index 0000000..5870d5e --- /dev/null +++ b/Music/Makefile @@ -0,0 +1,41 @@ +dirs:= BeginnerCourse BoosterMusic +output:= PianoBoosterMusic +ABCs:=$(foreach dir, $(dirs), $(wildcard $(dir)/*.abc)) +MMAs:=$(filter-out $(foreach dir, $(dirs), $(wildcard $(dir)/*Lib.mma)),$(foreach dir, $(dirs), $(wildcard $(dir)/*.mma))) +MIDs:=$(foreach mma, $(MMAs:.mma=.mid), $(output)/$(mma)) +SOLs:=$(foreach abc, $(ABCs:.abc=.solo.mid), $(abc)) +SVGs:=$(foreach abc, $(ABCs:.abc=001.svg), $(output)/$(abc)) +MDs=:$(ABCs:.abc=_en.md) + +all: $(output)/README.html + +%.html: %.md + markdown $< > $@ + +$(output)/README.md: $(SVGs) $(MIDs) + cat music.md.start > $@ + sh -c '$(foreach mma, $(MMAs), \ + echo "## $(basename $(notdir $(mma)))"; \ + echo "![score]($(basename $(mma))001.svg)"; \ + echo ""; \ + [ -f "$(basename $(mma))_en.md" ] && cat "$(basename $(mma))_en.md" || true ; \ + echo "[midi file]($(basename $(mma)).mid)" ; \ + )' >> "$@" + cat music.md.end >> $@ + +$(output)/%001.svg: %.abc + $(foreach dir, $(dirs), mkdir -p $(output)/$(dir)) + abcm2ps -g -s 0.9 -c "$<" -O "$(output)/$(basename $<).svg" + +%.solo.mid: %.abc + abc2midi "$<" -o "$@" -RS + +$(output)/%.mid: %.mma $(SOLs) + $(foreach dir, $(dirs), mkdir -p $(output)/$(dir)) + sh -c 'cd $(dir $<); mma "$(notdir $<)" -o -f "../$@"' + +clean: + rm -f $(SOLs) $(wildcard $(output)/*/*.svg) + +cleanall: clean + rm -fr $(output) diff --git a/Music/makeall b/Music/makeall deleted file mode 100755 index 57f6e57..0000000 --- a/Music/makeall +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -SONGS=" - SkipToMyLoo - Greensleeves - ScarboroughFair - FrereJacques - AmazingGrace -" - -# bash for loop -for s in $SONGS; do - ./makemusic2 $s - #./makescore $s -done diff --git a/Music/makemusic b/Music/makemusic deleted file mode 100755 index c3b6072..0000000 --- a/Music/makemusic +++ /dev/null @@ -1,232 +0,0 @@ -#!/usr/bin/env python -import os -import sys - - -#mmaExec = "/home/louis/active/src/mma/mma-current/mma.py" -mmaExec = "/home/louis/active/src/mma-bin-1.5d/mma.py" -midiInfo = "InfoPages" - -class songDetails: - - def copyTranslations(self, outputDir): - infoSrcDir = self.directory + "/" + midiInfo ; - infoOutputDir = outputDir + '/' + self.directory + '/' + midiInfo - - - if os.path.isdir(infoSrcDir): - files = os.listdir(infoSrcDir) - for f in files: - - if (f.find(self.name)==0): - if not os.path.isdir(infoOutputDir): - os.mkdir(infoOutputDir) - os.system("cp \"{0}/{1}\" \"{2}/{3:02}-{1}\"".format(infoSrcDir, f, infoOutputDir, self.index)) - - def getOutputName(self): - return "/%02d-%s"%(self.index, self.name) - - - def createMusic(self, outputDir, webDir, tempDir): # create music - - if not os.path.isdir(outputDir + '/' + self.directory): - os.mkdir(outputDir + '/' + self.directory) - if not os.path.isdir(webDir + '/' + self.directory): - os.mkdir(webDir + '/' + self.directory) - if not os.path.isdir(tempDir + '/' + self.directory): - os.mkdir(tempDir + '/' + self.directory) - - outputName = outputDir + '/' + self.directory + self.getOutputName() - webName = webDir + '/' + self.directory + "/" + self.name - tempName = tempDir + '/' + self.directory + self.getOutputName() - - srcName = self.directory + "/" + self.name - - abcMidiName = srcName - if os.path.isfile(abcMidiName + "Mid.abc"): - abcMidiName += "Mid" - print "abcName " + srcName - - # http://moinejf.free.fr/ (abcplus.sourceforge.net) - cmd = "abc2midi \"{0}.abc\" -o \"{1}.solo.mid\" -RS".format(abcMidiName, abcMidiName) - print cmd - if os.system(cmd) != 0: - return False - - # http://mellowood.ca/mma/ - cmd = "cd \"{0}\";{1} \"{2}.mma\" -f \"../{3}.mid\"".format( self.directory, mmaExec, self.name, outputName ) - print cmd - if os.system(cmd) != 0: - return False - - psName = srcName - - if os.path.isfile(psName + "Ps.abc"): - psName += "Ps" - print "psName " + psName - - # http://abc.sourceforge.net/ (abcplus.sourceforge.net) - cmd = "abcm2ps -s 0.8 -c \"{0}.abc\" -O \"{1}.ps\"" .format( psName, tempName ) - print cmd - if os.system(cmd) != 0: - return False - - # http://www.ghostscript.com/ - ps2pdf is part of ghostscript - cmd = "ps2pdf \"{0}.ps\" \"{1}.pdf\"".format( tempName, outputName ) - print cmd - if os.system(cmd) != 0: - return False - os.remove("{0}.ps".format(tempName)) - - - cmd = "abcm2ps -E -s 1.0 -c \"{0}.abc\" -O \"{1}.ps\"".format( psName, tempName) - print cmd - if os.system(cmd) != 0: - return False - - - - - # from imagemagick - cmd = "convert -density 90x90 -alpha off \"{0}001.eps\" \"{1}.png\"" .format(tempName, webName) - print cmd - if os.system(cmd) != 0: - return False - - self.copyTranslations(outputDir) - - os.remove("{0}001.eps".format(tempName )) - - os.system("cp \"{0}.abc\" \"{1}.abc\"".format(abcMidiName, webName)) - os.system("cp \"{0}.mma\" \"{1}.mma\"".format(srcName, webName)) - os.system("cp \"{0}.pdf\" \"{1}.pdf\"".format(outputName, webName)) - os.system("cp \"{0}.mid\" \"{1}.mid\"".format(outputName, webName)) - pbCfg = self.directory + "/" + "pb.cfg" - - if os.path.isfile(pbCfg): - os.remove(pbCfg) - - - - f = open( webDir + "/" + self.directory + ".html", 'a') - if f == 0: - return False - webName = self.directory + "/" + self.name - - str = """ -
-
-
- Piano Music - {0}
- Download the MIDI file {0}.mid
- and the pdf {0}.pdf
- (This music was generated from the {0}.abc
- and the MMA file {0}.mma )
-