TGC3 Beginners Guide: Difference between revisions
(→noweb) |
(→noweb) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
The core of the TGC3 is a single board computer (SBC) called a RaspberryPi and running the GNU/Linux distribution Raspbian. Works are contained on floppy disks and launched on insertion. To be more precise, each floppy contains the programmatic instructions so as to make the tiny computer behave in a certain way, and make use of some of all of its peripherals. This system therefore allows for a rather large range of possibilities, where the TGC can become anything from an audiovisual noise instrument to a poetry broadcasting device or spying and tracking camera. Last but not least, there is no default Internet connectivity on the TGC3, but local websites, stored on each floppy, can be accessed by connecting to the TGC3 local WiFi hotspot. This feature can be used to provide contextual documentation for the work, or publish browser-based art off the Internet. | The core of the TGC3 is a single board computer (SBC) called a RaspberryPi and running the GNU/Linux distribution Raspbian. Works are contained on floppy disks and launched on insertion. To be more precise, each floppy contains the programmatic instructions so as to make the tiny computer behave in a certain way, and make use of some of all of its peripherals. This system therefore allows for a rather large range of possibilities, where the TGC can become anything from an audiovisual noise instrument to a poetry broadcasting device or spying and tracking camera. Last but not least, there is no default Internet connectivity on the TGC3, but local websites, stored on each floppy, can be accessed by connecting to the TGC3 local WiFi hotspot. This feature can be used to provide contextual documentation for the work, or publish browser-based art off the Internet. | ||
== Floppy == | |||
The setup of the Floppy is key in the functionality of the system. Below we have provided a map of the file and folder structure of your future floppy submission. | |||
<pre> | |||
FLOPPY | |||
├── LICENSE | |||
├── main.pd | |||
├── main.py | |||
├── noweb | |||
│ └── index.html | |||
└── README | |||
</pre> | |||
In the root of the Floppy disk there needs to contain a ''LICENSE'' and ''README'' text file, your initial code file(s) named either ''main'''''.py''' or ''main'''''.pd''' format, and a ''noweb'' folder containing local website files you wish to have accessible over the local hotspot. Any other files you may need can be arranged in any style you choose so long as you correctly reference them in your code. | |||
== Software == | == Software == | ||
Line 101: | Line 118: | ||
==== noweb ==== | ==== noweb ==== | ||
As the name suggests, the TGC3 is not connected to the Internet but does host local web content. You can utilise this feature in a variety of ways to either display documentation, static work, or function as an interface. So long as your index.html is situated within the noweb folder, it will be accessible when connected to the TGC3 hot-spot. | As the name suggests, the TGC3 is not connected to the Internet but does host local web content. You can utilise this feature in a variety of ways to either display documentation, static work, or function as an interface. So long as your index.html is situated within the noweb folder, it will be accessible when connected to the TGC3 hot-spot. Your nowebsite can be built in plain html, css, but can also incorporate (but is not limited to) javascript, and cgi. | ||
Here the submission is controlled by '''.cgi''' code behind an interface built in html to trigger audio files. | |||
<source lang="html5"> | <source lang="html5"> | ||
<!DOCTYPE html> | |||
<html> | <html> | ||
<head> | <head> | ||
< | <title> Rock Step - Triple Step - Triple Step </title> | ||
</ | <meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
< | |||
</head> | </head> | ||
<body> | <body> | ||
<h1> rock step - triple step - triple step </h1> | |||
<form action="cgi-bin/play.cgi" class="buttons"> | |||
<input type="submit" name="p" value="BasicTurn.mp3" /> | |||
<input type="submit" name="p" value="Follow.mp3" /> | |||
<input type="submit" name="p" value="AmericanSpin.mp3" /> | |||
<input type="submit" name="p" value="Bump.mp3" /> | |||
<input type="submit" name="p" value="StopAndGo.mp3" /> | |||
<input type="submit" name="p" value="Windmill.mp3" /> | |||
<input type="submit" name="p" value="SpanishArms.mp3" /> | |||
<input type="submit" name="p" value="Hucklebuck.mp3" /> | |||
<input type="submit" name="p" value="Whip.mp3" /> | |||
<input type="submit" name="p" value="ChickenWalks.mp3" /> | |||
<div class="tempo"> | |||
</form> | |||
</body> | </body> | ||
</html> | </html> | ||
</source> | </source> | ||
<source lang="python"> | <source lang="python"> | ||
#!/usr/bin/python | #!/usr/bin/env python | ||
import cgi, os | |||
import cgitb; cgitb.enable() | |||
import subprocess | import subprocess | ||
f = cgi.FieldStorage() | |||
p = f.getvalue("p", "Bump.mp3") | |||
p = os.path.join("voice", p) | |||
out = subprocess.check_output(["mpv", p], cwd="/media/floppy/noweb", stderr=subprocess.STDOUT) | |||
# print "Location: /index.html" | |||
# | # print | ||
print "Content-type:text/html; charset=utf-8" | |||
print | |||
print """<html> | |||
<head> | |||
<meta http-equiv="refresh" content="0;url=/index.html" /> | |||
</head> | |||
<body> | |||
</body> | |||
</html>""" | |||
</source> | </source> | ||
[[Category: XPUB]] | [[Category: XPUB]] |
Latest revision as of 11:04, 13 October 2017
Intro
The Tetra Gamma Circulaire 3 (TGC3), AKA XPUB Special Issue 2, is an unknown concrete floppy music publication. It is an experimental platform designed to investigate experimental ways of publishing sonic, visual and textual works and instruments.
This work is a collaboration between the polymorph production platform DE PLAYER and the Experimental Publishing (XPUB) study path of the Media Design Master at the Piet Zwart Institute, Willem de Kooning Academie. Current contributions include works on dance, democracy, drones, surveillance, body movement, silence, improvisation, and the fine line between everything and nothing. We encourage anyone to contribute new pieces so as to develop an ever growing library of works to be experienced on the TGC3.
Hardware
The TCG3 is an accumulation of various computer peripherals that can be accessed in many different ways (WiFi, speakers, microphone, camera, Bluetooth, electro-conductive touch pads). It was designed as an open platform to allow for many kinds of applications, and contributions.
The core of the TGC3 is a single board computer (SBC) called a RaspberryPi and running the GNU/Linux distribution Raspbian. Works are contained on floppy disks and launched on insertion. To be more precise, each floppy contains the programmatic instructions so as to make the tiny computer behave in a certain way, and make use of some of all of its peripherals. This system therefore allows for a rather large range of possibilities, where the TGC can become anything from an audiovisual noise instrument to a poetry broadcasting device or spying and tracking camera. Last but not least, there is no default Internet connectivity on the TGC3, but local websites, stored on each floppy, can be accessed by connecting to the TGC3 local WiFi hotspot. This feature can be used to provide contextual documentation for the work, or publish browser-based art off the Internet.
Floppy
The setup of the Floppy is key in the functionality of the system. Below we have provided a map of the file and folder structure of your future floppy submission.
FLOPPY ├── LICENSE ├── main.pd ├── main.py ├── noweb │ └── index.html └── README
In the root of the Floppy disk there needs to contain a LICENSE and README text file, your initial code file(s) named either main.py or main.pd format, and a noweb folder containing local website files you wish to have accessible over the local hotspot. Any other files you may need can be arranged in any style you choose so long as you correctly reference them in your code.
Software
Contributions can be made in the form of Python scripts and applications, Pure Data (Pd) patches, JavaScript and static HTML and CSS written websites. Access to the various hardware peripherals can be made using standard Python modules and Pure Data externals, but also via the UNIX filesystem. The main inputs available to read from are the microphone, the camera, the electro-conductive touch pads, and the web interface. The main outputs to send data to are the audio speakers and the web interface. For instance one program, written with Python or Pd, could listen to the incoming sound amplitude captured from the microphone and generates graphics files to be loaded on a simple static website. The website could be visible on mobile devices connected to the TGC3 WiFi network, and a dedicated machine could video-project the website as well to create an interactive installation.
Examples
To give you an idea of the ability of the TGC3, we have provided some examples of possible submissions. You will find here basic setups to get you started and the inner workings of some current submissions to demonstrate the breadth of the possible complexity.
Pure Data
When working with Pure Data, depending on your desired output, there are some minimum requirements in your patch. Below is an example of some of the basic modules that you might want to use when starting your patch.
In this example you will notice a few modules that you might want to use. First of all to enable sound the sound engine you will need to place loadbang connected to pd dsp 1. This will initiate the sound engine on load which will allow for sound synthesis, and analysis. Also there is an example for interfacing with external code via network data like the Open Sound Control protocol using the netreceive object. Lastly you can see some basic sound output being generated via the osc~ (oscillator) object generating a tone at 440Hz, which is being made audible by going to the dac~ (digital to analogue converter) object.
The TGC3 can handle very complex patches. The following example is the inner workings of an interactive sound instrument that interfaces over OSC. In this case the netreceive object is replaced by the udpreceive object.
You can see even in this patch the building blocks that remain from the basic example. Notice too the loadbang going to the metro (metronome) objects. This makes sure that the patch's functionality, launches along with the sound engine. Outside of the few modifications to the basic example, the patch's complexity only lies in between the input and output stages.
Python
As mentioned, you can also create submissions in python. Here we have provided an example of a basic python block that emits OSC messages to be picked up in Pure Data. However you do not have to interface with Pure Data, and can purely make your submission in Python.
#!/usr/bin/env python
import os, random, time
while True:
freq = str(random.randint(0,10)*110)
print(freq)
os.system('echo "'+freq+';" | pdsend 3000')
time.sleep(0.25)
In this example a random number is generated and then sent via the command line command pdsend on port 3000. You can see in the corresponding Pure Data patch (in the Pure Data section) that it is listening to this port for incoming signals. You may want to use python in the event that you want to interface with some of the hardware, like the camera, or command line tools, like espeak, available in the TGC3.
Here is an example of a submission that is built entirely in Python that calls command line applications for its audio output.
#! /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("/media/floppy/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", '/media/floppy/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
noweb
As the name suggests, the TGC3 is not connected to the Internet but does host local web content. You can utilise this feature in a variety of ways to either display documentation, static work, or function as an interface. So long as your index.html is situated within the noweb folder, it will be accessible when connected to the TGC3 hot-spot. Your nowebsite can be built in plain html, css, but can also incorporate (but is not limited to) javascript, and cgi.
Here the submission is controlled by .cgi code behind an interface built in html to trigger audio files.
<!DOCTYPE html>
<html>
<head>
<title> Rock Step - Triple Step - Triple Step </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<h1> rock step - triple step - triple step </h1>
<form action="cgi-bin/play.cgi" class="buttons">
<input type="submit" name="p" value="BasicTurn.mp3" />
<input type="submit" name="p" value="Follow.mp3" />
<input type="submit" name="p" value="AmericanSpin.mp3" />
<input type="submit" name="p" value="Bump.mp3" />
<input type="submit" name="p" value="StopAndGo.mp3" />
<input type="submit" name="p" value="Windmill.mp3" />
<input type="submit" name="p" value="SpanishArms.mp3" />
<input type="submit" name="p" value="Hucklebuck.mp3" />
<input type="submit" name="p" value="Whip.mp3" />
<input type="submit" name="p" value="ChickenWalks.mp3" />
<div class="tempo">
</form>
</body>
</html>
#!/usr/bin/env python
import cgi, os
import cgitb; cgitb.enable()
import subprocess
f = cgi.FieldStorage()
p = f.getvalue("p", "Bump.mp3")
p = os.path.join("voice", p)
out = subprocess.check_output(["mpv", p], cwd="/media/floppy/noweb", stderr=subprocess.STDOUT)
# print "Location: /index.html"
# print
print "Content-type:text/html; charset=utf-8"
print
print """<html>
<head>
<meta http-equiv="refresh" content="0;url=/index.html" />
</head>
<body>
</body>
</html>"""