mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-02-04 19:34:05 +01:00
[Voice] Fix google and watson STT pcm format support (#16464)
Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
d4cdd56097
commit
cb8b3fb125
@ -243,7 +243,7 @@ public class GoogleSTTService implements STTService {
|
|||||||
// Gather stream info and send config
|
// Gather stream info and send config
|
||||||
AudioFormat streamFormat = audioStream.getFormat();
|
AudioFormat streamFormat = audioStream.getFormat();
|
||||||
RecognitionConfig.AudioEncoding streamEncoding;
|
RecognitionConfig.AudioEncoding streamEncoding;
|
||||||
if (AudioFormat.WAV.isCompatible(streamFormat)) {
|
if (AudioFormat.PCM_SIGNED.isCompatible(streamFormat) || AudioFormat.WAV.isCompatible(streamFormat)) {
|
||||||
streamEncoding = RecognitionConfig.AudioEncoding.LINEAR16;
|
streamEncoding = RecognitionConfig.AudioEncoding.LINEAR16;
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Unsupported format {}", streamFormat);
|
logger.debug("Unsupported format {}", streamFormat);
|
||||||
|
@ -208,6 +208,10 @@ public class WatsonSTTService implements STTService {
|
|||||||
Long frequency = format.getFrequency();
|
Long frequency = format.getFrequency();
|
||||||
Integer bitDepth = format.getBitDepth();
|
Integer bitDepth = format.getBitDepth();
|
||||||
switch (container) {
|
switch (container) {
|
||||||
|
case AudioFormat.CONTAINER_NONE:
|
||||||
|
if (AudioFormat.CODEC_MP3.equals(codec)) {
|
||||||
|
return "audio/mp3";
|
||||||
|
}
|
||||||
case AudioFormat.CONTAINER_WAVE:
|
case AudioFormat.CONTAINER_WAVE:
|
||||||
if (AudioFormat.CODEC_PCM_SIGNED.equals(codec)) {
|
if (AudioFormat.CODEC_PCM_SIGNED.equals(codec)) {
|
||||||
if (bitDepth == null || bitDepth != 16) {
|
if (bitDepth == null || bitDepth != 16) {
|
||||||
@ -239,11 +243,6 @@ public class WatsonSTTService implements STTService {
|
|||||||
return "audio/ogg;codecs=opus";
|
return "audio/ogg;codecs=opus";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AudioFormat.CONTAINER_NONE:
|
|
||||||
if (AudioFormat.CODEC_MP3.equals(codec)) {
|
|
||||||
return "audio/mp3";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user