Tuesday 13 May 2014

Speech synthesizer

We need

  • Raspberry Pi with ArchLinux
  • Sound output devices connected to mini-jack. I use amplituner with spekares. For tests we can use computer speakers or headphone.
 

Base sound software

Install:
# pacman -Sy alsa-utils alsa-plugins
call sound test:
# speaker-test -c 2

We should hear the test sound.


Festival synthesizer

Install Festival synthesizer:
# pacman -Sy festival festival-english
call Festival test from command line:
# echo "Hello Dave" | festival --tts
We should hear sound "Hello Dave".

Next step, we call Festival from Python code (is useful in the future). If it does not exist, create a directory
# mkdir robot   
create Python enviroment:
# cd robot/
# virtualenv2 --no-site-packages python_festival_test
# cd python_festival_test/
# source bin/activate
create file festivalTest.py:
import subprocess
text = '"Hello Dave"'
subprocess.call('echo '+text+'|festival --tts', shell=True)
call script:
# python2.7 festivalTest.py
We should hear sound "Hello Dave".

Additional

Install command line mp3 player:
# pacman -Sy mpg123

and play mp3 file:
# mpg123 example_file.mp3
Sound volume, check status:
# amixer
example response:
Simple mixer control 'PCM',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback -10239 - 400
  Mono: Playback 40 [97%] [0.40dB] [on]
change volume:
# amixer cset numid=1 -- $sound_volume
where:
$sound_volume - is number beetwen -10239 and 400
numid - output: 0=auto, 1=analog, 2=hdmi




links:
https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture
http://www.correderajorge.es/can-your-raspberry-pi-talk-2/
http://machakux.appspot.com/blog/44003/making_speech_with_python
http://www.raspberrypi-spy.co.uk/2013/06/raspberry-pi-command-line-audio/
http://www.imdb.com/character/ch0002900/quotes


No comments:

Post a Comment

Note: only a member of this blog may post a comment.