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-pluginscall sound test:
# speaker-test -c 2
We should hear the test sound.
Festival synthesizer
Install Festival synthesizer:# pacman -Sy festival festival-englishcall Festival test from command line:
# echo "Hello Dave" | festival --ttsWe 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 robotcreate Python enviroment:
# cd robot/create file festivalTest.py:
# virtualenv2 --no-site-packages python_festival_test
# cd python_festival_test/
# source bin/activate
import subprocesscall script:
text = '"Hello Dave"'
subprocess.call('echo '+text+'|festival --tts', shell=True)
# python2.7 festivalTest.pyWe should hear sound "Hello Dave".
Additional
Install command line mp3 player:# pacman -Sy mpg123
and play mp3 file:
# mpg123 example_file.mp3Sound volume, check status:
# amixerexample response:
Simple mixer control 'PCM',0change volume:
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback -10239 - 400
Mono: Playback 40 [97%] [0.40dB] [on]
# amixer cset numid=1 -- $sound_volumewhere:
$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.