mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-07 02:21:23 +00:00
Synthesize using n-phones!
n-phones comprise monophones, diphones, 3-phones, and more. This algorithm allows for smoother sounding synthesis. Also updates the UI for a new n-phones option and adds/updates scripts related to the arpabet with respect to n-phones.
This commit is contained in:
1 parent
a6eb7ad539
commit
93f3a2d372
9 files changed
+312
-14
No files matched your search
@@ -35,14 +35,14 @@ def get_n_phones(phoneme_list, n):
|
||||
elif n == len(phoneme_list):
|
||||
return [phoneme_list[:]]
|
||||
else:
|
||||
span = len(phoneme_list) - n
|
||||
span = len(phoneme_list) - n + 1
|
||||
n_phones = []
|
||||
for i in range(span):
|
||||
n_phone = [phoneme_list[j] for j in range(i, i+n)]
|
||||
n_phones.append(n_phone)
|
||||
return n_phones
|
||||
|
||||
def print_histogram(n):
|
||||
def print_histogram(n, print_length = 20):
|
||||
"""
|
||||
Build and print the histogram for the given size
|
||||
"""
|
||||
@@ -58,11 +58,20 @@ def print_histogram(n):
|
||||
|
||||
ordered = sorted(n_phone_map.items(), key=lambda x: len(x[1]), reverse=True)
|
||||
|
||||
print("MOST FREQUENT {}-PHONES:\n".format(n))
|
||||
title = "MOST FREQUENT {}-PHONES:".format(n)
|
||||
print("\n" + title)
|
||||
print("="*len(title) + "\n")
|
||||
|
||||
for it in ordered[0:100]:
|
||||
for it in ordered[0:print_length]:
|
||||
line = "{}, {} - eg.{}".format(it[0], len(it[1]), it[1][0])
|
||||
print(line)
|
||||
|
||||
print_histogram(2)
|
||||
print_histogram(3)
|
||||
print_histogram(4)
|
||||
|
||||
# Beyond 4-phones, it becomes computationally expensive
|
||||
# if we try to guarantee best fit (exponential-time).
|
||||
#print_histogram(5)
|
||||
#print_histogram(6)
|
||||
|
||||
@@ -6,7 +6,7 @@ import os
|
||||
import re
|
||||
|
||||
DICTIONARY_FILE = '/home/bt/dev/trumpet/dictionary/cmudict-0.7b'
|
||||
PHONE_DIR = '/home/bt/Dropbox/jungle.horse/sounds/trump/_phonemes'
|
||||
PHONE_DIR = '/home/bt/Dropbox/jungle.horse/sounds/trump/1-phones'
|
||||
|
||||
def current_phonemes():
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user