Merge branch 'master' of git.xpub.nl:/var/www/git.xpub.nl/repos/tgc3

master
Michael Murtaugh 7 years ago
commit 548e93d857

3
.gitignore vendored

@ -71,4 +71,5 @@
*.pyc
.DS_Store
*DS_Store
._*

@ -1,20 +0,0 @@
<html>
<head>
<meta charset="UTF-8">
<script language="javascript" type="text/javascript" src="libraries/p5.min.js"></script>
<!-- uncomment lines below to include extra p5 libraries -->
<script language="javascript" src="libraries/p5.dom.min.js"></script>
<script language="javascript" src="libraries/p5.sound.min.js"></script>
<script language="javascript" type="text/javascript" src="sketch.js"></script>
<!-- this line removes any default padding and style. you might only need one of these values set. -->
<style> body {padding: 0; margin: 0;} </style>
</head>
<body>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,267 +0,0 @@
var carrier; // this is the carrierillator we will hear
var modulator; // this carrierillator will modulate the amplitude of the carrier
var fft; // we'll visualize the waveform
var opac;
var carrier;
function getRandomArbitrary(min, max) {
return Math.random() * (max - min) + min;
}
function setup() {
createCanvas(innerWidth,innerHeight);
noFill();
//SETING FIRST OSCILLATOR: CARRIER
// EXPLANATION FROM WEBSITE: The carrier is typically set at an audible frequency (i.e. 440 Hz) and connected to master output by default. The carrier.amp is set to zero because we will have the modulator control its amplitude.
var randomnumb = getRandomArbitrary(0, 20);
console.log(randomnumb);
carrier = new p5.Oscillator(); // connects to master output by default
carrier.freq(200 + randomnumb); // it sets the frequency of the carrier. AN AUDIBLE ONE.
carrier.amp(1);
// carrier's amp is 0 by default, giving our modulator total control
carrier.start();
// create an fft to analyze the audio
//an FFT (fast Fourier transform) converts a signal from its original domain (often time or space) to a representation in the frequency domain and vice versa
fft = new p5.FFT();
}
function draw() {
//depen de la alçada, la nota TOCADA se sent mes for o menys (volum = amplitud)
if(mouseY <= height/2) {
var ampli = map(mouseY, 0, height, 0.01, 2.02);
}else{
var ampli = map(mouseY, height, 0, 0.01, 2.02);
}
// change carrierillator frequency based on mouseX
var modFreq = 0.1;
// si el mouseY és igual o el mateix que la meitat de l'altura, fes aixo. ((DEFINEIX LA AMPLITUD.))
if(mouseY <= height/2) {
var modAmp = map(mouseY, 0, height, 0.01, 2.02);
}else{
var modAmp = map(mouseY, height, 0, 0.01, 2.02);
}
carrier.amp(modAmp, 0.01); // fade time of 0.1 for smooth fading
// analyze the waveform
waveform = fft.waveform();
// drawText(modFreq, modAmp);
if (mouseIsPressed || (touches && touches.length)){
opac = 100;
var mx = mouseX || (touches[0] && touches[0][0]);
if (mx > 0 && mx < width/20 ){
carrier.freq(220.0);
carrier.amp(ampli);
}else if ( mx > width/20 && mx < 2*(width/20)){
carrier.freq(233.08);
carrier.amp(ampli);
}else if (mx > 2*(width/20) && mx < 3*(width/20)){
carrier.freq(246.94);
carrier.amp(ampli);
}else if (mx > 3*(width/20) && mx < 4*(width/20)){
carrier.freq(261.63);
carrier.amp(ampli);
}else if (mx > 4*(width/20) && mx < 5*(width/20)){
carrier.freq(277.18);
carrier.amp(ampli);
}else if (mx > 5*(width/20) && mx < 6*(width/20)){
carrier.freq(293.66);
carrier.amp(ampli);
}else if (mx > 6*(width/20) && mx < 7*(width/20)){
carrier.freq(311.13);
carrier.amp(ampli);
}else if (mx > 7*(width/20) && mx < 8*(width/20)){
carrier.freq(329.63);
carrier.amp(ampli);
}else if (mx > 8*(width/20) && mx < 9*(width/20)){
carrier.freq(349.23);
carrier.amp(ampli);
}else if (mx > 9*(width/20) && mx < 10*(width/20)){
carrier.freq(369.99);
carrier.amp(ampli);
}else if (mx > 10*(width/20) && mx < 11*(width/20)){
carrier.freq(392.0);
carrier.amp(ampli);
}else if (mx > 11*(width/20) && mx < 12*(width/20)){
carrier.freq(415.3);
carrier.amp(ampli);
}else if (mx > 12*(width/20) && mx < 13*(width/20)){
carrier.freq(440.0);
carrier.amp(ampli);
}else if (mx > 13*(width/20) && mx < 14*(width/20)){
carrier.freq(466.16);
carrier.amp(ampli);
}else if (mx > 14*(width/20) && mx < 15*(width/20)){
carrier.freq(493.88);
carrier.amp(ampli);
}else if (mx > 15*(width/20) && mx < 16*(width/20)){
carrier.freq(523.25);
carrier.amp(ampli);
}else if (mx > 16*(width/20) && mx < 17*(width/20)){
carrier.freq(554.37);
carrier.amp(ampli);
}else if (mx > 17*(width/20) && mx < 18*(width/20)){
carrier.freq(587.33);
carrier.amp(ampli);
}else if (mx > 18*(width/20) && mx < 19*(width/20)){
carrier.freq(622.25);
carrier.amp(ampli);
}else if (mx > 19*(width/20) && mx < width){
carrier.freq(659.26);
carrier.amp(ampli);
}
//draw a new line
stroke(0,0,0);
strokeWeight(0.5);
line(0, height/2,mx, mouseY);
line(mx, mouseY, width, height/2);
background(255, 255, 255,100);
}else{
// IF MOUSE IS NOT PRESSED
if(mouseY <= height/2) {
opac = map(mouseY, 0,height/2, 100, 0);
}else{
opac = map(mouseY, height, height/2, 100, 0);
}
background(255,255,255,opac); // alpha
// draw the shape of the waveform
drawWaveform();
}
}
function drawWaveform() {
if(mouseIsPressed){
stroke(255,255,255);
strokeWeight(1);
line(0, height/2,mx, mouseY);
line(mx, mouseY, width, height/2);
background(0, 0, 0,100);
}else{
stroke(0,0,0,100);
strokeWeight(0.5);
beginShape();
for (var i = 0; i<waveform.length; i++){
var x = map(i, 0, (waveform.length)/8, 0, width);
var y = map((waveform[i])/8, -1, 1, -height/2, height/2);
vertex(x, y + height/2);
}
endShape();
}
}

