eclipse-archived / smarthome

Eclipse SmartHome™ project
https://www.eclipse.org/smarthome/
Eclipse Public License 2.0
862 stars 783 forks source link

Voice manager and TTS: select the audio format #3254

Open lolodomo opened 7 years ago

lolodomo commented 7 years ago

The algorythm behind getBestMatch is not really clear to me. Can someone explain it ? Is it right that the idea was to give priority to WAV format ? As the TTS and sinks audio formats are in not ordered sets (Set), I am not really sure the result is the one expected.

I have now a use case where MP3 format is used by VoiceRSS but due to the low bitrate of the produced file, the audio sink is not able to render it. Maybe we should have the minimum MP3 bitrate accepted by any audio sink + the MP3 bitrate used by any TTS service in order to avoid selecting MP3 format if the 2 values ae not compatible. Another solution would be to let the user select/force an audio format when running TTS. Any thoughts ?

lolodomo commented 7 years ago

I would like to know if it was intentional to have the methods getBestMatch and getPreferredFormat more or less duplicated here https://github.com/eclipse/smarthome/blob/master/bundles/core/org.eclipse.smarthome.core.audio/src/main/java/org/eclipse/smarthome/core/audio/AudioFormat.java#L250 and here https://github.com/eclipse/smarthome/blob/master/bundles/core/org.eclipse.smarthome.core.voice/src/main/java/org/eclipse/smarthome/core/voice/internal/VoiceManagerImpl.java#L302

There are few differences:

Would it make sense to have only one instance for these 2 methods in AudioFormat ? For me, the correct getBestMatch method is the one in VoiceManagerImpl. For getPreferredFormat, we could imagine to have defaultBitDepth and defaultFrequency as parameters of the method ?

lolodomo commented 7 years ago

To solve the problem identified by my use case (audio sink incompatible with low MP3 bitrate), I think the solution could be:

What do you think about that ?