From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- .../api/speechsynthesisutterance/voice/index.html | 130 +++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 files/pt-br/web/api/speechsynthesisutterance/voice/index.html (limited to 'files/pt-br/web/api/speechsynthesisutterance/voice') diff --git a/files/pt-br/web/api/speechsynthesisutterance/voice/index.html b/files/pt-br/web/api/speechsynthesisutterance/voice/index.html new file mode 100644 index 0000000000..22f884d58b --- /dev/null +++ b/files/pt-br/web/api/speechsynthesisutterance/voice/index.html @@ -0,0 +1,130 @@ +--- +title: SpeechSynthesisUtterance.voice +slug: Web/API/SpeechSynthesisUtterance/voice +tags: + - API + - Experimental + - Fala + - SpeechSynthesisUtterance + - Voz + - Web Speech API +translation_of: Web/API/SpeechSynthesisUtterance/voice +--- +
{{APIRef("Web Speech API")}}{{SeeCompatTable}}
+ +

A propriedade voice  da interface {{domxref("SpeechSynthesisUtterance")}} retorna e configura a voz que será usada para a fala.

+ +

Essa propriedade deve ser configurada para um dos objetos {{domxref("SpeechSynthesisVoice")}} retornado por {{domxref("SpeechSynthesis.getVoices()")}}. Se não for configurada no momento da fala, a voz usada será a determinada como default na propriedade {{domxref("SpeechSynthesisUtterance.lang","lang")}}.

+ +

Sintaxe

+ +
var myVoice = speechSynthesisUtteranceInstance.voice;
+speechSynthesisUtteranceInstance.voice = speechSynthesisVoiceInstance;
+
+ +

Valor

+ +

Um objeto {{domxref("SpeechSynthesisVoice")}}.

+ +

Examplo

+ +
var synth = window.speechSynthesis;
+
+var inputForm = document.querySelector('form');
+var inputTxt = document.querySelector('input');
+var voiceSelect = document.querySelector('select');
+
+var voices = synth.getVoices();
+
+  ...
+
+inputForm.onsubmit = function(event) {
+  event.preventDefault();
+
+  var utterThis = new SpeechSynthesisUtterance(inputTxt.value);
+  var selectedOption = voiceSelect.selectedOptions[0].getAttribute('data-name');
+  for(i = 0; i < voices.length ; i++) {
+    if(voices[i].name === selectedOption) {
+      utterThis.voice = voices[i];
+    }
+  }
+  synth.speak(utterThis);
+  inputTxt.blur();
+}
+ +

Especificações

+ + + + + + + + + + + + + + +
EspecificaçãoStatusComentário
{{SpecName('Web Speech API', '#dfn-utterancevoice', 'voice')}}{{Spec2('Web Speech API')}} 
+ +

Compatiblidade dos navegadores

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support{{CompatChrome(33)}}{{CompatGeckoDesktop(49)}}{{CompatNo}}{{CompatUnknown}}7
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChromeFirefox Mobile (Gecko)Firefox OSIE PhoneOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatNo}}2.0{{CompatNo}}{{CompatNo}}7.1
+
+ +

Veja também

+ + -- cgit v1.2.3-54-g00ecf