-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathindex.html
70 lines (66 loc) · 2.98 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text to Voice</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container mt-5">
<div class="card">
<div class="card-header text-center">
<h2>文本转语音</h2>
</div>
<div class="card-body">
<form id="text2voice-form">
<!-- API选择 -->
<div class="form-group">
<label for="api">选择API:</label>
<select class="form-control" id="api" required>
<option value="aivoicenet">API 1</option>
<option value="voiceapi">API 2</option>
</select>
</div>
<div id="commonParams">
<div class="form-group">
<label for="text">输入文本:</label>
<textarea class="form-control" id="text" rows="4" required></textarea>
</div>
<div class="form-group">
<label for="speaker">选择讲述人:</label>
<select class="form-control" id="speaker" required></select>
</div>
</div>
<div id="voiceapiParams" style="display: none;">
<div class="form-group slider-container">
<label for="rate">语速: <span id="rateValue">0</span></label>
<input type="range" class="form-control-range" id="rate" name="rate" min="-100" max="100" value="0">
</div>
<div class="form-group slider-container">
<label for="pitch">语调: <span id="pitchValue">0</span></label>
<input type="range" class="form-control-range" id="pitch" name="pitch" min="-100" max="100" value="0">
</div>
</div>
<button type="submit" class="btn btn-primary btn-block">生成语音</button>
</form>
<div class="mt-4" id="result" style="display: none;">
<audio id="audio" controls class="w-100"></audio>
<a id="download" class="btn btn-success btn-block mt-3" href="#" download="voice.mp3">下载语音文件</a>
</div>
<div class="mt-4" id="loading" style="display: none;">
正在生成语音,请稍候...
</div>
</div>
</div>
</div>
<div id="history" class="container mt-5">
<h2>历史记录</h2>
<button onclick="clearHistory()" class="btn btn-warning btn-block">清除历史</button>
<div id="historyItems"></div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="script.js"></script>
</body>
</html>