-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadvance-config.html
117 lines (111 loc) · 6.29 KB
/
advance-config.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CapetangJS Demo</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en">
<link rel="stylesheet" href="bower_components/material-design-icons/iconfont/material-icons.css">
<link rel="stylesheet" href="bower_components/material-design-lite/material.min.css">
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
<header class="mdl-layout__header">
<div class="mdl-layout__header-row">
<span class="mdl-layout-title">CapetangJS Demo</span>
<div class="mdl-layout-spacer"></div>
<nav class="mdl-navigation mdl-layout--large-screen-only">
<a class="mdl-navigation__link" href="index.html">Hello World!</a>
<a class="mdl-navigation__link" href="choose-voice-name.html">Choose Name</a>
<a class="mdl-navigation__link" href="advance-config.html">Advanced</a>
</nav>
</div>
</header>
<div class="mdl-layout__drawer">
<span class="mdl-layout-title">CapetangJS Demo</span>
<nav class="mdl-navigation">
<a class="mdl-navigation__link" href="index.html">Hello World!</a>
<a class="mdl-navigation__link" href="choose-voice-name.html">Choose Name</a>
<a class="mdl-navigation__link" href="advance-config.html">Advanced</a>
</nav>
</div>
<main class="mdl-layout__content">
<div class="page-content">
<div class="main-grid mdl-grid">
<div class="mdl-cell mdl-cell--12-col">
<div class="overflow-visible maxed-width mdl-card mdl-shadow--2dp">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text">Custom Voice Configuration</h2>
</div>
<div class="overflow-visible mdl-card__supporting-text">
<div class='maxed-width mdl-textfield mdl-js-textfield mdl-textfield--floating-label' id='select-voice-name'>
<input class='mdl-textfield__input' type="text" id="voiceName" value="Select Voice Name" readonly />
<label class='mdl-textfield__label' for="voiceName"> Select Voice Name</label>
</div>
<ul id='voiceList' class="select-container mdl-menu mdl-menu--bottom-left mdl-js-menu mdl-js-ripple-effect" for="select-voice-name"></ul>
<p class="maxed-width">
Volume
<input class="mdl-slider mdl-js-slider" type="range" min="0" max="100" value="100" tabindex="0" id='voice-volume-input' />
</p>
<p class="maxed-width">
Pitch
<input class="mdl-slider mdl-js-slider" type="range" min="0" max="200" value="100" tabindex="0" id='voice-pitch-input' />
</p>
<p class="maxed-width">
Rate
<input class="mdl-slider mdl-js-slider" type="range" min="0" max="1000" value="100" tabindex="0" id='voice-rate-input' />
</p>
<div class="maxed-width mdl-textfield mdl-js-textfield mdl-textfield--floating-label ">
<textarea class="mdl-textfield__input " type="text " rows="5 " id="speech-text"></textarea>
<label class="mdl-textfield__label " for="sample5 ">Text lines...</label>
</div>
</div>
<div class="mdl-card__actions mdl-card--border ">
<button id='speak-button' class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect ">
Speak
</button>
</div>
</div>
</div>
</div>
<footer class="mdl-mini-footer">
<div class="mdl-mini-footer__left-section ">
<div class="mdl-logo ">CapetangJS Demo</div>
<ul class="mdl-mini-footer__link-list ">
<li><a href="https://github.com/rezkyatinnov/capetangjs-demo">repo</a></li>
<li><a href="https://rezkyatinnov.github.io/capetangjs/">go to CapetangJS</a></li>
</ul>
</div>
</footer>
</div>
</main>
</div>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/material-design-lite/material.min.js"></script>
<script src="bower_components/capetang/capetang.min.js"></script>
<script>
function selectListItem(self, id, value) {
$('#' + id).val(value);
$('#' + self).click();
}
$(function() {
capetang.onVoicesReady(function(voices) {
var voiceListHtml = "";
for (i = 0; i < voices.length; i++) {
voiceListHtml += ' <li class="mdl-menu__item" onclick=\'selectListItem("select-voice-name","voiceName","' + voices[i].name + '")\'>' + voices[i].name + ' ( ' + voices[i].lang + ' )</li>';
}
$("#voiceList").html(voiceListHtml);
});
});
$("#speak-button").on("click", function() {
var voice = capetang.getVoicesByName($('#voiceName').val());
capetang
.setVoice(voice[0])
.setVolume($('#voice-volume-input').val() / 100)
.setPitch($('#voice-pitch-input').val() / 100)
.setRate($('#voice-rate-input').val() / 100)
.speak($('#speech-text').val());
});
</script>
</body>
</html>