本文整理汇总了Python中song.Song.playSong方法的典型用法代码示例。如果您正苦于以下问题:Python Song.playSong方法的具体用法?Python Song.playSong怎么用?Python Song.playSong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类song.Song
的用法示例。
在下文中一共展示了Song.playSong方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: listen
# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import playSong [as 别名]
def listen():
# Plays a song generated by the master vector
print
print "---Listening---"
print
queryUser()
master = Vector("master")
s = Song(root,mode,title)
for i in range(num_measures):
s.addMeasure(master)
s.playSong()
print
print "This is the best song I know how to play!\n"
raw_input("Press any key to return to the main menu: ")
示例2: listen
# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import playSong [as 别名]
def listen():
print
print "---Listening---"
print
queryUser()
master = Vector("master")
s = Song(root,mode,title)
# Build and play a song based on the master vector
for i in range(num_measures):
s.addMeasure(master)
print
print "This is the best song I know how to play!\n"
s.playSong()
raw_input("Press any key to return to the main menu: ")
示例3: train
# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import playSong [as 别名]
def train():
print
print "---Training---"
print
queryUser()
my_vector = Vector()
s = Song(root,mode,title)
for i in range(num_measures):
# Generate a vector and build a measure from it.
training_vector = Vector("user")
s.addMeasure(training_vector)
s.playMeasure(title,i)
# Get feedback
user_opinion = raw_input("What did you think of that measure? (scale from 0-10): ")
while user_opinion.isdigit() == False or int(user_opinion) < 0 or int(user_opinion) > 10:
print "Invalid Response (please select a number from 0-10)"
user_opinion = raw_input("What did you think of that measure? (scale from 0-10): ")
user_opinion = int(user_opinion)
training_vector = s.measures[i].getVector() # update in the case that we repeated
my_vector.update(training_vector,.2,user_opinion)
# Get opinion on whole song
print "Here is your song!\n"
s.playSong()
song_opinion = int(raw_input("How much did you like that song? (scale from 0-10): "))
while song_opinion < 0 or song_opinion > 10:
print "Please enter an integer between 0 and 10: "
song_opinion = raw_input("How much did you like that song? (scale from 0-10): ")
while song_opinion.isdigit() != False or int(song_opinion) < 0 or int(song_opinion) > 10:
print "Invalid Response (please select a number from 0-10)"
song_opinion = raw_input("How much did you like that song? (scale from 0-10): ")
song_opinion = int(song_opinion)
# Update master based on user opinion
master = Vector("master")
master.update(my_vector,.05,song_opinion)
master.normalize()
master.writeToFile(".master.vct")
if user_opinion > 6 and num_measures > 7:
my_vector.writeToFile(".user_vectors.vct")