created a script to generate the music and sheet music page

git-svn-id: https://svn.code.sf.net/p/pianobooster/code/trunk@100 ba081f5d-443b-49a7-ac4b-446c3f91f371
This commit is contained in:
louisjb 2010-02-08 21:47:39 +00:00
parent 757c23bcc0
commit 0dc6a8c7cd
9 changed files with 271 additions and 18 deletions

34
Music/AmazingGrace.abc Normal file
View File

@ -0,0 +1,34 @@
X: 1
T: Amazing Grace
Q: "English Waltz " 87
C: Traditional
M: 3/4 % time signature
L: 1/4 % default length
%%staves {RH LH}
V: RH clef=treble
%%MIDI channel 4
%%MIDI program 1 4 % Klavier
%%MIDI gchordoff
%
V: LH clef=bass
%%MIDI channel 3
%%MIDI program 1 3 % Klavier
%%MIDI gchordoff
%
K: F % key signature
%
[V: RH] z2 +1+C/+3+F/ |: "F"F2 A/F/ | A2 G |
w: A_ma-zing_ grace, how
[V: LH] z3 |: +1+F,,3 | +5+F,3 |
%
[V: RH] "Bb"F2 +2+D | "F"C2 C/+2+F/ | +1+F2 A/G/ | A2 c | "C7"(c3 |
w: sweet the sound that_ saved a_ wretch like me!
[V: LH] +3+B,,3 | +5+F,3 | +1+F,,3 | +5+F,3 | +4+(C,3 |
%
[V: RH] c2) A/c/ | "F"c2 A/F/ | "F7"+5+A2 G | "Bb"F2 +2+D |
w: _ I_ once was_ lost, but now I'm
[V: LH] C,3) | +1+F,,3 | +5+F,3 | +3+B,,3 |
%
[V: RH] "F"C2 C/+3+F/ | F2 A/F/ | "C7"A2 G |[1 "F"(F3 | F2) +1+C/+3+F/ :|2 "F"(F3 | F2) |]
w: found, Was_ blind, but_ now I see._ * * * *
[V: LH] +1+F,,3 | +5+F,3 | +3+C,3 |[1 +1+(F,,3 | F,,3) :|2 +1+(F,,3 | F,,2) |]

View File

@ -9,13 +9,16 @@ Begin Solo-Left
End
Tempo 87
Groove Metronome3
z
Groove countrywaltz2
Beatadjust 2
midiInc file=AmazingGracePiano.mid Solo-Right=4 Solo-Left=3 Volume=80
midiInc file=AmazingGraceMid.solo.mid Solo-Right=4 Solo-Left=3 Volume=80
Beatadjust -2
1 z!
1 z
Repeat

View File

@ -13,7 +13,7 @@ V: LH1 clef=bass
%%MIDI gchordoff
%
[V: RH1] |: CDEC | CDEC | EFG2 | EFG2 |
[V: LH1] |: E4, | E4, | C4, | C4, |
[V: LH1] |: E,4 | E,4 | C,4 | C,4 |
[V: RH1] G/2A/2G/2F/2 EC | G/2A/2G/2F/2 EC | Cz C2 | Cz C2 :|
[V: LH1] E4, | E4, | zG,z2 | zG,z2 :|
[V: LH1] E,4 | E,4 | zG,z2 | zG,z2 :|
%

View File

@ -1,6 +1,6 @@
X:1
T:Greensleeves Simplified
T:Greensleeves
M:3/4
L:1/4
Q: "Allegro" 1/4 = 130 % tempo

View File