@ -1,4 +1,4 @@
#N canvas 225 100 1066 716 10;
#N canvas 229 29 1066 716 10;
#X obj 96 208 textfile;
#X obj 81 290 print;
#X msg 134 151 bang;
@ -24,10 +24,10 @@
#X obj 442 296 b;
#X msg 443 327 0;
#X floatatom 469 358 5 0 0 0 - - -, f 5;
#N canvas 667 215 664 530 sample 1;
#N canvas 664 33 664 530 sample 0;
#N canvas 0 22 450 278 (subpatch) 0;
#X array drone 668457 float 2;
#X coords 0 1 668457 -1 200 140 1 0 0;
#X array drone 334228 float 2;
#X coords 0 1 334228 -1 200 140 1 0 0;
#X restore 379 157 graph;
#X obj 147 106 soundfiler;
#X floatatom 196 212 8 0 0 0 - - -, f 8;
@ -57,12 +57,6 @@
#X obj 236 112 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X msg 152 322 0;
#X obj 168 410 player Chapter;
#X obj 319 461 player sub;
#X obj 223 439 player section;
#X obj 419 509 player subsubsub;
#X obj 364 486 player subsub;
#X obj 483 536 player subsubsubsub;
#X obj 873 503 /~ 6;
#X obj 204 149 metro 3000;
#X obj 201 260 route Chapter section sub subsub subsubsub subsubsubsub
@ -70,8 +64,14 @@ foot Appendix, f 70;
#X obj 498 295 b;
#X msg 499 326 0;
#X floatatom 525 357 5 0 0 0 - - -, f 5;
#X obj 364 486 player subsub;
#X obj 168 410 player Chapter;
#X obj 319 461 player sub;
#X obj 223 439 player section;
#X obj 419 509 player subsubsub;
#X obj 483 536 player subsubsubsub;
#X connect 0 0 1 0;
#X connect 0 0 37 0;
#X connect 0 0 31 0;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
@ -80,15 +80,15 @@ foot Appendix, f 70;
#X connect 5 1 28 0;
#X connect 6 0 5 0;
#X connect 7 0 13 0;
#X connect 7 0 29 1;
#X connect 7 0 36 1;
#X connect 8 0 15 0;
#X connect 8 0 31 1;
#X connect 8 0 38 1;
#X connect 9 0 17 0;
#X connect 9 0 30 1;
#X connect 9 0 37 1;
#X connect 10 0 19 0;
#X connect 10 0 33 1;
#X connect 10 0 35 1;
#X connect 11 0 21 0;
#X connect 11 0 32 1;
#X connect 11 0 39 1;
#X connect 13 0 14 0;
#X connect 14 0 8 0;
#X connect 14 0 16 0;
@ -103,22 +103,22 @@ foot Appendix, f 70;
#X connect 20 0 22 0;
#X connect 21 0 22 0;
#X connect 22 0 23 0;
#X connect 23 0 34 1;
#X connect 23 0 38 0;
#X connect 26 0 35 0;
#X connect 27 0 36 0;
#X connect 23 0 32 0;
#X connect 23 0 40 1;
#X connect 26 0 29 0;
#X connect 27 0 30 0;
#X connect 28 0 7 0;
#X connect 28 0 14 0;
#X connect 35 0 25 0;
#X connect 35 0 25 1;
#X connect 36 0 0 0;
#X connect 37 0 7 0;
#X connect 37 1 8 0;
#X connect 37 2 9 0;
#X connect 37 3 10 0;
#X connect 37 4 11 0;
#X connect 37 5 23 0;
#X connect 37 6 40 0;
#X connect 37 7 12 0;
#X connect 38 0 39 0;
#X connect 39 0 40 0;
#X connect 29 0 25 0;
#X connect 29 0 25 1;
#X connect 30 0 0 0;
#X connect 31 0 7 0;
#X connect 31 1 8 0;
#X connect 31 2 9 0;
#X connect 31 3 10 0;
#X connect 31 4 11 0;
#X connect 31 5 23 0;
#X connect 31 6 34 0;
#X connect 31 7 12 0;
#X connect 32 0 33 0;
#X connect 33 0 34 0;

