Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what text to speech and speech recognition libraries are available for Clojure?

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

like image 722
Taylor Ramirez Avatar asked Aug 15 '12 21:08

Taylor Ramirez


2 Answers

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:

  • http://cmusphinx.sourceforge.net/sphinx4/

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.

like image 82
mikera Avatar answered Sep 23 '22 16:09

mikera


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
like image 37
Taylor Ramirez Avatar answered Sep 21 '22 16:09

Taylor Ramirez