support voice creation shell script
Browse files- cli/inference.py +1 -1
- example/infer_voice_creation.sh +50 -0
cli/inference.py
CHANGED
@@ -50,7 +50,7 @@ def parse_args():
|
|
50 |
type=str,
|
51 |
help="Path to the prompt audio file",
|
52 |
)
|
53 |
-
parser.add_argument("--gender", choices=["male", "
|
54 |
parser.add_argument(
|
55 |
"--pitch", choices=["very_low", "low", "moderate", "high", "very_high"]
|
56 |
)
|
|
|
50 |
type=str,
|
51 |
help="Path to the prompt audio file",
|
52 |
)
|
53 |
+
parser.add_argument("--gender", choices=["male", "female"])
|
54 |
parser.add_argument(
|
55 |
"--pitch", choices=["very_low", "low", "moderate", "high", "very_high"]
|
56 |
)
|
example/infer_voice_creation.sh
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# Copyright (c) 2025 SparkAudio
|
4 |
+
# 2025 Xinsheng Wang ([email protected])
|
5 |
+
#
|
6 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7 |
+
# you may not use this file except in compliance with the License.
|
8 |
+
# You may obtain a copy of the License at
|
9 |
+
#
|
10 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11 |
+
#
|
12 |
+
# Unless required by applicable law or agreed to in writing, software
|
13 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 |
+
# See the License for the specific language governing permissions and
|
16 |
+
# limitations under the License.
|
17 |
+
|
18 |
+
|
19 |
+
# Get the absolute path of the script's directory
|
20 |
+
script_dir=$(dirname "$(realpath "$0")")
|
21 |
+
|
22 |
+
# Get the root directory
|
23 |
+
root_dir=$(dirname "$script_dir")
|
24 |
+
|
25 |
+
# Set default parameters
|
26 |
+
device=0
|
27 |
+
save_dir='example/results_voice_creation'
|
28 |
+
model_dir="pretrained_models/Spark-TTS-0.5B"
|
29 |
+
text="革新体验,自然呈现,开启语音合成新纪元。此模型由智能语音开源社区 Spark Audio 精心打造。"
|
30 |
+
gender="female"
|
31 |
+
speed="moderate"
|
32 |
+
pitch="moderate"
|
33 |
+
|
34 |
+
|
35 |
+
# Change directory to the root directory
|
36 |
+
cd "$root_dir" || exit
|
37 |
+
|
38 |
+
source sparktts/utils/parse_options.sh
|
39 |
+
|
40 |
+
# Run inference for each JSON file
|
41 |
+
python -m cli.inference \
|
42 |
+
--text "${text}" \
|
43 |
+
--device "${device}" \
|
44 |
+
--save_dir "${save_dir}" \
|
45 |
+
--model_dir "${model_dir}" \
|
46 |
+
--gender "${gender}" \
|
47 |
+
--speed "${speed}" \
|
48 |
+
--pitch "${pitch}"
|
49 |
+
|
50 |
+
|