X-Git-Url: https://svn.cri.ensmp.fr/git/minwii.git/blobdiff_plain/5f7bb1f72565a54cf49b2b3b39f13cc2bbabc112..2afd6b2dc26dd12ecbba36d221a7cc45f19673f2:/src/songs/synth.py?ds=sidebyside diff --git a/src/songs/synth.py b/src/songs/synth.py index 07a8a5a..0832b90 100755 --- a/src/songs/synth.py +++ b/src/songs/synth.py @@ -6,7 +6,7 @@ $Id$ $URL$ """ import fluidsynth -from musicxmltosong import musicXml2Song +from app.musicxml import musicXml2Song from time import sleep import sys from optparse import OptionParser @@ -28,7 +28,10 @@ class SongPlayer(object) : def play(self) : fs = self.fs for note, verseIndex in self.part.iterNotes(indefinitely=False) : - print note, note.lyrics[verseIndex] + try : + print note, note.lyrics[verseIndex] + except IndexError : + print note, '?' fs.noteon(0, note.midi, 64) duration = note.duration * self.quarterNoteDuration / 1000 sleep(duration) @@ -44,13 +47,21 @@ def main() : op.add_option("-i", "--part-index", dest="partIndex" , default = 0 , help = "Index de la partie qui contient le champ.") + + op.add_option("-c", '--no-chorus', dest='autoDetectChorus' + , action="store_false" + , default = True + , help = "désactive la détection du refrain") + op.add_option("-q", "--quarter-note-duration", dest="quarterNoteDuration" , type="int", default=400 , help="Durée de la noire [default] (en millisecondes)" ) + op.add_option("-b", "--bank", dest="bank" , type="int", default="0" , help="midi bank [default]") + op.add_option("-p", "--preset", dest="preset" , type="int", default="0" , help="midi preset [default]") @@ -60,7 +71,9 @@ def main() : if len(args) != 1 : raise SystemExit(op.format_help()) - song = musicXml2Song(args[0], partIndex=options.partIndex) + song = musicXml2Song(args[0], + partIndex=options.partIndex, + autoDetectChorus=options.autoDetectChorus) sp = SongPlayer(song, '/Users/pinbe/dev/minwii/fluid-soundfont-3.1/FluidR3_GM.sf2', quarterNoteDuration=options.quarterNoteDuration,