@ -1,7 +1,6 @@
#N canvas 617 41 665 546 10;
#N canvas 191 155 665 546 10;
#X obj 168 326 tabread4~ drone;
#X floatatom 168 266 5 0 0 0 - - -, f 5;
#X obj 244 271 *~ 668457;
#X obj 267 232 phasor~;
#X obj 244 196 sig~;
#X floatatom 252 29 5 0 0 0 - - -, f 5;
@ -13,7 +12,6 @@
#X msg 223 403 0;
#X obj 335 17 inlet;
#X obj 394 211 != 0;
#X obj 307 132 *;
#X obj 356 300 line, f 6;
#X floatatom 357 354 5 0 0 0 - - -, f 5;
#X obj 375 238 select 1 0;
@ -21,28 +19,34 @@
#X msg 352 266 1 200;
#X msg 404 266 0 100;
#X msg 302 76 \$1 200;
#X obj 305 49 / 2;
#X connect 0 0 9 0;
#X obj 307 132 +;
#X obj 305 49 * 0.01;
#X floatatom 326 174 5 0 0 0 - - -, f 5;
#X floatatom 408 125 5 0 0 0 - - -, f 5;
#X obj 244 271 *~ 334228;
#X connect 0 0 8 0;
#X connect 1 0 0 0;
#X connect 2 0 0 0;
#X connect 2 0 24 0;
#X connect 3 0 2 0;
#X connect 4 0 3 0;
#X connect 5 0 4 0;
#X connect 7 0 4 0;
#X connect 8 0 14 1;
#X connect 9 0 6 0;
#X connect 10 0 9 1;
#X connect 11 0 9 1;
#X connect 12 0 13 0;
#X connect 12 0 22 0;
#X connect 13 0 17 0;
#X connect 14 0 4 0;
#X connect 15 0 9 1;
#X connect 15 0 16 0;
#X connect 17 0 19 0;
#X connect 17 1 20 0;
#X connect 18 0 14 0;
#X connect 19 0 15 0;
#X connect 20 0 15 0;
#X connect 21 0 18 0;
#X connect 22 0 21 0;
#X connect 6 0 3 0;
#X connect 7 0 20 1;
#X connect 7 0 23 0;
#X connect 8 0 5 0;
#X connect 9 0 8 1;
#X connect 10 0 8 1;
#X connect 11 0 12 0;
#X connect 11 0 21 0;
#X connect 12 0 15 0;
#X connect 13 0 8 1;
#X connect 13 0 14 0;
#X connect 15 0 17 0;
#X connect 15 1 18 0;
#X connect 16 0 20 0;
#X connect 17 0 13 0;
#X connect 18 0 13 0;
#X connect 19 0 16 0;
#X connect 20 0 3 0;
#X connect 20 0 22 0;
#X connect 21 0 19 0;
#X connect 24 0 0 0;

