Skip to content

Commit 2a6bf87

Browse files
committed
Merge branch 'master' of https://github.com/CalmNguyen/DATH
2 parents 9f7c5a4 + c49486b commit 2a6bf87

File tree

5 files changed

+493
-215
lines changed

5 files changed

+493
-215
lines changed

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/component/Select.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Radio, Select, Space } from 'antd';
33
const handleChange = (value) => {
44
console.log(`Selected: ${value}`);
55
};
6-
const App = ({ array }) => {
6+
const App = ({ array, funtionChange }) => {
77
const [size, setSize] = useState('middle');
88
const handleSizeChange = (e) => {
99
setSize(e.target.value);
@@ -19,7 +19,7 @@ const App = ({ array }) => {
1919
<Select
2020
size={size}
2121
defaultValue={array[0].label}
22-
onChange={handleChange}
22+
onChange={funtionChange}
2323
style={{
2424
width: '100%',
2525
}}

src/css/style.css

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/page/TextToVoice.js

Lines changed: 71 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { Flex, Layout, Row } from 'antd';
55
import Header from './Header';
66
import { Input } from 'antd';
77
import Select from '../component/Select'
8+
import '../css/style.css'
89
const { Search } = Input;
910
const { Footer, Sider, Content } = Layout;
10-
1111
const headerStyle = {
1212
textAlign: 'center',
1313
color: '#fff',
@@ -110,35 +110,6 @@ const TextToVoice = () => {
110110
"user_input_paragraph_pause_time": "-1",
111111
"user_select_tts_voice_high_quality": "0"
112112
});
113-
114-
// const handleConvertTextToSpeech = async () => {
115-
// const listSentence = await wordProcessing(inputText)
116-
// console.log(listSentence.length)
117-
// let listTempAudio = []
118-
// for (let i of listSentence) {
119-
// try {
120-
// const API = "https://ttsmaker.com/api/create-tts-order";
121-
122-
// const headers = new Headers({
123-
// 'Content-Type': 'application/json',
124-
// 'Cookie': 'uuid=95b56c3f-8809-4353-b18e-7383b875dd98; _ga=GA1.1.106640793.1699057861; fpestid=4QmD5nlcWsAkGa9BFQJjJEpU5CedQQ0RC5Qbel99iKSmXzEvQC1ZIefwcmjR1iitGFKZxw; _clck=1hw99o9%7C2%7Cfik%7C0%7C1403; cf_clearance=rcD3F_LO2ymvgDY4zdUiyyH5dRYCE6kOxwSA7kSUiiA-1705753934-1-ASNS2Mj88DXJWqyf7PuVA/BwpytWDrhz89Aumc+33m8ylFvtz5TYYwUWGfE7z4+1rM8b9pDMy9pDXy/QpDvlLIk=; __gads=ID=6b83bab849055122:T=1699057860:RT=1705769771:S=ALNI_Mag04DnOYRg3NNvsIfyhzLWA_BJqA; __gpi=UID=00000c7f5dccef10:T=1699057860:RT=1705769771:S=ALNI_MbryloXDuxeQB5-FpQ-KMkw6VnL-w; _clsk=17icoki%7C1705769776119%7C1%7C1%7Cv.clarity.ms%2Fcollect; Hm_lvt_620f68368c2bc5df0b46b149a685a51c=1703261343,1703422380,1705753939,1705769777; Hm_lpvt_620f68368c2bc5df0b46b149a685a51c=1705769777; FCNEC=%5B%5B%22AKsRol-7iCQm6WnkAp-74dIa2PCOliKvLg6lVP9h0sbGIUtKRd8M3ueVoBrI6t9jJHTYxkzY0Ak7sfK3-gF1CYFaB2ntpqTOPrMhW92Il6iLsZ4xLnHQoBDctr50cqHVaKD6w1QPLRa50HLR1hR_BBF5i_zw-dKoGw%3D%3D%22%5D%5D; _ga_MXNCR42D3E=GS1.1.1705768307.8.1.1705769809.0.0.0',
125-
// });
126-
127-
// const response = await fetch(API, {
128-
// method: 'POST',
129-
// headers: headers,
130-
// body: JSON.stringify({ ...json, user_input_text: i }),
131-
// });
132-
133-
// const responseData = await response.json();
134-
// listTempAudio.push(responseData.auto_stand_url)
135-
// // setAudioSrc(responseData.auto_stand_url);
136-
// } catch (error) {
137-
// console.error('Error converting text to speech:', error);
138-
// }
139-
// }
140-
// setListAudio(listTempAudio)
141-
// };
142113
const handleConvertTextToSpeech = async () => {
143114
try {
144115
const listSentence = await wordProcessing(inputText);
@@ -244,9 +215,63 @@ const TextToVoice = () => {
244215
// Thực hiện các hành động khác dựa trên giá trị `value` hoặc thực hiện các yêu cầu API, ...
245216
};
246217
const [loading, setLoading] = useState(false)
218+
const optionsArray = [
219+
{ value: 0.5, label: '⏪ 0.5x' },
220+
{ value: 0.6, label: '⏪ 0.6x' },
221+
{ value: 0.7, label: '⏪ 0.7x' },
222+
{ value: 0.8, label: '⏪ 0.8x' },
223+
{ value: 0.85, label: '⏪ 0.85x' },
224+
{ value: 0.9, label: '⏪ 0.9x' },
225+
{ value: 0.95, label: '⏪ 0.95x' },
226+
{ value: 1.0, label: '1.0x (Default)' },
227+
{ value: 1.05, label: '⏩ 1.05x' },
228+
{ value: 1.1, label: '⏩ 1.1x' },
229+
{ value: 1.15, label: '⏩ 1.15x' },
230+
{ value: 1.2, label: '⏩ 1.2x' },
231+
{ value: 1.25, label: '⏩ 1.25x' },
232+
{ value: 1.3, label: '⏩ 1.3x' },
233+
{ value: 1.4, label: '⏩ 1.4x' },
234+
{ value: 1.5, label: '⏩ 1.5x' },
235+
{ value: 2.0, label: '⏩ 2.0x' },
236+
];
237+
//Thay đổi pitch giọng nói
238+
const optionsPitch = [
239+
{ value: 2.0, label: '🔼 Super High pitch (+100%)' },
240+
{ value: 1.5, label: '🔼 High pitch (+50%)' },
241+
{ value: 1.25, label: '🔼 Medium-high pitch (+25%)' },
242+
{ value: 1.1, label: '🔼 Slightly high pitch (+10%)' },
243+
{ value: 1.05, label: '🔼 Slightly high pitch (+5%)' },
244+
{ value: 1.0, label: 'Default (normal pitch)' },
245+
{ value: 0.95, label: '🔽 Slightly low pitch (-5%)' },
246+
{ value: 0.9, label: '🔽 Slightly low pitch (-10%)' },
247+
{ value: 0.75, label: '🔽 Low pitch (-25%)' },
248+
{ value: 0.5, label: '🔽 Super low pitch (-50%)' },
249+
];
250+
//thời gian dừng
251+
const stopTime = [
252+
{ value: -1, label: '🕒 0ms (eliminate pauses)' },
253+
{ value: 50, label: '🕒 50ms' },
254+
{ value: 100, label: '🕒 100ms' },
255+
{ value: 200, label: '🕒 200ms' },
256+
{ value: 0, label: 'Default (300ms)' },
257+
{ value: 600, label: '🕒 600ms' },
258+
{ value: 800, label: '🕒 800ms' },
259+
{ value: 1000, label: '🕒 1000ms' },
260+
{ value: 1200, label: '🕒 1200ms' },
261+
{ value: 1500, label: '🕒 1500ms' },
262+
{ value: 1800, label: '🕒 1800ms' },
263+
{ value: 2000, label: '🕒 2000ms' },
264+
{ value: 2500, label: '🕒 2500ms' },
265+
{ value: 3000, label: '🕒 3000ms' },
266+
{ value: 4000, label: '🕒 4000ms' },
267+
{ value: 5000, label: '🕒 5000ms' },
268+
{ value: 6000, label: '🕒 6000ms' },
269+
{ value: 8000, label: '🕒 8000ms' },
270+
{ value: 10000, label: '🕒 10000ms' },
271+
];
247272

248273
return (
249-
<div>
274+
<div className='responsive-layout'>
250275
<Layout style={layoutStyle}>
251276
<Header style={headerStyle}>Header</Header>
252277
<Content >
@@ -264,17 +289,27 @@ const TextToVoice = () => {
264289

265290
</div>
266291
<div style={{ display: 'flex', flexDirection: 'column', margin: 10 }}>
267-
268-
<div style={{ marginBottom: 10 }}>
269-
<label>Chọn tốc độ</label>
270-
<Select array={[{ value: 1, label: 'label 1' }]} />
271-
</div>
272292
{listAudio.map((audioUrl, index) => (
273293
<div key={index} style={{ marginTop: 10 }}>
274294
{/* autoPlay */}
275295
<AudioPlayer src={audioUrl} controls />
276296
</div>
277297
))}
298+
<div style={{ marginBottom: 10 }}>
299+
<label>Chọn tốc độ phát</label>
300+
<Select array={optionsArray} functionChange={(e) => {
301+
console.log(e.target.value)
302+
setJson({ ...json, user_select_tts_setting_speed: e.target.value })
303+
}} />
304+
</div>
305+
<div style={{ marginBottom: 10 }}>
306+
<label>Chọn độ pitch chỉ âm giọng</label>
307+
<Select array={optionsPitch} functionChange={(e) => setJson({ ...json, user_select_tts_setting_pitch: e.target.value })} />
308+
</div>
309+
<div style={{ marginBottom: 10 }}>
310+
<label>Chọn độ thời gian dừng</label>
311+
<Select array={stopTime} functionChange={(e) => setJson({ ...json, user_select_tts_voice_high_quality: e.target.value })} />
312+
</div>
278313
{captchaImage && (
279314
<div style={{ marginTop: 10 }} onClick={handleRefreshImage}>
280315
<img style={{ width: '100%', height: 60 }} src={captchaImage} alt="Captcha" />

0 commit comments

Comments
 (0)