Ejemplo n.º 1
0
def haiku_nofriends(user):
    """haiku for someone with no friends."""
    out = []
    poem = Poem()
    poem.seed_user = user

    for i in [5, 7, 5]:
        ln = ' '.join(generate_syllable_chain(i, user.corpus))
        out.append(ln)

    idnumber = murmur.string_hash((u''.join(out)).encode('utf-8'))
    poem.lines = out
    poem.poem_id = idnumber

    percussion = [music.screen_to_track(user)]
    melody = [music.words_to_track(w) for w in out]
    composition = music.composificate(percussion, melody)
    filename = "audio/{0}.wav".format(str(idnumber))
    music.mp3ificate(composition, filename)

    poem.save()
    return poem
Ejemplo n.º 2
0
def haiku_nofriends(user):
    """haiku for someone with no friends."""
    out = []
    poem = Poem()
    poem.seed_user = user

    for i in [5, 7, 5]:
        ln = ' '.join(generate_syllable_chain(i, user.corpus))
        out.append(ln)

    idnumber = murmur.string_hash((u''.join(out)).encode('utf-8'))
    poem.lines = out
    poem.poem_id = idnumber

    percussion = [music.screen_to_track(user)]
    melody = [music.words_to_track(w) for w in out]
    composition = music.composificate(percussion, melody)
    filename = "audio/{0}.wav".format(str(idnumber))
    music.mp3ificate(composition, filename)
    
    poem.save()
    return poem
Ejemplo n.º 3
0
def haiku(user):
    #Can't do users until we're closed under corpus
    out = []
    poem = Poem()
    poem.seed_user = user
    users = [user]
    for i in [5, 7, 5]:
        ln = ' '.join(generate_syllable_chain(i, user.corpus))
        out.append(ln)
        user = get_friend(user)
        users.append(user)

    idnumber = murmur.string_hash((u''.join(out)).encode('utf-8'))
    poem.lines = out
    poem.poem_id = idnumber

    percussion = [music.screen_to_track(u) for u in users]
    melody = [music.words_to_track(w) for w in out]
    composition = music.composificate(percussion, melody)
    filename = "audio/{0}.wav".format(str(idnumber))
    music.mp3ificate(composition, filename)

    poem.save()
    return poem
Ejemplo n.º 4
0
def stanza(user, max_length, lines):
    out = []
    poem = Poem()
    poem.seed_user = user

    for _ in range(lines):
        ln = ' '.join(
            generate_chain(length=max_length, markov=user.corpus,
                           strict=False))
        out.append(ln)
        user = get_friend(user)

    idnumber = murmur.string_hash((u''.join(out)).encode('utf-8'))
    poem.poem_id = idnumber
    poem.lines = out

    percussion = [music.screen_to_track(user)]
    melody = [music.words_to_track(w) for w in out]
    composition = music.composificate(percussion, melody)
    filename = "audio/{0}.wav".format(str(idnumber))
    music.mp3ificate(composition, filename)

    poem.save()
    return poem
Ejemplo n.º 5
0
def haiku(user):
    #Can't do users until we're closed under corpus
    out = []
    poem = Poem()
    poem.seed_user = user
    users = [user]
    for i in [5,7,5]:
        ln = ' '.join(generate_syllable_chain(i, user.corpus))
        out.append(ln)
        user = get_friend(user)
        users.append(user)

    idnumber = murmur.string_hash((u''.join(out)).encode('utf-8'))
    poem.lines = out
    poem.poem_id = idnumber

    percussion = [music.screen_to_track(u) for u in users]
    melody = [music.words_to_track(w) for w in out]
    composition = music.composificate(percussion, melody)
    filename = "audio/{0}.wav".format(str(idnumber))
    music.mp3ificate(composition, filename)
    
    poem.save()
    return poem 
Ejemplo n.º 6
0
def stanza(user, max_length, lines):
    out = []
    poem = Poem()
    poem.seed_user = user

    for _ in range(lines):
        ln = ' '.join(generate_chain(length = max_length, 
                markov = user.corpus,
                strict = False))
        out.append(ln)
        user = get_friend(user)
    
    idnumber = murmur.string_hash((u''.join(out)).encode('utf-8'))
    poem.poem_id = idnumber
    poem.lines = out

    percussion = [music.screen_to_track(user)]
    melody = [music.words_to_track(w) for w in out]
    composition = music.composificate(percussion, melody)
    filename = "audio/{0}.wav".format(str(idnumber))
    music.mp3ificate(composition, filename)
    
    poem.save()
    return poem