Monday, May 30, 2016

Documentation 2: Final Production

Project Narrative:
Wordistortion is an exercise in literary recombination and procedural text generation. It seeks to explore the extent to which a literary work and the voice of its author can be recombined with itself again and again until it becomes virtually unrecognizable, yet somehow also disturbingly familiar.

Video/Image/Sound/Code Documentation:


Installation Scenario:
There would be a screen where the program displays and updates its body of text indefinitely, once every thirty seconds. A single button would be available for viewers to press in order to restart the program afresh on the original text, which it would then proceed to recreate/distort again.

The Language of Praise:

Thursday, May 26, 2016

Documentation 1: Prototype

Initially I wanted to create a Twitter bot that would read several posts in either the #feelthebern, #makeamericagreatagain, or the #imwithher tag (I hadn't decided which one), create a Markov transition matrix from the tweets, and generate a new tweet using the matrix, repeating the process every few minutes, hopefully creating a somewhat plausible character in the style of Mark V. Shaney. However, my efforts to make any of the Twitter addons that I found (ofxTwitter, ofxtwitcurl, ofxOAuth) work for me proved fruitless. I kept getting errors that I couldn't find fixes to with my limited knowledge. Stackoverflow and the openframeworks forums were unhelpful as well -  everything about Twitter on the OF forums was at least a year or two old. So I decided to opt for a simpler concept that I still felt would have interesting results.

My new concept was that my program would take a large text, generate a Markov matrix by analyzing it, create a new text, generate a new matrix by analyzing the new text, create a new text from the new matrix, and so on. The text I decided on was Donna Haraway's A Cyborg Manifesto. I found the full text online, cleaned it up (since it had a bunch of whitespace, page numbers and spelling errors), and saved it.



Using your conceptual research journal entry for context, describe the ofxaddon that will be incorporated in your final project.
I am using ofxMarkovChain. I initially had problems implementing it, but I got it to work by looking at this post and changing the name of the check() function to mycheck() instead. After that, I was able to make its two examples work.



I had some trouble writing to a text file, though. I tried it both with ofFile and with ofstream, but no matter what, for some reason it's writing Chinese characters instead of the string I specified. Even using information from the official C++ docs, it's still not working. Stackoverflow says that it's related to the fact that the string's binary values are being recorded and used to locate an address in memory, but I haven't found a fix for it yet, as of May 30, 6:15PM. It seems to me that I'm doing things the way that is being recommended, but for some reason it's not working the same way. Typical programmer troubles, I suppose.


This doesn't work either.


How does the addon support your conceptual experimentation?
The addon is a simple framework through which I can implement a previously created Markov transition matrix.

How does the addon work? What other research/libraries support it?
The addon reads a text file formatted in the style of a square matrix. Each row and column represents one possible state, and each value in each row represents the probability of transitioning to the corresponding state. From there, the addon can generate a sequence of states that can be used to draw to the screen. It uses ofRandom to randomly determine the next state.

It's based on the theory of Markov chains, which are random processes that transition from one state to another based on probabilities that depend solely on the current state. So the probability of, say, state B appearing in a Markov chain is dependent on the previous state and the likelihood of it transitioning to state B. With a transition matrix like:

State Probability of  trans. to A Probability of trans. to B Probability of trans. to C
A 10% 60% 30%
B 50% 30% 20%
C 20% 10% 70%

So say you're in state A, you have a large likelihood of transitioning to state B (60%), and vice versa (50%). So whenever state B and A appear, it's very possible that they will alternate back and forth. But if state C appears, it's likely that it will simply stay in state C instead of transitioning to A or B, because the probability of it staying in state C is so high (70%).

Markov chains are named after Andrey Markov

Document a first integration of the addon in your app development.
At this stage, I still haven't gotten the app to write properly to the file, but it's definitely writing. So I implemented the Markov addon in order to generate the output according to a transition matrix that was provided with one of the examples.

The transition matrix only has 5 states at this point, so it'll generate only the letters a through e.

So I have my update() function calling the ofxMarkovChain's update() and getState(), which generates a new state and then returns that state, respectively.


