Skip to content

Commit 9d01ac9

Browse files
slur support
1 parent c88e891 commit 9d01ac9

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

server.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,21 @@ def acoustic(ustpath:str):
8080
lyric=block["Lyric"]
8181
notenum=int(block["NoteNum"])
8282
length=int(block["Length"])
83-
if(lyric!="R"):
83+
if(lyric=="-"):#;连音符
84+
ph_seq.append(ph_seq[-1])
85+
note_seq.append(notedict[notenum%12]+str(notenum//12-1))
86+
ph_dur.append(str(length/(tempo*8)))
87+
is_slur_seq.append("1")
88+
elif(lyric!="R"):
8489
ph_seq.append(lyric)
8590
note_seq.append(notedict[notenum%12]+str(notenum//12-1))
8691
ph_dur.append(str(length/(tempo*8)))
8792
is_slur_seq.append("0")
88-
93+
ph_seq=" ".join(ph_seq)
94+
print("Phonemes:",ph_seq)
8995
inp={
9096
"text":"",
91-
"ph_seq":" ".join(ph_seq),
97+
"ph_seq":ph_seq,
9298
"note_seq":" ".join(note_seq),
9399
"ph_dur":" ".join(ph_dur),
94100
"note_dur_seq":" ".join(ph_dur),
@@ -118,8 +124,8 @@ def main():
118124

119125
for message in poll_socket(socket):
120126
request = json.loads(message)
127+
print("="*40)
121128
print('Received request: %s' % request)
122-
123129
response = {}
124130
try:
125131
#if request[0] == 'timing':

utils/hparams.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ def set_hparams(config='', exp_name='', hparams_str='', print_hparams=True, glob
4545
loaded_config = set()
4646

4747
def load_config(config_fn): # deep first
48-
with open(os.path.abspath(".\\"+config_fn), encoding='utf-8') as f:
48+
if(config_fn.startswith("/")):
49+
config_fn_path=os.path.abspath(config_fn[1:])
50+
else:
51+
config_fn_path=config_fn
52+
with open(config_fn_path, encoding='utf-8') as f:
4953
hparams_ = yaml.safe_load(f)
5054
loaded_config.add(config_fn)
5155
if 'base_config' in hparams_:

0 commit comments

Comments
 (0)