Added ttssr-human-only

master
ange 6 years ago
parent 26318959cc
commit 0712d4e6b0

@ -86,7 +86,6 @@ tts: output/chatbot.txt ocr/output.txt ## text to speech. Dependencies: espea
@echo $(color_w)
cat $? | espeak
ttstt: ocr/output.txt##text to speech, speech to text
cat $< | espeak -s 140 -v f2 --stdout > output/sound.wav
ttssr-human-only: ocr/output.txt ## Loop: text to speech-speech recognition. Dependencies: espeak, pocketsphinx
bash src/ttssr-loop-human-only.sh ocr/output.txt

@ -1,4 +0,0 @@
images/0004.jpg
images/0006.jpg

@ -1,199 +0,0 @@
[J MASTHEAD
int-F urniu . : .“lll' 'J
Masthead
Editorial Team
Ana (liruilhu
gmger twins
Ritardo Lat-Liente
Copy editor
Margaret Burnett
Pubfisher
ginger (001!g
Community Board
Dave Crossland
Louis Desmrdms
AVTTIt'TlL Hansoux
Alexandre Prokoudine
Femke Snelting
Contributors
Daxe Crossland. Maria Figueiredo, Nelson Concalves. Eric de
Haas Richard Hugheslonathan Puckey, Eric behriiver
Printed in Port. by Crornotema (http: troinotemapt) and in
T: into M Green Printer (http v.wwgreenprinteronlinc-.4 oml
in rerwled paper
Lli ensed under at redinek ummons Attril-uiioii-Rhare Alike
lli rl'lv: N l rmrsm '\|l . (Intent \hlluld be attributed to II\
iridiuidiial lUlhIlT all . ante-m \titli-iut :1 stated author 4 (iii lm
'TEdlir-diiiLilitflrir.1[il]ii\ Hagar”):-
Contacts
»\ Hi" to u .1! Hlllllllilv“.iiIlll11{"L“i.jplili trying i an:
HTTP: LIBRFl iRAlHll 'beU i.( HM
Images under a ( (' Attribution Sharr- Aliki- “1 Nine
llmii- mi piiigvi Vlll), lit, lii-i- all
I'll ill. u-l Ivu ii-lu l .illlllil“ liv. "\im .ir'..illi<I
l'li. ll "i|.i .1i ,illii l-'. llll i JIIIJHlI-I
Hit It .-l Iran-I i l.lllll lit nJl, i iii-.-.l.iiul
l'lwim ml l Iii lllliul ll, llllil4l,
lllll'ill iii-iii HI l,[n ! l4“.l1'll li.l'l «l 'Ill liiL'H m ”nape l-v lli- LI HJ'l lili i-.-'\ill.i
liillliJ'lvill' m li“.l.llv ll In“: .H l:, him. lmi llhli, .mvl lliigu l'i-iii-Im
H i 'm 'wil4lw HI Hlili'l w! ,iI'liialJH»! ll. l'lwlirl .H'lJlIH lliiiimli-iiminli-u
'llldl i vin H .mvl . in “'-I_illl'i ”ll )vlmlna .Lllll lliv v-m'i-liuii ml ylliiyyi I-HIII. iiliuiw.
. .iii lu' linHliil .il l lii Li ill Illl' pl.” min-am 'il ilh \ll'l ii'ulimli iilliilmllliillall-i
“>“lllliv li-llll i "il'|' .Iiililll<.llllildllillillltilllllHiliJluIi iiu-iiliniiiul
ilu'iu-m ".li ~lli lll'lll'll'l lvi Milt Ilii l'ul'lillilll ml llIV'.|Vl lilgliliinni lll lll" .llllv ll
lei. ,tmiiln. .lli it il l 'lliltlllI R.lll\ ll yr lli rim .1 lllltlll (i H»
lllii,li,illlili'. iii Jul-la Illil“".lll-lll,i1llil 5pm. .m lllll'l\ll .\ .'.llll loin | l'r lmri
li, l'llll l l i lllll'l
l'li I- ill ' “l'4ll||l)_ lilliii ' llii l l"|i|-iillilli \.ilil-I.iliiiii \rlil lix l-'ii ll-Illl llllllllv“.
Lin, lump- “it l-i .) ml I. .II' Ill-Ill | Via ii'nlii-rlil Ill i ill|ll|ll|ll\l'-
. . , Linn-1.; u“...
A Readers Guide to Libre Graphics Magazine
In this magazine. you may find concepts. words. ideas and
things which are new to you. Good. That means your
horizons are expanding. The problem with that, of course. is
that sometimes things with steep learning curves are less fun
than those without.
That's why we're trying to flatten the learning curve. If. while
reading Libre Graphics magazine. you encounter an unfami ar
word. project name. whatever it may be. chances are good
there's an explanation.
At the back of this magazine. you'll find a glc ary and
resource list. The glossary aims to define we 5 that are
unique to the world ofLibre Graphics. The resource list
provides valuable information about tools. licenses. whatever
items we may be mentioning.
Practically. this means that if. for example. you're reading an
article about Paper.js (see pages 30 and '31). you can alwc
flip to the back of the magazine. look up Paperjs in the
resource list and become quickly informed about it. This
provides some instant gratification. giving you the resources
you need to understand. in a moment. just what were tallxii
about.
We hope you like our system.
Images under other li- (ll\1\
llinlu. HI [lepaii ls" l“ ,l lx\ lniiiiim Harlem-s .iir iiIi-ler\ \ \k \-\ Him ueic
['lllll.'llil lll'll' \\lllt lllt llt'HlIHsIUH iii ilull .nillini
«minim- ~. lil'yI imagi- iiml m'liml .il Mil' l-x \\ Ikiiiietlm iisei llieiimli lion-(i l\ in (he
lllll'llk ilniimiii .llhl l .Iii ln imiinl .ii
llll" A:vll|ilhll\ \\|l\lll\l'\l|.l wig \\iki tile“ \lnilviil Nautical (”lupin Row pm:
t-i-m'ml
\-l\l'lilv(lll1'l|l\ \\|lll llic r\i(|rlll'll n! Hui-.r' “Tie-muting l il-ic \liaplin s Hagaluw. .Ils
iml IN“ i-.Illl\ -iv\('1l'\| lu the blanket i L in \~\ il: ruse ll h lit-st in \ hei L \ulii the
'llilKl I» llnv ll'l'lr'dlll liclI-n ir'uullig llHllI
in
” EDITOR'S LETTE
i.i.i: Liruii If"
Editor's letter
ginger coons
\K'e so often draw a strong distinction between the physical
and the digital. acting as ifthe one is solid. staid and reliable.
while the other is born in ether. unreal and untouchable. This
is far from the case. Not only on occasion. but always. the
physical and the digital are intimately intertwined.
The digital is merely a subset of the physical. It is a land we've
come to view as different and distinct. despite its reliance on
the physical. Regardless otour perceptions. the two tick along.
happily o-operating and relying on one another. As the
digital fails to esCape the bounds of the physical. the physical
comes to embrace its part in the success of the digital.
I vraphic design and media arts are fields Well atquainted with
the obvious areas oi overlap between the phv. cal and the
digital. From the days of air brushing and drafting by hand.
to the bringing of those same metaphors into the realm of
digital production. designers :tllCl media artists are at the
l'orvlront of both the conilicts and the embraces ol the digital
and the ['ilI\“sI(.'.il,
\x'ln-thr-r it lIIdl]lli“--l-fi itsr-ll' III .1 worktlow innirporatiiig lmilI
(llcIiul .iinl [il'iVHIMIl I'iIi'llimlS. lo ilIHiI'ilit Hills HI' WllcllM'I' It Is
.i lI'.IIi-l|iIIIIiiiIiIH which takes plan- iii the slim c lHthilI tlic
li..«i Ii.ilIIi:-.. llll' point til IIIii'ImlIliII lltlWi'I'II tllt' tllLLJiJl .Ill(l
the physical is a special place. And it bears exploring.
F Loss graphics and art fields are taking up that exploration in
magnificent ways. In the world of F toss. the space where the
digital and the physical collide is becoming beautifully
populated.
This issue of Litre Graphics magazine is about border caSes.
the role ofintentionality and happy ' cident in the mingling
of physical and digital. and any and a .l points of intersection.
We're exploring the translation from the digital to the
physical. the phys' al to the digital and the careful mapping of
the two. We're looking at the pldkt oi history and the promise
of the future in harmoniously melding our media.
Were looking at tolds. sprays. cuts and prints. Were looking
.it mapping worlds onto each other. In short, in this issue.
we're looking .it collisions:

@ -0,0 +1,92 @@
#!/usr/bin/env python3
import speech_recognition as sr
import sys
from termcolor import cprint, colored
# obtain path to "english.wav" in the same folder as this script
from os import path
import random
a1 = sys.argv[1] #same as $1 so when you run python3 audio_transcribe.py FOO ... argv[1] is FOO
# print ("transcribing", a1, file=sys.stderr)
AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), a1) # before it was english.wav
# AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "french.aiff")
# AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "chinese.flac")
# print (AUDIO_FILE)
# use the audio file as the audio source
r = sr.Recognizer()
with sr.AudioFile(AUDIO_FILE) as source:
audio = r.record(source) # read the entire audio file
color = ["white", "yellow"]
on_color = ["on_red", "on_magenta", "on_blue", "on_grey"]
# recognize speech using Sphinx
try:
cprint( r.recognize_sphinx(audio), random.choice(color), random.choice(on_color))
# print( r.recognize_sphinx(audio))
except sr.UnknownValueError:
print("uknown")
except sr.RequestError as e:
print("Sphinx error; {0}".format(e))
# sleep (1)
# # recognize speech using Google Speech Recognition
# try:
# # for testing purposes, we're just using the default API key
# # to use another API key, use `r.recognize_google(audio, key="GOOGLE_SPEECH_RECOGNITION_API_KEY")`
# # instead of `r.recognize_google(audio)`
# print("Google Speech Recognition thinks you said " + r.recognize_google(audio))
# except sr.UnknownValueError:
# print("Google Speech Recognition could not understand audio")
# except sr.RequestError as e:
# print("Could not request results from Google Speech Recognition service; {0}".format(e))
# # recognize speech using Google Cloud Speech
# GOOGLE_CLOUD_SPEECH_CREDENTIALS = r"""INSERT THE CONTENTS OF THE GOOGLE CLOUD SPEECH JSON CREDENTIALS FILE HERE"""
# try:
# print("Google Cloud Speech thinks you said " + r.recognize_google_cloud(audio, credentials_json=GOOGLE_CLOUD_SPEECH_CREDENTIALS))
# except sr.UnknownValueError:
# print("Google Cloud Speech could not understand audio")
# except sr.RequestError as e:
# print("Could not request results from Google Cloud Speech service; {0}".format(e))
# # recognize speech using Wit.ai
# WIT_AI_KEY = "INSERT WIT.AI API KEY HERE" # Wit.ai keys are 32-character uppercase alphanumeric strings
# try:
# print("Wit.ai thinks you said " + r.recognize_wit(audio, key=WIT_AI_KEY))
# except sr.UnknownValueError:
# print("Wit.ai could not understand audio")
# except sr.RequestError as e:
# print("Could not request results from Wit.ai service; {0}".format(e))
# # recognize speech using Microsoft Bing Voice Recognition
# BING_KEY = "INSERT BING API KEY HERE" # Microsoft Bing Voice Recognition API keys 32-character lowercase hexadecimal strings
# try:
# print("Microsoft Bing Voice Recognition thinks you said " + r.recognize_bing(audio, key=BING_KEY))
# except sr.UnknownValueError:
# print("Microsoft Bing Voice Recognition could not understand audio")
# except sr.RequestError as e:
# print("Could not request results from Microsoft Bing Voice Recognition service; {0}".format(e))
# # recognize speech using Houndify
# HOUNDIFY_CLIENT_ID = "INSERT HOUNDIFY CLIENT ID HERE" # Houndify client IDs are Base64-encoded strings
# HOUNDIFY_CLIENT_KEY = "INSERT HOUNDIFY CLIENT KEY HERE" # Houndify client keys are Base64-encoded strings
# try:
# print("Houndify thinks you said " + r.recognize_houndify(audio, client_id=HOUNDIFY_CLIENT_ID, client_key=HOUNDIFY_CLIENT_KEY))
# except sr.UnknownValueError:
# print("Houndify could not understand audio")
# except sr.RequestError as e:
# print("Could not request results from Houndify service; {0}".format(e))
# # recognize speech using IBM Speech to Text
# IBM_USERNAME = "INSERT IBM SPEECH TO TEXT USERNAME HERE" # IBM Speech to Text usernames are strings of the form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
# IBM_PASSWORD = "INSERT IBM SPEECH TO TEXT PASSWORD HERE" # IBM Speech to Text passwords are mixed-case alphanumeric strings
# try:
# print("IBM Speech to Text thinks you said " + r.recognize_ibm(audio, username=IBM_USERNAME, password=IBM_PASSWORD))
# except sr.UnknownValueError:
# print("IBM Speech to Text could not understand audio")
# except sr.RequestError as e:
# print("Could not request results from IBM Speech to Text service; {0}".format(e))

@ -1,2 +0,0 @@
o=open('output/sound.wav', 'r')
original = o.read()

@ -0,0 +1,18 @@
#!/bin/bash
i=0;
#cp $1 output/input0.txt
echo "Read every new sentence out loud!"
head -n 1 $1 > output/input0.txt
while [[ $i -le 10 ]]
do echo $i
cat output/input$i.txt
python3 src/write_audio.py src/sound$i.wav 2> /dev/null
play src/sound$i.wav repeat 5 2> /dev/null & #in the background the sound, without it all the sounds play one by one//2 is stderr
python3 src/audio_transcribe.py sound$i.wav > output/input$((i+1)).txt 2> /dev/null
sleep
(( i++ ))
done
today=$(date +%Y-%m-%d);
mkdir -p "output/ttssr.$today"
mv -v output/input* output/ttssr.$today;
mv -v src/sound* output/ttssr.$today;

@ -0,0 +1,25 @@
#!/usr/bin/env python3
# https://github.com/Uberi/speech_recognition/blob/master/examples/write_audio.py
# NOTE: this example requires PyAudio because it uses the Microphone class
import speech_recognition as sr
import sys
from time import sleep
a1 = sys.argv[1]
# obtain audio from the microphone
r = sr.Recognizer()
with sr.Microphone() as source:
# print("Read every new sentence out loud!")
audio = r.listen(source)
# sleep (1)
#
# # write audio to a RAW file
# with open("microphone-results.raw", "wb") as f:
# f.write(audio.get_raw_data())
# write audio to a WAV file
with open(a1, "wb") as f:
f.write(audio.get_wav_data())
Loading…
Cancel
Save