From there I have a switch statement that matches each state to a letter. I then have the program write the generated letters to the file and also print them to the console. Hooray, it works!


And the written files look like this:
 You can tell that they're different, so that goes to demonstrate again that the Markov chains are working. But the original problem - why the written file is in Chinese of all things - is still not solved.

Searching "c++ writing chinese to file" led me here, but I don't think the problem is the same as mine. This thread also wasn't that helpful. This post seems more promising, though.

I tried writing to a text file in a non-openframeworks project, and it worked!


So it seems that the problem lies with something in openframeworks, not with my computer or with xcode. Hmm.


To create the transition matrix, I'm using a vector of vectors of floats - the same format as the matrix used in ofxMarkovChain. I will also be using a separate vector to store the characters that correspond to each state.


References:
Markov Models for Text Analysis - http://www.stat.purdue.edu/~mdw/CSOI/MarkovLab.html
A working Markov text generator - http://projects.haykranen.nl/markov/demo/
The source for the text generator - https://github.com/hay/markov
Markov Chain text generator - https://golang.org/doc/codewalk/markov/
Creating a Markov Twitter bot - http://sts10.github.io/blog/2014/12/23/guide-create-markov-twitter-bot/
https://www.cs.umd.edu/class/winter2012/cmsc389C/Projects/P1/P1.html
Stackoverflow Markov advice - http://stackoverflow.com/questions/12065503/predicting-next-char-in-random-text-generation-based-on-some-input-file
Stackoverflow checking for an element in a vector - http://stackoverflow.com/questions/6277646/in-c-check-if-stdvectorstring-contains-a-certain-value
Stackoverflow iterator help - http://stackoverflow.com/questions/15099707/how-to-get-position-of-a-certain-element-in-strings-vector-to-use-it-as-an-inde


Addons:
https://github.com/elaye/ofxMarkovChain
https://github.com/andrebaltaz/ofxHMM

Artists:
Bruce Ellis and Rob Pike - Mark V. Shaney

Thursday, April 14, 2016

Research 3: Production Concept

1. Concept
The project will be focusing on the possibilities of remixing and distorting a piece of literature, exploring how much it can be recombined with itself until it is both familiar and unfamiliar. I want to see to what extent I can use Markov chains to distort Donna Haraway's A Cyborg Manifesto, and whether it will still contain recognizable elements of itself after several iterations of recombination - perhaps retaining Haraway's voice, perhaps not.

Here is something I generated using this Markov chain text generator. I used A Cyborg Manifesto as the source text, and I generated a 2500-character text from it. I then used that 2500-character text as the source text for another 2500-character text. I did it over and over until I reached this:
ave rications of nation. I have rication, as are mobiologues a which nic organization issues achin productics amomen accome a mark timen accomen achin othe charaction it as amomen achin production issues are excursion it as are mobiologues are mobiologues accomen accomework ecomen achin othe charactics againscript or nation is us. The of nation is us. The charaction is us. The charactions of nations of nation it as againscript or nation is us. The charactics a mark timen their data biolour and production issues a major nation, as achin otheir dlturing welfare mobiologues with and production it as also unnation is us. The charactics a mark timen their data biologues also unnations of from One in othe of nationalso unnation it as are mobiologues accome a mark ecomen accomen accomen achin production issues with and progrestructions of nation. I have rications of nation is us. The charaction issues are mobiologues amomen accome a mark timen accomen accomen achin production it as are mobiolour and production it as accome a mark timen accome a mark ecome a mark timen accomen accome a mark timen accomen their data biologues a mark ecomen accome a mark ecomen accomen achin productions of nation issues accomen to or nations of nation. I have rication it as a mark ecome a mark timen achin othe charactics againscript or mists in othe charaction is us. The charaction is us. The of nations off, but could by their dlturing of nation it as are mobiolour and production it as are excursions of from One in othe charaction it as also unnation it as are mobiologues with and productions of nation it as a mark timen accomen accomen achin production is us. The charaction it as are mobiologues achin production it as are excursion it as achin production it as are mobiolour and productics againscript or nation it as a mark ecomen accomen accomework ecomen accomen accomen accomen achin productions of nation it as are mobiolour and production it as a mark timen achin othe charactics againscript organizations of nation is us. The charactics accomen to or nation it as amomework ecomen achin proble socially and progrestruction it as are mobiologues with and progrestructics a mark ecomen achin progrestruction issues with and production it as are mobiologues accomen achin othe of tern cultucations of nation it as are mobiologues achin progrestruction it as againscript or nation is us. The charaction is us. The charactics a mark ecomen achin culturing of nations of nations of nation, as againsc
You can see that Haraway's most commonly used sequences of characters (such as "tion," "it as," "othe," "again," "turing") are preserved, though the full words are often very distorted. This is what I hope to re-create with my project, which will automate the process of running the text through the Markov generator over and over.

