]> git.basschouten.com Git - openhab-addons.git/blob
cbe61e92dd4c907413e4bbabbdf86fa3f92c7b44
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.voice.googletts.internal.dto;
14
15 /**
16  * Description of which voice to use for a synthesis request.
17  *
18  * @author Wouter Born - Initial contribution
19  */
20 public class VoiceSelectionParams {
21
22     /**
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"
29      * (Norwegian)".
30      */
31     private String languageCode;
32
33     /**
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.
36      */
37     private String name;
38
39     /**
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.
44      */
45     private SsmlVoiceGender ssmlGender;
46
47     public VoiceSelectionParams() {
48     }
49
50     public VoiceSelectionParams(String languageCode, String name, SsmlVoiceGender ssmlGender) {
51         this.languageCode = languageCode;
52         this.name = name;
53         this.ssmlGender = ssmlGender;
54     }
55
56     public String getLanguageCode() {
57         return languageCode;
58     }
59
60     public String getName() {
61         return name;
62     }
63
64     public SsmlVoiceGender getSsmlGender() {
65         return ssmlGender;
66     }
67
68     public void setLanguageCode(String languageCode) {
69         this.languageCode = languageCode;
70     }
71
72     public void setName(String name) {
73         this.name = name;
74     }
75
76     public void setSsmlGender(SsmlVoiceGender ssmlGender) {
77         this.ssmlGender = ssmlGender;
78     }
79 }