Pergunta

what text to speech and speech recognition libraries are available for Clojure? So far I have found

https://github.com/klutometis/speech-recognition

https://github.com/klutometis/speech-synthesis

both of these use Google and thus depend of the web.

I'm looking for ones that don't depend on the internet to work

Foi útil?

Solução

I think this is a pretty much unexplored territory as far as existing Clojure libraries go.

Your best bet is probably to look at the many available Java speech recognition libraries and use them from Clojure - they are going to be much more mature and capable at this point.

You may want to look at:

Using Java libraries from Clojure is extremely easy - it is generally as simple as importing the right classes and doing (.someMethod someObject arg1 arg2)

If you do create a Clojure wrapper for a speech recogniser, please do contribute it back to the community! I know quite a few people (myself included) would be interested in doing some speech-related work in Clojure.

Outras dicas

So far I have been able to use the native system's TTS here is my code, maybe this will help someone?

(use '[speech-synthesis.say :as say])
(use '[clojure.java.shell :only [sh]])


(defn festival [x](sh "sh" "-c" (str "echo " x " | festival --tts")))
(defn espeak [x] (sh "espeak" x))
(defn mac-say[x] (sh "say" x))
(defn check-if-installed[x] (:exit(sh "sh" "-c" (str "command -v " x " >/dev/null 2>&1 || { echo >&2 \"\"; exit 1; }"))))


(defn engine-check[]
(def engines (conj["Google" ]
(if (= (check-if-installed "festival") 0)  "Festival" )
(if (= (check-if-installed "espeak") 0) "ESpeak"   )
(if (= (check-if-installed "say") 0)  "Say"  ))) ;; Say is the Apple say command
(remove nil? engines))

(defn set-engine [eng](cond (= eng "Google")(def speak say)
                      (= eng "Festival" )(def speak festival)
                      (= eng "ESpeak") (def speak espeak)
                      (= eng "Say") (def speak mac-say)))

then to use

(set-engine "Festival") ;; set the engine
(speak "Hello, I can talk") ;; speak your text

I have used espeak via a JNI java library I wrote to generate speech from text in clojure. The basic library is available on github. Unfortunately, for unrelated reasons, I've been forced to put my focus towards a different problem for the time being. However, drop me a message if you want to use my library to interface with espeak from clojure - I can send you some exmaples of how I used it.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top