2. Software
The program will use a Markov chain model in order to analyze and then re-generate a body of text. I plan on using the ofxMarkovChain addon, and I am also studying other pieces of code as references for my own transition matrix generation method.

3. Experience
The site for the project would be

Research 2: Cybernetic Artwork




Wen-Ying Tsai: https://vimeo.com/125169556


The first artwork that was explicitly inspired by cybernetics was Nicolas Schöffer's CYSP I, which responded to changes in color, light, and sound by becoming more or less excited. Continuing in this tradition was Wen-Ying Tsai, an architectural engineer-turned-artist who created sculptures out of stainless steel rods, strobe lights, sometimes water jets, and a combination of different sensors. His sculptures responded to sound and proximity changes in their environment by vibrating and emitting light, inviting their viewers to interact with them. Both artists' work can be considered cybernetic because they are both investigating complex interactions between systems. Because of the constantly changing nature of the environments around Schöffer and Tsai's works, and because their works responded based on a combination of different factors, the responses from their sculptures were less predictable than a one-to-one response. Additionally, the sculptures can provoke different responses from the environment (namely the viewers), which will then create different responses in the artworks, and create a feedback loop. And the light and sound that the artworks create not only affect the viewers, but also are reflected back and picked up by the artworks themselves, adding another layer of reflexivity to the piece.

mla citations

find a cybernetic artwork from 1960-present in any medium.

project description/artist's intent
what's the logic used?
what makes this work cybernetic?
600-1000 words, mla cited

Thursday, April 7, 2016

Research 1: Cybernetics

Before researching for this blog post, I thought cybernetics was merely the study of technologically advanced prosthetic limbs. It's pretty funny to look back on that.

As far as I understand it now, cybernetics has many different definitions that have been evolving for a long time. In general, it is about systems - specifically, the control and observation of systems and networks. In second-order cybernetics the focus is not only on the system being observed but also on the system observing it (1). For instance, among social scientists, it is understood that observations are influenced by the nature of the observer, rather than observations existing independently of the observer. This relates to the philosophy of constructivism, which asserts that "models are not passive reflections of reality, but active constructions by the subject" because our understanding of systems is based on our ability to create models of them (2). It is also concerned with feedback and recurisveness within systems, such as when theories in social sciences influence the systems about which the theories are created. Therefore it is teleological, taking into account the purpose of models and their modelers (3, 1).

Overall it is a very theoretical field and not established as a well-recognized discipline. People are more interested in studying specific applications of some of its principles, such as in neural networks and artificial intelligence.


----------------------------------
1. Umpleby, Stuart A. "Definitions of Cybernetics". The Larry Richards Reader 1997–2007 (PDF). pp. 9–11. Web. < ftp://ftp.vub.ac.be/pub/projects/Principia_Cybernetica/Papers_Umpleby/Science-Cybernetics.txt >.
2. Francis Heylighen, and Cliff Joslyn (2002). "Cybernetics and Second Order Cybernetics", in: R.A. Meyers (ed.), Encyclopedia of Physical Science & Technology (3rd ed.), Vol. 4, (Academic Press, San Diego), p. 155-169. < http://pespmc1.vub.ac.be/Papers/Cybernetics-EPST.pdf >
3. Johnson, Barnabas. "The Cybernetics of Society". 6 April 2016.


Cybernetics
1. Define "cybernetics"
2. How has cybernetics changed since the 1960s?
3. Define the 4 most importnat attributes of a cybernetic system