コード例 #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
コード例 #2
0
ファイル: poetry.py プロジェクト: sabo/steven
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
コード例 #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
コード例 #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
コード例 #5
0
ファイル: poetry.py プロジェクト: sabo/steven
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 
コード例 #6
0
ファイル: poetry.py プロジェクト: sabo/steven
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