@ -9,9 +9,17 @@ V: RH1 clef=treble
%%MIDI channel 4
%%MIDI program 1 4
%%MIDI gchordoff
V: LH1 clef=bass
%%MIDI channel 3
%%MIDI program 1 3
%%MIDI gchordoff
%
[V: RH1] |: D2D | A2A | E3/2F/E | D3 | zAc |
[V: LH1] |: z3 | z3 | z3 | z3 | z3 |
[V: RH1] d2c | ABG | A3- | Azd | d2d |
[V: LH1] z3 | z3 | z3 | z3 | z3 |
[V: RH1] c2A | AGF | E/C/-C2 |-C3 |
[V: LH1] z3 | z3 | z3 | z3 |
[V: RH1] D2A | G2F | EDC | D3- | D3 :|
%%MIDI program 25
[V: LH1] z3 | z3 | z3 | z3 | z3 :|
%

View File

@ -4,10 +4,12 @@ SONGS="
SkipToMyLoo
Greensleeves
ScarboroughFair
FrereJacques
AmazingGrace
"
# bash for loop
for s in $SONGS; do
./makemusic $s
./makescore $s
./makemusic2 $s
#./makescore $s
done

View File

@ -1,13 +1,125 @@
#!/bin/bash
#rename to makemusic.bat to run on windows
#!/usr/bin/env python
import os
import sys
# create the output dir if does not exist
[ -a PianoBoosterMusic ] || mkdir "PianoBoosterMusic"
class songDetails:
# from abc plus
echo make music with $1
abc2midi $1.abc -o ${1}.solo.mid -RS
def createMusic(self, no): # create music
# from Musical MIDI Accompaniment
mma $1.mma -f PianoBoosterMusic/${1}.mid
self.nName = "%02d-%s"%(no, self.name)
inputFile = self.name
if os.path.isfile(inputFile + "Mid.abc"):
inputFile += "Mid"
print "inputFile " + inputFile
# http://moinejf.free.fr/ (abcplus.sourceforge.net)
cmd = "abc2midi %s.abc -o %s.solo.mid -RS" % (inputFile, self.name)
print cmd
if os.system(cmd) != 0:
return False
# http://mellowood.ca/mma/
cmd = "/home/louis/active/src/mma/mma-current/mma.py %s.mma -f MusicFiles/%s.mid" % (self.name, self.nName)
print cmd
if os.system(cmd) != 0:
return False
inputFile = self.name
if os.path.isfile(inputFile + "Ps.abc"):
inputFile += "Ps"
print "inputFile " + inputFile
# http://abc.sourceforge.net/ (abcplus.sourceforge.net)
cmd = "abcm2ps -s 0.8 -c %s.abc -O MusicFiles/%s.ps" % (inputFile, self.name)
print cmd
if os.system(cmd) != 0:
return False
# http://www.ghostscript.com/ - ps2pdf is part of ghostscript
cmd = "ps2pdf MusicFiles/%s.ps MusicFiles/%s.pdf" % ( self.name, self.nName)
print cmd
if os.system(cmd) != 0:
return False
os.remove("MusicFiles/%s.ps" % self.name)
cmd = "abcm2ps -E -s 1.0 -c %s.abc -O MusicFiles/%s.ps" % (inputFile, self.name)
print cmd
if os.system(cmd) != 0:
return False
# from imagemagick
cmd = "convert -density 90x90 -alpha off MusicFiles/%s001.eps MusicFiles/%s.png" % (self.name, self.nName)
print cmd
if os.system(cmd) != 0:
return False
os.remove("MusicFiles/%s001.eps" % self.name)
os.system("cp {0}.abc MusicSource".format(self.name))
os.system("cp {0}.mma MusicSource".format(self.name))
f = open( 'music.html', 'a')
str = """
<p></p>
<p class="image">
<img hspace="10" src="MusicFiles/{1}.png" alt="Piano Music - {0}">
Piano Music - {0} <br><br>
Download the MIDI file <a href="MusicFiles/{1}.mid"> {1}.mid </a>
and the pdf <a href="MusicFiles/{1}.pdf">{1}.pdf </a> <br>
(This music was generated from the <a href="MusicSource/{0}.abc">{0}.abc </a>
and the MMA file <a href="MusicSource/{0}.mma">{0}.mma </a> ) <br>
</p>
""".format(self.name, self.nName)
f.write(str)
f.close()
return True
def addSong(songs, name):
details = songDetails()
details.name = name
songs.append(details)
def runMain(argv):
if len(argv) > 1:
outputDir = "MusicFiles"
if not os.path.isdir(outputDir):
os.mkdir(outputDir)
if not os.path.isdir("MusicSource"):
os.mkdir("MusicSource")
os.remove("music.html")
os.system("cp music.html.start music.html")
songs=[]
addSong(songs, "SkipToMyLoo")
addSong(songs, "FrereJacques")
addSong(songs, "ScarboroughFair")
addSong(songs, "Greensleeves")
addSong(songs, "AmazingGrace")
for n,song in enumerate(songs):
result = song.createMusic( n + 1 )
if not result:
break
os.system("cat music.html.end >>music.html")
else:
print "usage: makescore args"
if __name__ == "__main__":
runMain(sys.argv)

