Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
generative phase music with say
import os
import sys
import time
import random
VOICES = [
"Agnes",
"Alex",
"Alice",
"Alva",
"Amelie",
"Anna",
"Bruce",
"Carmit",
"Damayanti",
"Daniel",
"Diego",
"Ellen",
"Fiona",
"Fred",
"Ioana",
"Joana",
"Junior",
"Kanya",
"Karen",
"Kathy",
"Kyoko",
"Laura",
"Lekha",
"Luciana",
"Maged",
"Mariska",
"Mei-Jia",
"Melina",
"Milena",
"Moira",
"Monica",
"Nora",
"Paulina",
"Princess",
"Ralph",
"Samantha",
"Sara",
"Satu",
"Sin-ji",
"Tessa",
"Thomas",
"Ting-Ting",
"Veena",
"Vicki",
"Victoria",
"Xander",
"Yelda",
"Yuna",
"Zosia",
"Zuzana"
]
reps = range(20,30)
sleeps = range(3,6)
iterations = range(2,3)
rates = range(5,10)
def main(string):
while True:
rep = random.choice(reps)
sleep = random.choice(sleeps)
rate = random.choice(rates)
voice = random.choice(VOICES)
phrase = ((string + " ") * rep).strip()
iteration = random.choice(iterations)
for i in range(0, iteration):
cmd = "say -r {0} -v {1} {2} &".format(rate, voice, phrase)
print("running:", cmd)
os.system(cmd)
time.sleep(sleep)
if __name__ == '__main__':
main(sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.