Я следил за этой демонстрацией: https://codepen.io/matt-west/pen/dpmmge
, и это работало с кнопкой, чтобы выбрать голос, но мне нужен конкретный голос, чтобы быть установленным все время.
var firstText = "Starch";
var defaultVoiceName = "Microsoft Hazel - English (United Kingdom)";
if (speechSynthesis) {
} else {
alert("Bad news! Your browser doesn't have the Speech Synthesis API this project requires. Try opening this webpage using the newest version of Google Chrome.");
}
// Create a new instance of SpeechSynthesisUtterance.
var msg = new SpeechSynthesisUtterance();
// Set voice. I'm trying to set needed voice ("Microsoft Hazel - English (United Kingdom)") // here, but it doesn't work. This voice is installed on my machine.
msg.voice = speechSynthesis.getVoices().filter(function(voice) { return voice.name == defaultVoiceName })[0];
// Create a new utterance for the specified text and add it to
// the queue.
function speak(text) {
// Stop the previous tts
window.speechSynthesis.cancel();
// Set the text.
msg.text = text;
// Queue this utterance.
window.speechSynthesis.speak(msg);
}
speak(firstText);
< /code>
Что я здесь делаю не так? Может быть, есть лучший способ что -то? Я попробовал библиотеку "ArpressiveVoice", но она работает с задержкой.
Подробнее здесь: https://stackoverflow.com/questions/796 ... javascript
Как выполнить операции TTS с помощью JavaScript? ⇐ Javascript
Форум по Javascript
-
Anonymous
1749363212
Anonymous
Я следил за этой демонстрацией: https://codepen.io/matt-west/pen/dpmmge
, и это работало с кнопкой, чтобы выбрать голос, но мне нужен конкретный голос, чтобы быть установленным все время.
var firstText = "Starch";
var defaultVoiceName = "Microsoft Hazel - English (United Kingdom)";
if (speechSynthesis) {
} else {
alert("Bad news! Your browser doesn't have the Speech Synthesis API this project requires. Try opening this webpage using the newest version of Google Chrome.");
}
// Create a new instance of SpeechSynthesisUtterance.
var msg = new SpeechSynthesisUtterance();
// Set voice. I'm trying to set needed voice ("Microsoft Hazel - English (United Kingdom)") // here, but it doesn't work. This voice is installed on my machine.
msg.voice = speechSynthesis.getVoices().filter(function(voice) { return voice.name == defaultVoiceName })[0];
// Create a new utterance for the specified text and add it to
// the queue.
function speak(text) {
// Stop the previous tts
window.speechSynthesis.cancel();
// Set the text.
msg.text = text;
// Queue this utterance.
window.speechSynthesis.speak(msg);
}
speak(firstText);
< /code>
Что я здесь делаю не так? Может быть, есть лучший способ что -то? Я попробовал библиотеку "ArpressiveVoice", но она работает с задержкой.
Подробнее здесь: [url]https://stackoverflow.com/questions/79657491/how-to-perform-tts-operations-with-javascript[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия