]> git.basschouten.com Git - openhab-addons.git/blob
a461bf639f26668343b69584dca20067b1f5b09d
[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.voicerss.internal.cloudapi;
14
15 import java.io.IOException;
16 import java.util.Locale;
17 import java.util.Set;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.voice.voicerss.internal.VoiceRSSRawAudioStream;
21
22 /**
23  * Interface which represents the functionality needed from the VoiceRSS TTS
24  * service.
25  *
26  * @author Jochen Hiller - Initial contribution
27  */
28 @NonNullByDefault
29 public interface VoiceRSSCloudAPI {
30
31     /**
32      * Get all supported locales by the TTS service.
33      *
34      * @return A set of {@link Locale} supported
35      */
36     Set<Locale> getAvailableLocales();
37
38     /**
39      * Get all supported audio codecs by the TTS service. This includes MP3,
40      * WAV and more audio formats as used in APIs.
41      *
42      * @return A set of all audio codecs supported
43      */
44     Set<String> getAvailableAudioCodecs();
45
46     /**
47      * Get all supported voices.
48      *
49      * @return A set of voice names supported
50      */
51     Set<String> getAvailableVoices();
52
53     /**
54      * Get all supported voices for a specified locale.
55      *
56      * @param locale
57      *            the locale to get all voices for
58      * @return A set of voice names supported
59      */
60     Set<String> getAvailableVoices(Locale locale);
61
62     /**
63      * Get the given text in specified locale and audio format as input stream.
64      *
65      * @param apiKey
66      *            the API key to use for the cloud service
67      * @param text
68      *            the text to translate into speech
69      * @param locale
70      *            the locale to use
71      * @param voice
72      *            the voice to use, "default" for the default voice
73      * @param audioCodec
74      *            the audio codec to use
75      * @param audioFormat
76      *            the audio format to use
77      * @return a {@link VoiceRSSRawAudioStream} to the audio data in specified format
78      * @throws IOException
79      *             will be raised if the audio data can not be retrieved from
80      *             cloud service
81      */
82     VoiceRSSRawAudioStream getTextToSpeech(String apiKey, String text, String locale, String voice, String audioCodec,
83             String audioFormat) throws IOException;
84 }