Merge branch 'master' of git.xpub.nl:/var/www/git.xpub.nl/repos/OuNuPo-make

master^2
Alice 7 years ago
commit 89924d0e55

1
.gitignore vendored

@ -4,3 +4,4 @@ src/index.json
src/database.json src/database.json
.DS_Store .DS_Store
src/**.wav src/**.wav
ocr/list.txt

@ -41,11 +41,6 @@ dirs: ## create the dirs in working dir
@echo $(color_r)'Directories made': ocr/ hocr/ images/ images-tiff/ output/ @echo $(color_r)'Directories made': ocr/ hocr/ images/ images-tiff/ output/
testif:
ifeq ($(OS),Darwin)
@echo $(OS)
endif
# POST-PROCESSING RECIPES # POST-PROCESSING RECIPES
ocr/output.txt: ## ocr with tesseract ocr/output.txt: ## ocr with tesseract
@ -112,18 +107,6 @@ replace:tiffs hocrs ## Natasha: Analyzes pages in order, replace least common wo
rm $(input-hocr) rm $(input-hocr)
rm $(images-tiff) rm $(images-tiff)
visualization: $(images) $(tmpfile) ##Creates data visualization from images/*.jpg. Dependencies: mplayer
@echo $(tmpfile)
for i in $(images); do \
cat $$i >> $(tmpfile); \
done;
ifeq ($(OS),Darwin)
cat $(tmpfile) | mplayer -sws 4 -zoom -vf dsize=720:720 -demuxer rawvideo -rawvideo w=56:h=64:i420:fps=25 -;
else
cat $(tmpfile) | mplayer -vo x11 -sws 4 -zoom -vf dsize=720:720 -demuxer rawvideo -rawvideo w=50:h=50:i420:fps=25 -;
endif
ttssr-human-only: ocr/output.txt ## Loop: text to speech-speech recognition. Dependencies: espeak, pocketsphinx 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 bash src/ttssr-loop-human-only.sh ocr/output.txt

140
README

@ -1,12 +1,12 @@
# OuNuPo Make # OuNuPo Make
Software experiments for the OuNuPo bookscanner, part of Special Issue 5 Software experiments for the OuNuPo bookscanner, part of Special Issue 5
https://issue.xpub.nl/05/ <https://issue.xpub.nl/05/>
https://xpub.nl/ <https://git.xpub.nl/OuNuPo-make/>
<https://xpub.nl/>
## License
## Authors ## Authors
Natasha Berting, Angeliki Diakrousi, Joca van der Horst, Alexander Roidl, Alice Strete and Zalán Szakács. Natasha Berting, Angeliki Diakrousi, Joca van der Horst, Alexander Roidl, Alice Strete and Zalán Szakács.
@ -24,58 +24,55 @@ Natasha Berting, Angeliki Diakrousi, Joca van der Horst, Alexander Roidl, Alice
# Make commands # Make commands
## N+7 (example) Author
Description: Replaces every noun with the 7th next noun in a dictionary. Inspired by an Oulipo work of the same name.
run: `make N+7`
Specific Dependencies:
* a
* b
* c
## Sitting inside a pocket(sphinx): Angeliki ## Sitting inside a pocket(sphinx): Angeliki
Description: Speech recognition feedback loops using the first sentence of a scanned text as input Speech recognition feedback loops using the first sentence of a scanned text as input
run: `make ttssr-human-only` run: `make ttssr-human-only`
Specific Dependencies: Specific Dependencies:
* PocketSphinx package `sudo aptitude install pocketsphinx pocketsphinx-en-us` * PocketSphinx package `sudo aptitude install pocketsphinx pocketsphinx-en-us`
* PocketSphinx: `sudo pip3 install PocketSphinx` * PocketSphinx Python library: `sudo pip3 install PocketSphinx`
* Python Libaries:`sudo apt-get install gcc automake autoconf libtool bison swig python-dev libpulse-dev` * Other software packages:`sudo apt-get install gcc automake autoconf libtool bison swig python-dev libpulse-dev`
* Speech Recognition: `sudo pip3 install SpeechRecognition` * Speech Recognition Python library: `sudo pip3 install SpeechRecognition`
* TermColor: `sudo pip3 install termcolor` * TermColor Python library: `sudo pip3 install termcolor`
* PyAudio: `pip3 install pyaudio` * PyAudio Python library: `sudo pip3 install pyaudio`
### Licenses:
© 2018 WTFPL Do What the Fuck You Want to Public License.
© 2018 BSD 3-Clause Berkeley Software Distribution
## Reading the Structure: Joca ## Reading the Structure: Joca
Description: Uses OCR'ed text as an input, labels each word for Part-of-Speech, stopwords and sentiment. Then it generates a reading interface Uses OCR'ed text as an input, labels each word for Part-of-Speech, stopwords and sentiment. Then it generates a reading interface
where words with a specific label are hidden. Output can be saved as poster, or exported as json featuring the full data set. where words with a specific label are hidden. Output can be saved as poster, or exported as json featuring the full data set.
Run: `make reading_structure` Run: `make reading_structure`
Specific Dependencies: Specific Dependencies:
* nltk (http://www.nltk.org/install.html)
* tokenize.punkt, pos_tag, word_tokenize, sentiment.vader, vader_lexicon (python3, import NLTK, nltk.download() and select these models) * [NLTK](http://www.nltk.org/install.html) packages: tokenize.punkt, pos_tag, word_tokenize, sentiment.vader, vader_lexicon (python3; import nltk; nltk.download() and select these models)
* spaCy (https://spacy.io/usage/) * [spaCy](https://spacy.io/usage/) Python library
* spacy en_core_web_sm model (python3 -m spacy download en_core_web_sm) * spacy: en_core_web_sm model (python3 -m spacy download en_core_web_sm)
* weasyprint (http://weasyprint.readthedocs.io/en/latest/install.html) * [weasyprint](http://weasyprint.readthedocs.io/en/latest/install.html)
* jinja2 (http://jinja.pocoo.org/docs/2.10/intro/#installation) * [jinja2](http://jinja.pocoo.org/docs/2.10/intro/#installation)
* font: PT Sans (os font https://www.fontsquirrel.com/fonts/pt-serif) * font: [PT Sans]( https://www.fontsquirrel.com/fonts/pt-serif)
* font: Ubuntu Mono (os font https://www.fontsquirrel.com/fonts/ubuntu-mono) * font: [Ubuntu Mono](https://www.fontsquirrel.com/fonts/ubuntu-mono)
License: GNU AGPLv3 ### License: GNU AGPLv3
Permissions of this license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Permissions of this license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license.
Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights.
When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.
See src/reading_structure/license.txt for the full license. See src/reading_structure/license.txt for the full license.
## Erase / Replace: Natasha ## Erase / Replace: Natasha
Description: Receives your scanned pages in order, then analyzes each image and its vocabulary. Finds and crops the least common words, and either erases them, or replaces them with the most common words. Outputs a PDF of increasingly distorted scan images. Description: Receives your scanned pages in order, then analyzes each image and its vocabulary. Finds and crops the least common words, and either erases them, or replaces them with the most common words. Outputs a PDF of increasingly distorted scan images.
for erase script run: `make erase` For erase script run: `make erase`
for replace script run: `make replace`
For replace script run: `make replace`
Specific Dependencies: Specific Dependencies:
* NLTK English Corpus: * NLTK English Corpus:
@ -85,62 +82,73 @@ Specific Dependencies:
* "Download" * "Download"
* Python Image Library (PIL): `pip3 install Pillow` * Python Image Library (PIL): `pip3 install Pillow`
* PDF generation for Python (FPDF): `pip3 install fpdf` * PDF generation for Python (FPDF): `pip3 install fpdf`
* HTML5lib: `pip3 install html5lib` * HTML5lib Python Library: `pip3 install html5lib`
Notes & Bugs: ### Notes & Bugs:
This script is very picky about the input images it can work with. For best results, please use high resolution images in RGB colorspace. Errors can occur when image modes do not match or tesseract cannot successfully make HOCR files. This script is very picky about the input images it can work with. For best results, please use high resolution images in RGB colorspace. Errors can occur when image modes do not match or tesseract cannot successfully make HOCR files.
Author: Alice Strete (RO)
## carlandre & over/under: Alice Strete
Person who aspires to call herself a software artist sometime next year. Person who aspires to call herself a software artist sometime next year.
License: ### License:
Copyright © 2018 Alice Strete Copyright © 2018 Alice Strete
This work is free. You can redistribute it and/or modify it under the This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To Public License, Version 2, terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
Programs:
## carlandre ### Dependencies:
* [pytest](https://docs.pytest.org/en/latest/getting-started.html)
Programs:
### carlandre
Description: Generates concrete poetry from a text file. If you're connected to a printer located in /dev/usb/lp0 you can print the poem. Description: Generates concrete poetry from a text file. If you're connected to a printer located in /dev/usb/lp0 you can print the poem.
run: make carlandre run: `make carlandre`
Dependencies:
* pytest (Documentation: https://docs.pytest.org/en/latest/getting-started.html)
## over/under ### over/under
Description: Interpreted programming language written in Python3 which translates basic weaving instructions into code and applies them to text. Description: Interpreted programming language written in Python3 which translates basic weaving instructions into code and applies them to text.
run: make overunder run: `make overunder`
Instructions: ### Instructions:
over/under works with specific commands which execute specific instructions. * over/under works with specific commands which execute specific instructions.
When running, an interpreter will open: * When running, an interpreter will open:
> `> `
To load your text, type 'load'. This is necessary before any other instructions. Every time you load the text, the previous instructions will be discarded. * To load your text, type 'load'. This is necessary before any other instructions. Every time you load the text, the previous instructions will be discarded.
To see the line you are currently on, type 'show'. * To see the line you are currently on, type 'show'.
To start your pattern, type 'over' or 'under', each followed by an integer, separated by a comma. * To start your pattern, type 'over' or 'under', each followed by an integer, separated by a comma.
e.g. over 5, under 5, over 6, under 10 e.g. over 5, under 5, over 6, under 10
To move on to the next line of text, press enter twice. * To move on to the next line of text, press enter twice.
To see your pattern, type 'pattern'. * To see your pattern, type 'pattern'.
To save your pattern in a text file, type 'save'. * To save your pattern in a text file, type 'save'.
To leave the program, type 'quit'. * To leave the program, type 'quit'.
## oulibot: Alex ## oulibot: Alex
Description: Chatbot that will help you to write a poem based on the text you inserted by giving you constraints. Description: Chatbot that will help you to write a poem based on the text you inserted by giving you constraints.
run: make oulibot run: `make oulibot`
#### Dependencies:
Python libraries
* irc : `pip3 install irc`
* rake_nltk Python library: `pip3 install rake_nltk`
* textblob: `pip3 install textblob`
* PIL: `pip3 install Pillow`
* numpy: `pip3 install numpy`
* tweepy: `pip3 install tweepy`
* NLTK stopwords:
* run NLTK downloader `python -m nltk.downloader`
* select menu "Corpora"
* select "stopwords"
* "Download"
Dependencies:
irc.bot: pip3 install irc_client
nltk: pip3 install nltk && python3 -m nltk.downloader
rake_nltk: pip3 install rake_nltk
nltk.tokenize
nltk.corpus
textblob: pip3 install textblob
PIL: pip3 install Pillow
numpy: pip3 install numpy
tweepy: pip3 install tweepy

@ -1,2 +1,3 @@
images/0029.jpg

File diff suppressed because one or more lines are too long

@ -48,6 +48,11 @@ basicDialog = [
"Would it really help you to get %1?", "Would it really help you to get %1?",
"Are you sure you need %1?"]], "Are you sure you need %1?"]],
[r"I don't like (.*)",
[ "Why don't you like %1?",
"It's a pitty that you don't like poems %1?",
"will you ever change your mind about %1?"]],
[r'Do you think (.*)', [r'Do you think (.*)',
[ "Yes I think %1", [ "Yes I think %1",
"I think you should set yourself contraints", "I think you should set yourself contraints",
@ -147,10 +152,13 @@ def chunks(l, n):
class HelloBot(irc.bot.SingleServerIRCBot): class HelloBot(irc.bot.SingleServerIRCBot):
def __init__(self, channel, nickname, server, port=6667, index=None): def __init__(self, channel, nickname, server, port=6667, index=None):
irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname)
print("Oulibot is connecting")
print("go to webchat.freenode.net and log into the channel #exquisite to talk")
print("On twitter @ExquisiteChat")
self.channel = channel self.channel = channel
self.index = index self.index = index
self.lastAnswer = "" self.lastAnswer = ""
self.lastincoming_msg = ["common", "statement"] self.lastincoming_msg = ["common", "statement", "test"]
self.sentence = [] self.sentence = []
self.waitingfor = "" self.waitingfor = ""
self.lastPOS = 0 self.lastPOS = 0
@ -251,31 +259,37 @@ class HelloBot(irc.bot.SingleServerIRCBot):
incoming_msg = e.arguments[0] incoming_msg = e.arguments[0]
incoming_msg = incoming_msg.lower() incoming_msg = incoming_msg.lower()
#Greetings #Greetings
if(self.lastincoming_msg[-2] == incoming_msg): if(self.lastincoming_msg[-2] == incoming_msg and self.lastincoming_msg[-3] == incoming_msg ):
answers = ["and again", "repetition can be a nice tool, but talk normal to me, please.", "WHY ARE YOU WRITING THE SAME THING TWICE, JUST USE THE CHAT HISTORY!"] answers = ["and again", "repetition can be a nice tool, but talk normal to me, please.", "WHY ARE YOU WRITING THE SAME THING TWICE, JUST USE THE CHAT HISTORY!"]
msg = random.choice(answers) msg = random.choice(answers)
self.lastAnswer="repetition"
c.privmsg(self.channel,msg) c.privmsg(self.channel,msg)
elif "hi " in incoming_msg or incoming_msg == "hi" or "hallo " in incoming_msg or incoming_msg == "hello" or "hello " in incoming_msg or "hoi " in incoming_msg or incoming_msg == "hey": elif "hi " in incoming_msg or incoming_msg == "hi" or "hallo " in incoming_msg or incoming_msg == "hello" or "hello " in incoming_msg or "hoi " in incoming_msg or incoming_msg == "hey":
greetingsanswers = ["hi {}".format(e.source.split("!")[0]), "hey there"] greetingsanswers = ["hi {}".format(e.source.split("!")[0]), "hey there"]
msg = random.choice(greetingsanswers) msg = random.choice(greetingsanswers)
c.privmsg(self.channel,msg) c.privmsg(self.channel,msg)
c.privmsg(self.channel,"I'm your personal writing assistent, how can i help you?") answers = ["I'm your personal writing assistent, how can i help you?", "i like to write poems together with people, would be nice if you would join me."]
msg = random.choice(answers)
c.privmsg(self.channel,msg)
elif "how are you" in incoming_msg or "hows it going" in incoming_msg: elif "how are you" in incoming_msg or "hows it going" in incoming_msg:
answers = ["I'm fine.".format(e.source.split("!")[0]), "great, I'd really like to help you with your writing"] answers = ["I'm fine.".format(e.source.split("!")[0]), "great, I'd really like to help you with your writing"]
msg = random.choice(answers) msg = random.choice(answers)
c.privmsg(self.channel,msg) c.privmsg(self.channel,msg)
elif "explain" in incoming_msg or "how does it work" in incoming_msg or "what is this about?" in incoming_msg or "what is this?" in incoming_msg:
self.explanation(c,e)
self.lastAnswer="explain"
elif "are" in incoming_msg and ("real" in incoming_msg or "human" in incoming_msg or "bot" in incoming_msg): elif "are" in incoming_msg and ("real" in incoming_msg or "human" in incoming_msg or "bot" in incoming_msg):
answers = ["I'm neither a bot nor a human, I don't think in categories. :-)", "I consider myself transpysical ~\0/~", "Real, is everything you see, so here I am, I am writing with you"] answers = ["I'm neither a bot nor a human, I don't think in categories. :-)", "I consider myself transpysical ~\0/~", "Real, is everything you see, so here I am, I am writing with you"]
msg = random.choice(answers) msg = random.choice(answers)
c.privmsg(self.channel,msg) c.privmsg(self.channel,msg)
elif "poem" in incoming_msg: elif "poem" in incoming_msg and ("no" not in incoming_msg or "don't" not in incoming_msg):
self.level=0 self.level=0
self.explanation_poem(c,e) self.explanation_poem(c,e)
elif self.checkAffirmation(incoming_msg) and (self.lastAnswer == "Do you want to write a poem together with me?" or self.lastAnswer=="Are you up for a poem now?" or self.lastAnswer=="We could write a poem together, what do you think?"): elif self.checkAffirmation(incoming_msg) and (self.lastAnswer == "Do you want to write a poem together with me?" or self.lastAnswer=="Are you up for a poem now?" or self.lastAnswer=="We could write a poem together, what do you think?"):
self.level=0 self.level=0
self.explanation_poem(c,e) self.explanation_poem(c,e)
elif self.checkNegation(incoming_msg) and (self.lastAnswer == "Do you want to write a poem together with me?" or self.lastAnswer=="Are you up for a poem now?" or self.lastAnswer=="We could write a poem together, what do you think?"): elif self.checkNegation(incoming_msg) and (self.lastAnswer == "Do you want to write a poem together with me?" or self.lastAnswer=="Are you up for a poem now?" or self.lastAnswer=="We could write a poem together, what do you think?"):
if self.checkNegation(self.lastincoming_msg[-2]): if self.checkNegation(self.lastincoming_msg[-2]) and self.checkNegation(self.lastincoming_msg[-3]):
answers = ["You don't seem very motivated, I'm gonna generate some ASCII Art for you out of the text. Maybe this will inspire you ;-)", answers = ["You don't seem very motivated, I'm gonna generate some ASCII Art for you out of the text. Maybe this will inspire you ;-)",
"Come on! Maybe some ASCII Art will help you to get motivated?", "Come on! Maybe some ASCII Art will help you to get motivated?",
"Ok, you refuse a lot, but nobody will ever refuse some raaaaandom ASCII AAAART :-)", "Ok, you refuse a lot, but nobody will ever refuse some raaaaandom ASCII AAAART :-)",
@ -286,9 +300,10 @@ class HelloBot(irc.bot.SingleServerIRCBot):
answers = ["Are you up for a poem now?", "Do you want to write a poem together with me?", answers = ["Are you up for a poem now?", "Do you want to write a poem together with me?",
"We could write a poem together, what do you think?"] "We could write a poem together, what do you think?"]
msg = random.choice(answers) msg = random.choice(answers)
self.lastincoming_msg.append("ASCII")
c.privmsg(self.channel,msg) c.privmsg(self.channel,msg)
else: else:
answers = ["try it, it's gonna be fun!", "oh, really? come on!", "I think you would do a great job! Let's go!"] answers = ["try it, it's gonna be fun!", "oh, really? come on!", "I think you would do a great job! Let's go!", "hm ok", "what a pitty you miss something :-(", ":-(", "But poems are my only profession, let me show you how nice they are", "It won't take long...", "It's a unique opportunity"]
msg = random.choice(answers) msg = random.choice(answers)
c.privmsg(self.channel,msg) c.privmsg(self.channel,msg)
else: else:
@ -299,6 +314,7 @@ class HelloBot(irc.bot.SingleServerIRCBot):
c.privmsg(self.channel, "Ok, let's try to write a poem together") c.privmsg(self.channel, "Ok, let's try to write a poem together")
c.privmsg(self.channel, "It's gonna be based on the scanned text you inserted into my drive") c.privmsg(self.channel, "It's gonna be based on the scanned text you inserted into my drive")
c.privmsg(self.channel, "Your only task is to follow the structure I give you") c.privmsg(self.channel, "Your only task is to follow the structure I give you")
c.privmsg(self.channel, "It's gonna be 5 lines long")
c.privmsg(self.channel, "I'm gonna start, are you ready?") c.privmsg(self.channel, "I'm gonna start, are you ready?")
self.lastAnswer = "towardspoem" self.lastAnswer = "towardspoem"
@ -313,6 +329,7 @@ class HelloBot(irc.bot.SingleServerIRCBot):
def on_welcome(self, c, e): def on_welcome(self, c, e):
c.join(self.channel) c.join(self.channel)
self.explanation(c,e) self.explanation(c,e)
print("I'm connected now!")
def on_privmsg(self, c, e): def on_privmsg(self, c, e):
pass pass
@ -328,7 +345,10 @@ class HelloBot(irc.bot.SingleServerIRCBot):
finished_sentence = " ".join(self.sentence) finished_sentence = " ".join(self.sentence)
self.poem.append(finished_sentence) self.poem.append(finished_sentence)
c.privmsg(self.channel, " ".join(self.sentence)) c.privmsg(self.channel, " ".join(self.sentence))
c.privmsg(self.channel, "Nice one! Let's add another line:")
answers = ["Nice one! Let's add another line:", "Sounds good so far, nex line:", "yes, next line follows:", "that one is very poetic", "a little bit abstract, but still nice", "let's add another line"]
msg = random.choice(answers)
c.privmsg(self.channel,msg)
self.lastAnswer = "Nice one! Let's add another line:" self.lastAnswer = "Nice one! Let's add another line:"
if random.choice([True, False]): if random.choice([True, False]):
self.lastPOS =-1 self.lastPOS =-1
@ -410,7 +430,7 @@ class HelloBot(irc.bot.SingleServerIRCBot):
self.generateSentence(c,e) self.generateSentence(c,e)
self.level = 1 self.level = 1
else: else:
if self.checkNegation(self.lastincoming_msg[-2]): if self.checkNegation(self.lastincoming_msg[-2]) and self.checkNegation(self.lastincoming_msg[-3]):
answers = ["You don't seem very motivated, I'm gonna generate some ASCII Art for you out of the text. Maybe this will inspire you ;-)", answers = ["You don't seem very motivated, I'm gonna generate some ASCII Art for you out of the text. Maybe this will inspire you ;-)",
"Come on! Maybe some ASCII Art will help you to get motivated?", "Come on! Maybe some ASCII Art will help you to get motivated?",
"Ok, you refuse a lot, but nobody will ever refuse some raaaaandom ASCII AAAART :-)", "Ok, you refuse a lot, but nobody will ever refuse some raaaaandom ASCII AAAART :-)",
@ -418,9 +438,12 @@ class HelloBot(irc.bot.SingleServerIRCBot):
msg = random.choice(answers) msg = random.choice(answers)
c.privmsg(self.channel,msg) c.privmsg(self.channel,msg)
self.generateASCII(c,e) self.generateASCII(c,e)
answers = ["Are you up for a poem now?"] self.lastincoming_msg.append("ASCII")
answers = ["Are you up for a poem now?", "Do you want to write a poem together with me?",
"We could write a poem together, what do you think?"]
msg = random.choice(answers) msg = random.choice(answers)
self.level = 0 self.level = 0
self.lastAnswer = "ASCII"
c.privmsg(self.channel,msg) c.privmsg(self.channel,msg)
else: else:
self.level=-1 self.level=-1

@ -15,3 +15,19 @@ today=$(date +%Y%m%d.%H-%M);
mkdir -p "output/ttssr.$today" mkdir -p "output/ttssr.$today"
mv -v output/input* output/ttssr.$today; mv -v output/input* output/ttssr.$today;
mv -v src/sound* output/ttssr.$today; mv -v src/sound* output/ttssr.$today;
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
# Copyright (C) 2018 Angeliki Diakrousi <diakaggel@gmail.com>
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
# 0. You just DO WHAT THE FUCK YOU WANT TO.

@ -31,3 +31,32 @@ except sr.RequestError as e:
# sleep (1) # sleep (1)
# Copyright (c) 2018, Angeliki Diakrousi <diakaggel@gmail.com>
# Copyright (c) 2014-2017, Anthony Zhang <azhang9@gmail.com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

@ -19,3 +19,35 @@ with sr.Microphone() as source:
# write audio to a WAV file # write audio to a WAV file
with open(a1, "wb") as f: with open(a1, "wb") as f:
f.write(audio.get_wav_data()) f.write(audio.get_wav_data())
# Copyright (c) 2018, Angeliki Diakrousi <diakaggel@gmail.com>
# Copyright (c) 2014-2017, Anthony Zhang <azhang9@gmail.com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Loading…
Cancel
Save