@ -0,0 +1,46 @@
#! /usr/bin/env python
import re, subprocess, random, os
from time import sleep
devnull = open(os.devnull, 'w')
# requires: espeak and aplay (alsa-utils) to be installed
dic={
"narrator": "en-us",
"Pilot": "m4",
"Sensor": "m7",
"MC": "m2",
"Jag25": "m6",
"Unknown": "f1",
"Bam Bam 41": "m3",
"Safety Observer":"f3"
}
f=open("transcripts-drone-attack.txt","r")
txt=f.readlines()
p= re.compile(r"^(\d\d\:\d\d) \((.*?)\)\: (.*)") # regex for capturing groups: time, character, sentence
for line in txt:
if p.findall(line):
time,char,sentence = (p.findall(line))[0]
voice=dic[char]
# play time
subprocess.call(["espeak", time +" "+char, "-v", dic['narrator'], "-p", "20"], stdout=devnull, stderr=devnull) # narrator speaks: time and character
sleep(0.5) #short pause before sentence
if "*expletive*" in sentence: #"*expletive*" in sentence is True:
sentence_parts=re.split(r"(\*\w+\*)", sentence)
for part in sentence_parts:
if part == '*expletive*':
subprocess.call(["aplay", 'swear.wav'], stdout=devnull, stderr=devnull)
else:
subprocess.call(["espeak", part, "-v", voice], stdout=devnull, stderr=devnull) # character speaks: his
sleep(float(random.randint(1,10))/100)
else:
subprocess.call(["espeak", sentence, "-v", voice], stdout=devnull, stderr=devnull) # character speaks: his
#
else: # line w/out time or character (narrator)
subprocess.call(["espeak", line, "-v", dic['narrator'], "-p", "20"], stdout=devnull, stderr=devnull)
sleep(1) # make pause after each text line

@ -0,0 +1,35 @@
#! /usr/bin/env python
import re, subprocess, random
from time import sleep
# requires: espeak to be installed
dic={
"narrator": "en-us",
}
f=open("detail_of_attack.txt","r")
txt=f.readlines()
for line in txt:
print line
# # play time
subprocess.call(["espeak", "-v", dic['narrator'], "-p", "20", line]) # narrator speaks: time and character
# sleep(0.5) #short pause before sentence
# print sentence
# if "*CLASSIFIED*" in sentence: #"*expletive*" in sentence is True:
# sentence_parts=re.split(r"(\*\w+\*)", sentence)
# print sentence_parts
# for part in sentence_parts:
# if part == '*CLASSIFIED*':
# print 'EXPLETIVE', part
# subprocess.call(["aplay", 'swear.wav'])
# else:
# print 'SPEECH', part
# subprocess.call(["espeak", part, "-v", voice]) # character speaks: his
# sleep(float(random.randint(1,10))/100)
# else: # line w/out time or character (narrator)
# print "NARRATOR"
# subprocess.call(["espeak", line, "-v", dic['narrator'], "-p", "20"])
sleep(.5) # make pause after each text line

@ -1,35 +0,0 @@
#! /usr/bin/env python
import re, subprocess, random
from time import sleep
# requires: espeak to be installed
dic={
"narrator": "en-us",
}
f=open("detail_of_attack.txt","r")
txt=f.readlines()
for line in txt:
print line
# play time
subprocess.call(["espeak", "-v", dic['narrator'], "-p", "20"]) # narrator speaks: time and character
sleep(0.5) #short pause before sentence
print sentence
if "*CLASSIFIED*" in sentence: #"*expletive*" in sentence is True:
sentence_parts=re.split(r"(\*\w+\*)", sentence)
print sentence_parts
for part in sentence_parts:
if part == '*CLASSIFIED*':
print 'EXPLETIVE', part
subprocess.call(["aplay", 'swear.wav'])
else:
print 'SPEECH', part
subprocess.call(["espeak", part, "-v", voice]) # character speaks: his
sleep(float(random.randint(1,10))/100)
else: # line w/out time or character (narrator)
print "NARRATOR"
subprocess.call(["espeak", line, "-v", dic['narrator'], "-p", "20"])
sleep(1) # make pause after each text line
Loading…
Cancel
Save