User:Lieven Van Speybroeck/Prototyping/8-Soldier: Difference between revisions
(Created page with "soldier.py: <source lang="python"> #!/usr/bin/python clothes = ["coat","shoes","hat"] people = ["tailor","cobbler","hatter"] first,last = ["When i have no %s to put on?","When I...") |
mNo edit summary |
||
Line 3: | Line 3: | ||
#!/usr/bin/python | #!/usr/bin/python | ||
# Lists with clothes, shops and reasons | |||
clothes = ["coat","shoes","hat"] | clothes = ["coat","shoes","hat"] | ||
people = ["tailor","cobbler","hatter"] | people = ["tailor","cobbler","hatter"] | ||
first,last = ["When i have no %s to put on?","When I've a wife and child at home?"] | first,last = ["When i have no %s to put on?","When I've a wife and child at home?"] | ||
# The recurring pieces of the 2 choruses | |||
chorus1 = "Soldier, soldier, will you marry me\nWith your musket, fife and drum?\nOh how can I marry such a pretty little girl\n%s\n\n" | chorus1 = "Soldier, soldier, will you marry me\nWith your musket, fife and drum?\nOh how can I marry such a pretty little girl\n%s\n\n" | ||
chorus2 = "Off to the %s she did go\nAs fast as she could run\nShe brought him back the finest that was there\nNow soldier, put them on\n" | chorus2 = "Off to the %s she did go\nAs fast as she could run\nShe brought him back the finest that was there\nNow soldier, put them on\n" | ||
# The script | |||
for i in range(0,3): | for i in range(0,3): | ||
print chorus1%(first%(clothes[i])),chorus2%(people[i]) | print chorus1%(first%(clothes[i])),chorus2%(people[i]) |
Revision as of 12:01, 20 October 2011
soldier.py:
#!/usr/bin/python
# Lists with clothes, shops and reasons
clothes = ["coat","shoes","hat"]
people = ["tailor","cobbler","hatter"]
first,last = ["When i have no %s to put on?","When I've a wife and child at home?"]
# The recurring pieces of the 2 choruses
chorus1 = "Soldier, soldier, will you marry me\nWith your musket, fife and drum?\nOh how can I marry such a pretty little girl\n%s\n\n"
chorus2 = "Off to the %s she did go\nAs fast as she could run\nShe brought him back the finest that was there\nNow soldier, put them on\n"
# The script
for i in range(0,3):
print chorus1%(first%(clothes[i])),chorus2%(people[i])
print chorus1%(last)
then run: $ soldier.py | espeak -ven+f2 -p80
et voila: lovely monotone folk song that you want to get out of your head asap