01-26-2013, 07:50 PM | #1 |
Member
Posts: 21
Karma: 59588
Join Date: Jan 2013
Device: Kindle Keyboard 3G+Wifi
|
How to use a speech synthesizer on Kindle 3 (text-to-speech development)
I've been working on the last couple of days to get text-to-speech working for other languages other than English. So far I got this.
Using the gstreamer framework I was able to play MP3 and WAV files, I didn't try with other formats, but I believe it is doable. The Kindle uses the ALSA sound system. -How to play mp3 files # gst-launch filesrc location=your_sound_file.mp3 ! decodebin ! audioconvert ! audioresample ! alsasink -How to play wav files # gst-launch filesrc location=your_sound_file.wav ! wavparse ! alsasink -------------------- For the text to speech part. I used a software called mbrola. This is a speech synthesizer with support for many languages. They only provide the software in binary form. But an ARM binary is available here: http://tcts.fpms.ac.be/synthesis/mbr...nux/mbrola.rar In order to get mbrola working, a voice needs to be downloaded. There are several available here: http://tcts.fpms.ac.be/synthesis/ I picked the one for Spanish called "es2" [URL="http://tcts.fpms.ac.be/synthesis/mbrola/dba/es2/es2-989825.zip[/URL] Inside the es2-989825.zip file you will find that there is the actual voice file called "es2" and there is a TEST directory. To execute an example you must do: # ./mbrola es2 TEST/example1.pho test.wav This will execute the mbrola synthesizer, using the es2 spanish voice, using the phonetic example1 file, and creating a test.wav file as output. Now lets say that we want all these together, using mbrola for reading our example1.pho file and listening the output on the kindle speakers. For this, you must combine both things, mbrola+gst-launch. # ./mbrola es2 example1.pho test.wav | gst-launch filesrc location=test.wav ! wavparse ! alsasink I am still working on getting a regular text file to its phonetic form. So please don't post questions asking how to configure this on the kindle to get it to read in other languages. I don't know yet. This is just a first step towards that. Everybody is welcome to help out on the effort. Thanks, Lupines. Last edited by Lupines; 01-26-2013 at 11:12 PM. |
01-26-2013, 08:02 PM | #2 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
i was playing with this just last week. similar tech. massive.
excellent |
01-26-2013, 09:12 PM | #3 |
Enthusiast
Posts: 28
Karma: 20614
Join Date: Jun 2012
Device: Kindle Touch
|
Hello
Idea: Create a microphone in Kindle `s In theory, reversing the operation of a speaker, a microphone is created .. I did it with a headset old and I think it is possible with a Kindle touch .. drivers only need to run the speaker in reverse, in theory..... I I change the function of my headset with the audio settings panel of windows Last edited by skull43; 01-26-2013 at 09:15 PM. |
01-26-2013, 09:34 PM | #4 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Some Kindles **have** microphones.
|
01-26-2013, 09:55 PM | #5 |
Enthusiast
Posts: 28
Karma: 20614
Join Date: Jun 2012
Device: Kindle Touch
|
Kindle touch have microphone ? (...) ¿Why? o.O
|
01-26-2013, 11:43 PM | #6 | |
Member
Posts: 21
Karma: 59588
Join Date: Jan 2013
Device: Kindle Keyboard 3G+Wifi
|
Quote:
Lupines |
|
01-26-2013, 11:54 PM | #7 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Flite!!!
THAT was what I was using before It's now officially a small world!! : D IIRC I ended up make a tmp text file "on-the-fly" as flite expects a file as an argument. (I recall looking at http://festvox.org/ too for a little time, think flite can convert the voices from that) Last edited by twobob; 01-27-2013 at 12:24 AM. |
01-27-2013, 02:50 PM | #8 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
My test [root@kindle root]# gst-launch filesrc location=/mnt/us/music/1351985926850497_song.mp3 ! decodebin ! alsasink
is a bit jumpy. will have to try it with the TTS. : ) EDIT: Only with certain mp3 rates... it's fine with many of them. thanks. and yes I know to: decodebin ! audioconvert ! audioresample ! alsasink Last edited by twobob; 01-27-2013 at 03:26 PM. |
01-27-2013, 11:18 PM | #9 | |
Member
Posts: 21
Karma: 59588
Join Date: Jan 2013
Device: Kindle Keyboard 3G+Wifi
|
Flite
Quote:
Even though I have libasound2-dev installed, it is complaining all over the place that it is missing. I did succeed in compiling it with oss support and doing the output to WAV files. Once I figure this one out I might bring it in another post. Lupines. |
|
01-27-2013, 11:21 PM | #10 | |
Member
Posts: 21
Karma: 59588
Join Date: Jan 2013
Device: Kindle Keyboard 3G+Wifi
|
MP3
Quote:
Lupines. |
|
01-28-2013, 04:18 AM | #11 | |||
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Quote:
Looks promising http://tcts.fpms.ac.be/synthesis/ Looks interesting http://archive.debian.net/lenny/armel/eflite/download Looks very interesting.. EDIT: it was moderately so... http://packages.debian.org/squeeze/a...speak/download also going to have a look at that one... Quote:
Will look to getting it native then... root@kindle:/# espeak -X "I am the funkiest kindle in the world" 2> /dev/null Spoiler:
Code:
aIa#m D@2 f'VNkI;@st k'Ind@L InD@2 w'3:ld I had trouble ripping the jack libs out of debian. Probably a native build of that app (without jack and pulseaudio) would go a long to way to bridging the gap you described in the top post. It exports the phoneme's to STDOUT as I have pictured via the -x option and --phonout="<filename>" Quote:
And the realtime speech synth would doubtless meet the needs of the casual "make it do something cool!" user also. That's my thoughts. Last edited by twobob; 01-28-2013 at 02:24 PM. |
|||
01-30-2013, 02:24 AM | #12 |
Member
Posts: 21
Karma: 59588
Join Date: Jan 2013
Device: Kindle Keyboard 3G+Wifi
|
Text to speech for the kindle keyboard
I was able to cross compile flite. flite is a text-to-speech software
that can be used in embedded software. I compiled it static so no libraries are needed. There is a bug that makes flite not to run on the first try. So for example if you run something like: # ./flite -t "Hello world!" You will hear nothing. But if you run it one more time, it works. I must be doing something wrong, or the libraries, or the binary, or the kindle. If you find out, please let everybody know on this post. Have fun, Lupines --------------------------------------------------------- Here are all the binaries for the lazy. You have to put all this into /mnt/us/ and it will work. https://mega.co.nz/#!vN8D2IoL!JucwYkjUNUCrBk5mT6Tk9HBRvvpaKA6Hth0O4hi H2M4 KEY: JucwYkjUNUCrBk5mT6Tk9HBRvvpaKA6Hth0O4hiH2M4 BUT!!! You only need this binary in order for it to work: https://mega.co.nz/#!HNFAELIa!eq019nC4U3F68dehDKufX1zjpphaATOrOmlDDyk T0Ug KEY: eq019nC4U3F68dehDKufX1zjpphaATOrOmlDDykT0Ug Mirror for both files -> ge.tt/86zHm1X Please refer to the flite instructions on how to use it here: http://www.speech.cs.cmu.edu/flite/doc/flite_7.html ---------------------------------------------------------- Now, if you are REALLY brave and want to compile it from scratch here are the instructions on how to build it from source. INSTRUCTIONS FOR THE CROSS COMPILER I got the cross compiler instructions for ARM from here: http://wiki.debian.org/BuildingCrossCompilers#Installing_a_Cross_Compiler ---------------------------------------------------------- COMPILING INSTRUCTIONS FOR alsa-lib Since the Kindle works under ALSA for audio, you must have a cross compiled version of alsa-lib-1.0.13. I believe a newer version of the ALSA libs could be used. I just tried this one and it works (sorta, read the end of the post) # wget http://gd.tuwien.ac.at/opsys/linux/a...1.0.13.tar.bz2 # bunzip2 alsa-lib-1.0.13.tar.bz2 ; tar -xvf alsa-lib-1.0.13.tar # cd alsa-lib-1.0.13 # ./configure --with-audio=alsa --prefix=/usr/local/arm-linux --host=arm-linux CC=arm-linux-gnueabi-gcc \ GCC=arm-linux-gnueabi-g++ CFLAGS=-DEMBEDDED CFLAGS="-I/usr/local/arm-linux/include" \ LDFLAGS="-L/usr/local/arm-linux/lib" LD_LIBRARY_PATH="/usr/local/arm-linux/lib" # make # make install ----------------------------------------------------------- COMPILING INSTRUCTIONS FOR flite First, you have to get flite-1.4.tar.gz # wget http://www.speech.cs.cmu.edu/flite/p...elease.tar.bz2 # bunzip2 flite-1.4-release.tar.bz2 ; tar -xvf flite-1.4-release.tar # cd flite-1.4-release First the /configure file needs to be changed. All the options for the different audio drivers must be removed. I just erased all of them and left this one: AUDIODRIVER="alsa" AUDIODEFS=-DCST_AUDIO_ALSA AUDIOLIBS=-lasound Using --with-audio=alsa didn't work for me. But I included in the ./configure anyways. These are the options I used for cross compiling flite: # ./configure --with-audio=alsa --prefix=/usr/local/arm-linux --host=arm-linux CC=arm-linux-gnueabi-gcc \ GCC=arm-linux-gnueabi-g++ CFLAGS=-DEMBEDDED CFLAGS="-I/usr/local/arm-linux/include" \ LDFLAGS="-L/usr/local/arm-linux/lib/alsa-lib" LD_LIBRARY_PATH="/usr/local/arm-linux/lib/alsa-lib" \ LDFLAGS="-L/usr/local/arm-linux/lib" LD_LIBRARY_PATH="-L/usr/local/arm-linux/lib" Run make (remember that this must be gnu make or gmake) # make This make will fail, and these are the instructions to fix it. --------------- Some of the files on flite need to be modified in order to get this to compile. # cd tools And change the Makefile inside /tools this: $(CC) $(CFLAGS) -o $@ find_sts_main.o $(FLITELIBFLAGS) $(LDFLAGS) for this: $(CC) -L/usr/local/arm-linux/lib $(CFLAGS) -o $@ find_sts_main.o $(FLITELIBFLAGS) $(LDFLAGS) and also, this: $(CC) $(CFLAGS) -o $@ flite_sort_main.o $(FLITELIBFLAGS) $(LDFLAGS) for this: $(CC) -L/usr/local/arm-linux/lib $(CFLAGS) -o $@ flite_sort_main.o $(FLITELIBFLAGS) $(LDFLAGS) --------------- Then you have to change the Makefile inside /main this: $(CC) $(CFLAGS) -o $@ flite_main.o flite_voice_list.o $(flite_LIBS_flags) $(LDFLAGS) for: $(CC) -L/usr/local/arm-linux/lib $(CFLAGS) -o $@ flite_main.o flite_voice_list.o $(flite_LIBS_flags) $(LDFLAGS) this: $(CC) $(CFLAGS) -o $@ flite_time_main.o $(flite_time_LIBS_flags) $(FLITELIBFLAGS) $(LDFLAGS) for: $(CC) -L/usr/local/arm-linux/lib $(CFLAGS) -o $@ flite_time_main.o $(flite_time_LIBS_flags) $(FLITELIBFLAGS) $(LDFLAGS) this: $(CC) $(CFLAGS) -o $@ t2p_main.o $(flite_LIBS_flags) $(LDFLAGS) for: $(CC) -L/usr/local/arm-linux/lib $(CFLAGS) -o $@ t2p_main.o $(flite_LIBS_flags) $(LDFLAGS) this: $(CC) $(CFLAGS) -o $@ compile_regexes.o $(FLITELIBFLAGS) $(LDFLAGS) for: $(CC) -L/usr/local/arm-linux/lib $(CFLAGS) -o $@ compile_regexes.o $(FLITELIBFLAGS) $(LDFLAGS) this: $(CC) $(CFLAGS) -o $@ flite_main.o flite_voice_list.o $(flite_LIBS_flags) $(LDFLAGS) for: $(CC) -L/usr/local/arm-linux/lib $(CFLAGS) -o $@ flite_main.o flite_voice_list.o $(flite_LIBS_flags) $(LDFLAGS) And finally... # sudo make install ---------------------------------------------- Last edited by Lupines; 01-31-2013 at 01:02 AM. |
01-30-2013, 02:33 AM | #13 | |
Member
Posts: 21
Karma: 59588
Join Date: Jan 2013
Device: Kindle Keyboard 3G+Wifi
|
text-to-speech, flite
Quote:
I got it to work. Lupines. |
|
01-30-2013, 06:35 AM | #14 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
The bug. That makes it not work the first time... It's probably the soundcard taking it's sweet time to respond. And probably not your fault. I seem to recall some horrible workaround I came up with.... erm... aplay ./10msSilence.wav; ./doNextThing.sh seems to ring a bell. I also seem to recall we possibly located a kernel level bug that was probably at fault. It would all be in the original Audio Thread I think
I can't seem to grab those mega files. Links okay? I am not getting a "Download files" or "Enter decryption key" page. Just the home page. Would like to play with them : D (Text to speech options in KUAL? maybe... would be nice to have some accessibility on the devices that can support it.) Once I can I will give this a full testing out. Great work. thanks. Last edited by twobob; 01-30-2013 at 07:35 AM. |
01-30-2013, 07:45 AM | #15 |
Linux devotee
Posts: 598
Karma: 2069047
Join Date: Feb 2011
Device: Kindle 3, Kindle 4B, Kindle PW2
|
Do you plan to create a ttsd replacement ?
Two years ago I started to work on it but then discovered a TTS voice suitable for the built-in TTS engine and lost my interest. All I have is a stub listening on DBus. |
Tags |
speech;text;flite, text;speech;wav;mp3 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kindle Touch. Text to Speech | cristbo | Amazon Kindle | 9 | 01-24-2014 04:31 AM |
Kindle Paperwhite Speech to Text? | Moshe1010 | Amazon Kindle | 4 | 12-26-2012 11:33 PM |
Troubleshooting text-to-speech feature in kindle | mestrys | Amazon Kindle | 4 | 01-11-2012 11:45 PM |
How to make Amazon Kindle Text to Speech skip over some text | xsaero00 | Kindle Developer's Corner | 3 | 06-18-2011 07:09 PM |