Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to adjust speech rate with ssml format #88

Open
hzl256 opened this issue Nov 2, 2023 · 0 comments
Open

How to adjust speech rate with ssml format #88

hzl256 opened this issue Nov 2, 2023 · 0 comments

Comments

@hzl256
Copy link

hzl256 commented Nov 2, 2023

from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

from modelscope.models.audio.tts import SambertHifigan
import os
import time

model_dir = "/home/gpu/KAN-TTS/pretrain_work_dir/" # the path of my trained speech model

custom_infer_abs = {
'voice_name':'F7',
'am_ckpt': os.path.join(model_dir, 'tmp_am', 'ckpt'),
'am_config': os.path.join(model_dir, 'tmp_am', 'config.yaml'),
'voc_ckpt':os.path.join(model_dir, 'orig_model', 'basemodel_16k', 'hifigan', 'ckpt'),
'voc_config':os.path.join(model_dir, 'orig_model', 'basemodel_16k', 'hifigan', 'config.yaml'),
'audio_config':os.path.join(model_dir, 'data', 'audio_config.yaml'),
'se_file':os.path.join(model_dir, 'data', 'se', 'se.npy')
}

kwargs = {'custom_ckpt': custom_infer_abs}

model_id = SambertHifigan(os.path.join(model_dir, "orig_model"), **kwargs)

sambert_hifigan_tts = pipeline(task=Tasks.text_to_speech, model=model_id)

txt = "<speak rate="1.5">我的语速比正常人慢。"

output = sambert_hifigan_tts(input=text)

wav = output[OutputKeys.OUTPUT_WAV]

with open('output.wav', 'wb') as f:
f.write(wav)

========================>
try diffrent text like next:
txt = "<speak rate="200">我的语速比正常人慢。"
txt = "<speak rate="-200">我的语速比正常人慢。"
txt = "<speak rate="0.5">我的语速比正常人慢。"
txt = "<speak rate="1.5">我的语速比正常人慢。"

get "output.wav" that have same speech rate.
the context is right. but the speech rate is same. why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant