2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.voice.googletts.internal.dto;
16 * Description of which voice to use for a synthesis request.
18 * @author Wouter Born - Initial contribution
20 public class VoiceSelectionParams {
23 * The language (and optionally also the region) of the voice expressed as a BCP-47 language tag, e.g. "en-US".
24 * Required. This should not include a script tag (e.g. use "cmn-cn" rather than "cmn-Hant-cn"), because the script
25 * will be inferred from the input provided in the SynthesisInput. The TTS service will use this parameter to help
26 * choose an appropriate voice. Note that the TTS service may choose a voice with a slightly different language code
27 * than the one selected; it may substitute a different region (e.g. using en-US rather than en-CA if there isn't a
28 * Canadian voice available), or even a different language, e.g. using "nb" (Norwegian Bokmal) instead of "no"
31 private String languageCode;
34 * The name of the voice. Optional; if not set, the service will choose a voice based on the other parameters such
35 * as languageCode and gender.
40 * The preferred gender of the voice. Optional; if not set, the service will choose a voice based on the other
41 * parameters such as languageCode and name. Note that this is only a preference, not requirement; if a voice of the
42 * appropriate gender is not available, the synthesizer should substitute a voice with a different gender rather
43 * than failing the request.
45 private SsmlVoiceGender ssmlGender;
47 public VoiceSelectionParams() {
50 public VoiceSelectionParams(String languageCode, String name, SsmlVoiceGender ssmlGender) {
51 this.languageCode = languageCode;
53 this.ssmlGender = ssmlGender;
56 public String getLanguageCode() {
60 public String getName() {
64 public SsmlVoiceGender getSsmlGender() {
68 public void setLanguageCode(String languageCode) {
69 this.languageCode = languageCode;
72 public void setName(String name) {
76 public void setSsmlGender(SsmlVoiceGender ssmlGender) {
77 this.ssmlGender = ssmlGender;