23
Music/music.html.end Normal file
View File

@ -0,0 +1,23 @@
<p>
All the music on this page is available here
<a href="PianoBoosterMusic.zip">PianoBoosterMusic.zip </a>.
This free sheet music can be used for beginner piano lessons with <b>PianoBooster</b>.
</p>
<!-- Footer -->
</td>
<!-- A margin on the right hand side -->
<td width="15%">
</td>
</tr>
</tbody></table>
</td>
</tr>
</body></html>

71
Music/music.html.start Normal file
View File

@ -0,0 +1,71 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>Piano Booster - Sheet Music</title>
<link rel="stylesheet" href="ref.css" type="text/css">
</head><body>
<table align="center" cellpadding="0" cellspacing="0">
<tbody><tr>
<td align="right" valign="top" width="15%">
<!-- Some initial vertical space -->
<table><tbody><tr><td height="20"></td></tr></tbody></table>
<a href="index.html"/> <img src="images/logo64x64.png" alt="Home"/> </a>
<p><a href="http://pianobooster.sourceforge.net" target="_top"><b>Home</b></a></p>
<p><a href="screenshots.html"><b>Screen shots</b></a></p>
<p><a href="index.html#features"><b>Features</b></a></p>
<p><a href="download.html"><b>Download</b></a></p>
<p><a href="music.html"><b>Sheet Music</b></a></p>
<p><a href="faq.html"><b>FAQ</b></a></p>
<p><a href="http://n2.nabble.com/Piano-Booster-Users-f1591936.html"><b>Users Forum</b></a></p>
<p><a href="http://n2.nabble.com/Piano-Booster-Development-f2625691.html"><b>Development Forum</b></a></p>
<p><a href="http://sourceforge.net/projects/pianobooster/"><b>SourceForge</b></a> </p>
</td>
<!-- Small margin before main content -->
<td width="20">
</td>
<td valign="top" width="800">
<!-- A table to give some space around the content -->
<table cellpadding="0" width="100%">
<tbody>
<!-- Small vertical space before content -->
<tr><td height="5"></td></tr>
<tr>
<td>
<h1><center>Piano Booster Music</center></h1>
<p>These pieces of music have been created to work with <b>PianoBooster</b> and
are free from copyright or have the creative commons copyright.
All the music is available here
<a href="PianoBoosterMusic.zip">PianoBoosterMusic.zip </a>.
</p>
<p>
<b>Please add to the music on this page -- everyone can help.</b> For more information see this
<a href="http://n2.nabble.com/Creating-music-for-PianoBooster-using-MMA-Everyone-can-help-td4167350.html#a4167350">forum post</a>.
The piano parts for were created using the <a href="http://abcplus.sourceforge.net/">ABC Plus music</a> system
and the accompaniment was created with the <a href="http://www.mellowood.ca/mma/">Musical MIDI Accompaniment (MMA)</a></p>.
</p>