Score Your Life

Final Project

Guillermo Acevedo

Thesis Advisor:  Nancy Hechinger

ITP Spring 2004


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.

 

 


Score Your Life

 

Table of Contents

Table of Contents. 2

Elevator 4

Statement 4

Objective/Purpose. 5

Audience. 5

Context 6

Personal / Historical 6

Aesthetic. 10

User Scenario. 13

Situations/events correlated to emotional content 14

Emotional Framework.. 15

Importance of change. 16

Moods. 17

Affective content correlated to physical data. 18

Technology. 20

Sensors. 20

Heart beat. 20

Accelerometer. 20

Breathing. 20

Voice. 20

Embedded computation.. 21

Pseudo code: 21

Prototype. 22

Final proposed version.. 24

Next steps. 25

Biometrics. 25

Appendix. 27

Schematics. 27

Codes. 27

BX24.. 28

PureData. 42

Additional Reading. 50

References. 51

Copyright. 52

 


 

Elevator

Movies have soundtracks that enhance, set the mood, and even modify how events are perceived.  Score Your Life allows a user to add a soundtrack to your life.  It is a small portable device similar to an iPod that does the same for the user’s life, analyzes the situation and plays the appropriate songs or sounds.

 

Statement

Add a soundtrack to your life. 

People already add a layer of sound to their life with walkmans, iPods and home theater systems.  However, while the music can set a baseline mood and provide a background against which the world is experienced, a real score would adapt in real time to the events or states that the person is experiencing.

Score Your Life is a small portable device that attempts to play the appropriate sound (either music or sound effect) for whatever the person is experiencing.  If Score Your Life detects that the person is in a calm resting position it will play soft non-intrusive music, if they are exercising it will switch to upbeat.  If they are angry, they get angry music…

 


Objective/Purpose

This is an attempt to explore augmented reality through sound.  I am currently interested in creating custom-tailored realities.  I am not interested in creating Virtual Realities where people can immerse themselves in solitude.  These spaces, while profoundly affecting, have little effect upon normal day-to-day reality.  They are a break from reality.  I’m interested in creating spaces where people can function normally, do their job, walk down the street and meet friends, but at the same time are radically different from what is today perceived as reality. Wearing these filters, layers and enhancements to reality that I am interested in creating will affect reality because people will be able to use them continuously.  It is important that any technological addition to reality permit the interaction between people using this addition, even if they are different additions.

I plan to build a prototype, a proof of concept, of an iPod-like device that, coupled with biometric sensors, can detect certain physical states in the user and play music to accompany and enhance this state.

For this proof of concept I will hook up sensors to a laptop and do all the programming and music playing on the laptop, just to speed up development.

 

Audience

First adopters, people who would like to experience different realities.

While I’m sure that this is a product that many different kinds of persons will learn to adapt and use in their own way, I’m designing the device and experience for the same demographic as iPod users.  That way the first users will be commuters, both long range and short, subway riders, teens and young adults.  This restricts the device to the employed, students and/or ultra-hip.


 

Context

Personal / Historical

My main goal in life is to produce modifications to reality.  When I was a teenager I decided to study philosophy because I wanted to acquire tools that could help me understand the underlying rules of reality and help me develop ways to modify these rules so as to create large-scale changes in the infrastructure of reality.  At that time I had hopes that ideas were the main movers of society. 

When I became a schoolteacher I did so to because I knew that I could become an incredibly large influence on my students and as such could help create trends in thinking and behavior in them.  I found this to be true but, while it was very effective, it lacked range.  My influence, while strong on the children, was limited to a small number of members of society.

I hoped to remedy this by becoming a newspaper editor.  I realized that a population’s vision of what is happening (which is a large part of what reality is) is actually constructed by the news media.  As an editor I chose what had happened and what not, and how it had happened and what it meant. 

However I began to suspect that reasoning was not the way to actually achieve what I wanted.

The most important things are those that transcend, that go beyond themselves and insert themselves in a way into history and other space-time fabrics. 

Humanity has had 3 main ways to transcend (and I’m loosely quoting Hegel here):  Religion, Science and Art.

In those 3 realms humanity has found ways to transcend time.[1]  It is no surprise that the first two have been the major motivators of human movement for a very long time.  Humanity has used these to such extremes that they not only have been the organizing motivators but also what people have identified as good.  For many ages people organized around religious institutions and individuals, the justification of government, the origin of power being divine.  People also thought that religion gave them the measure of good and bad.  Some even went as far as to search for happiness and the meaning of life in these religious parameters. 

The Illustration with the French Revolution was really the change between religion being the main motivator/explainer of things and Science (reason) assuming that role[2].  Government stopped being justified from a religious authority and was replaced with reason.  Napoleon outfitted all of his soldiers with the declaration of human rights and German intellectuals actually welcomed the sights of the Napoleonic army, for a while at least, because they were the harbingers of the Illustration. 

Both Western Democracy and Socialism are products of this.  This is the great tale of modernity, the age of reason.  For some thinkers this is the end of superstition and the beginning of the shedding of light upon the world. Governments were then organized around reason, Justice dispensed based on reason and people used reason to explain their own existence.

The existence of reason is not by any means the erasing of religion, it is just a replacement of the role that religion used to have.  Just as reason existed during the time of religion, so religion exists during the age of reason.  Interestingly reason during the age of religion was subject to religion, and religious judgment was passed on it (for example see Galileo’s excommunication).  Reason was used to further religion’s reach and power  (just look at the tomes upon tomes that were produced during the middle ages trying to prove the existence of god). Even technology, reason’s younger cousin, was seen through the eyes of the mysterious, superstition (which is religion’s younger cousin).  The great technologists were alchemists or accused of practitioners of black arts, or, in other friendlier places, closely related to priests themselves.

It is easier to speak of the past, and if proper documentation exists it gets easier the further it is from the present due to the simple fact that distance breeds not only hindsight but also objectivity, and difference makes it easy to identify structures and elements.  Yet we can still make some assertions as to what happened to religion during the age of reason. 

For one religion no longer justified power over other persons, the separation of church and state is an important principle in the age of reason.  State then might use religion to further its causes, but high-ranking religious officials have much less power during these times.  The replacement of the confessor with the psychologist is a common theme (it might be mistaken, but the fact that it is so often cited indicates the state of mind of the people). Charity, which was always part of the churches of the world, becomes tantamount for many, and when churches are attacked they use charity as a justification for their existence. 

Physics no longer answers to anybody (for a long time gravity was explained in terms of god’s will) and those that live in the age of reason feel that science is a great searchlight dispelling the darkness of ignorance with it’s clear and structured explanations.  However it is important to remember that Thomas Aquinas also felt that his time was wonderful because theological discussions were popular and common all over his world.  He felt that so much theology was a sign of goodness. 

But the age of reason could be waning (some say it is over).  Intellectuals have pointed out how reason is not good in itself, contrary to the feeling that it had before (if there is a reasonable explanation behind something it must be ok).  The great tyrants of the past centuries have all had their own “scientific” machines spouting reasons that justified themselves.  Just as the Catholic Church had divine reasons for slaughtering millions of indigenous Americans, so did Hitler have “scientific” reasons (it does not matter that they are all bunk, the fact is that many persons were willing to accept them as reasonable.)

Today it is clear that William Shockley (among others the father of the transistor and physics Nobel Prize winner in 1956) had racist intentions when he advocated paying African-Americans to have themselves sterilized, although he gave scientific reasons for this and used his status as a world-renown scientist to further his cause.[3]

There are similar issues concerning positivism, capitalism and a whole bunch of other institutions that all point towards the death or reason just as the illustration pointed to death of God.  This comes in many flavors ranging from the skeptic that suspects that reason isn’t all it claims to be to the poet that wishes reason would be banished from this earth forever, to the mystic romantic that longs for a time when spiritualism was king, to the nihilist that declares reason, as well as god and any other form of truth, to be dead forever.

This has been commonly called the postmodern condition.  However postmodernity is a time of weak answers, which would indicate that it is a time of transition.

All in all it is safe to assume that Reason has come under attack, it is suspect of committing the same crimes Religion did, and is no longer to be regarded as the best thing for humanity.

Returning to the triad of transcendence we can come up with a pretty good estimate of what will be the next area to dominate humanity’s motions.

The time for religion to rule came and passed.

The time for reason to rule came and is passing.

It is time for Art.

So I have decided to utilize aesthetics to modify reality.  Yet to be congruent in this time and age, aesthetics must be imbued, contaminated, moved by the spirit of what it replaces: reason[4].  That is why I came to ITP, searching the intersection between art and technology, always with a focus on what is the next transcendental paradigm.

Which brings me to Augmented Reality.

Aesthetic

In a nutshell, augmented reality (AR) is the placing a layer of content between reality and the conscious entity perceiving reality.  It is not mediation because one lets reality filter through, as pure as possible.  A mediation would be an interpretation or facilitation of reality to the user.  It is an addition[5]

Most AR systems involve visual stimuli, headset displays that place content over objects perceived by the user.  However I have found that sounds and music can achieve a more total effect on people, influencing them much more than visual stimuli and perhaps even giving new meaning to what is perceived.

So I have been investigating this layering of sound upon the existing environment.  My ultimate goal in this area will be the total processing (including removal and production) in real time of the aural inputs a person receives.   For now I will add an intelligent layer of music over reality in order to study how it enhances and affects the perception of such[6]

Score Your Life is an instrument of Aesthetic expression for me.  I’m drawing from the traditions of portable art, intimate art, experience art and aural art. 

For ages art was subscribed to an object that, upon viewing or experiencing, remitted the observer to a feeling or emotion.  Afterward artists decided to “escape the canvas” and try to create things that would create these emotions directly through an experience.  I’m talking of installations, performances and such.  While the artist still does create aesthetic objects, in some cases the object is of less importance than what the audience does with it, and experiences.  So these are all contrived situations that the audience must explicitly insert themselves into, many times taking themselves out of the normal routine and into the aesthetic realm. 

I want to take this further and insert the aesthetic experience into the normal day-to-day routine (ever since I read Theodore Adorno saying that going to the museum is like visiting a prisoner in jail I’ve felt that art needs to be liberated). I hope that by making the normal world (as opposed to the museum or gallery) much more aesthetic the world will be a better place[7], people will be influenced by art when they make their decisions. 

With respect to SYL, this is a device that constantly layers sound over reality.  But it does more than just play music, it chooses sounds and songs that are intended to provoke emotional responses in the user, thus giving his or her reality a different shade than if it had been experienced without the music. 

The first experiments I’m doing are to use songs that enhance and augment the user’s experience.  If the person is relaxed it will play music that will not only highlight that relaxation but will induce more relaxation.  If the person is under the feeling of impending doom, SYL will make these feelings worse.

But I’m also interested in continuing this in another direction, juxtaposing music to situation.  How different it must be to relax to soothing calm meditative music than to do the same activity listening to chord churning adrenalin inducing fast, hard music.  It must certainly color your day differently and lead to totally different outcomes.  While in the first relaxation the user might just feel very happy calm and ready to got to work next day, in the second one the user might decide to get off the couch and go play basketball, or once and for all finish that project, and he will probably not be as productive the next day at work, but then again he might have come in with a couple of fresh ideas he worked over during the weekend.

Also little mundane activities can become glorious epics; an elevator ride can feel like a rocket launch with the appropriate stimuli (or at least push the users imagination into playing that it is a rocket launch). What would happen if every time you smiled a stadium cheered for you?

User Scenario

Matt wants to have a different day so he takes out his SYL and plugs in his 80’s special Music Flash Card.

He puts the pod in his pocket, earphones and microphone (similar to the hands-free devices telephone operators use).

As he rushes out the door the SYL reads the forward movement and slightly quicker heartbeat and breathing and begins to blast “Eye of the tiger” at him, making him feel extra assertive on his way to the train.

Waiting for the train his heartbeat slows down slightly, but there has been no downward movement (indicating sitting) so the soundtrack switches to “Come On Eileen” By Dexy’s Midnight Runners (heartbeat is still going fast but he isn’t moving any more)

Seated on the train (slower heart beat, slow breathing and a downward motion) “Every Breath You Take” by Sting kicks in, matching his heartbeat.

When he finally arrives at his station he is late (train was delayed) so he leaps out of the train and runs out the station with the Ramones (fast paced music matching his forward acceleration and heartbeat).  However he bumps into a pizza guy knocking him down.  While Matt curses him out, the microphone picks up his loud voice and The Clash eggs him on. 

Finally at the office he turns the volume down, but doesn’t remove his SYL and is rewarded with George Michael, The Eagles and Peter Gabriel (because of the sitting position with relaxed heartbeat and regulated breathing). 

When he gets up to take a coffee break he runs into Naomi, and the SYL changes over to “I want to know what love is” by Foreigner (sharp sudden intake of air with a slow heartbeat response and little movement).  However Naomi notices it, thinks it is cute and asks him out. His heart nearly stops, he hears a rush of cymbals and kettledrums, says yes and returns to his cubicle singing along Queen and “We are the Champions”

 

Situations/events correlated to emotional content

Research on computers reading emotions is large and varied.  It comprises areas such as basic research on what emotions are, how emotions are generated, how they are perceived, emotional effect on reasoning, emotional effect on perception, physiological emotional response, emotional signals (as part of the physiological response), recognition of emotional response, emotion synthesis, electronic bio-sensors, modeling of emotional patterns, mathematical signal and pattern analysis, and even wearable computing.

The scope of this project is limited and compounded by its goal.  The goal of the project is not just pure emotion recognition and response, but also the narrative state[8] of the user.  That means that not all emotions are to be taken in account.  It also means that certain actions are important for the system.  The importance of a factor can be determined with a simple test:  If I were to make a narrative of any sort would I include this factor? 


This is a good point to indicate the scope of this particular project.

I have made a proof of concept working prototype.  Further development is needed to in some fundamental research (in the study of physiological responses to emotions) as well as artificial intelligence decision-making with respect to learning what these responses mean to humans.

This project is more the creation of a systemic model for this type of product.  I will limit the input analysis to just one physiological variable, and to very broad types of movements.  This should be enough to do research on the types of responses this system can make, research on systems for interpreting the signals the sensors output and the development and choosing of decision-making algorithms that are appropriate to this.  Once this is done, adding other sensors and data streams from these is theoretically simple as the analysis framework is already done.

 

Emotional Framework

Joe Bates and Scott Neal Reilly, of Carnegie Mellon have been researching creating believable characters.  One of the components of believability is emotion.  They created an animated character and an emotional architecture for generating emotions for the character.  This architecture (which they call “Tok”) is described by Bates(J. Bates 1992).  Although we are not generating emotions in an animated character, we can use their framework for our input analysis.

They divide the emotions in two large groups Positive and Negative as follows:

Positive

Joy

Hope

Happy-for

Gloating

Love

Satisfaction

Relief

Pride

Admiration

Gratitude

Gratification

Negative

Distress

Fear

Startle

Pity

Resentment

Hate

Disappointment

Fears-Confirmed

Shame

Reproach

Anger

Frustration

Remorse

Not all of these are applicable to our system, especially due to the fact that not all are specifically identifiable by current sensing technology.

Importance of change

Baruch Spinoza emphasizes the importance of changes in our situation for the creation of emotions (Spinoza 1677).  There is also plenty literature supporting the fact that change breeds strong emotions, while sustained states, even in an emotional state, tend to weaken the emotional intensity or content over time.  It is fortunate then that we are using changes in the user’s narrative situation to power our system[9].  It is also important that we adjust our system to view these changes as positive and not as something to be avoided.  I point this out because many signal analysis systems and modeling algorithms tend to favor stable interpretation of systems, glossing over changes and utilizing points of view that minimize the impact of change.  This in part because computers are good at noticing everything while humans with the limited bandwidth of consciousness[10] are good at detecting change.  Computer programs are made so the results are relevant to humans, so they present results in terms of averages, means and with singularities erased from the picture.

 

Moods

Ben-Ze’ev, Dean of Research, Professor of Philosophy, and Co-director of the Center for Interdisciplinary Research on Emotions at the University of Haifa describes moods as emotions without intentionality (Ben-Ze'ev 2001).  Another researcher on the topic of emotions, Lyons (Lyons 1980) says that: “Moods lack a particular object; they are generalized emotions directed at the world at large” , while still others[11] say that moods are emotions in search of an object, emotions with alternating objects;  moods are general frames of mind that focus on a wide variety of loosely affiliated objects. 

Robert Thayer groups moods with respect to arousal.  He talks about 4 basic mood states:  Calm-energy, calm-tiredness, tense-energy, and tense-tiredness.  We can see that this can actually help us because we intend to measure motion in a person that can be correlated to energy.  Also calmness and tension can also be easily correlated to heartbeat, one of the biological readings that are the likely candidate for this project.  Also the effect that our system can have on a user is more easily prescribed as mood inducing than real emotion producing.  It is hard to make a person fall in love by playing songs, but it is easy to make the experience of falling in love more intense (or less) by creating the appropriate mood, or even the creation of the mood can facilitate or not the experiencing of an emotion.

Due to the fact that we are dealing with both emotions and moods and narrative situations we are going to change the vocabulary and introduce the word ‘affective’ in a relaxed sense to loosely include these three concepts.


Affective content correlated to physical data

The heartbeat can be either high or low.  In future versions the heartbeat monitor can automatically fine-tune itself to detect other states, plus have it auto adjust to each user.  For this version we use a potentiometer to adjust.

Heartbeat can rise and then stay up or it can rise and then slow down, as when you stand up quickly.

The accelerometer can detect up movements and forward movement.  Forward movement can be slow or quick. 

Following is a table of interpretation of what the signals can mean for a narrative situation:

 

Table 1 Narrative situations from sensor state

 

Not very interesting.

Yet if we start to combine other factors such as breathing we can begin to add states to the model

Where we see that not only more states are identifiable but also some are more precise.

 

It is expected that a clearer total narrative will be possible by the addition of additional sensors of different type.  Video tracking systems[12], Electromyograms[13], Galvanic Skin Response, voice recognition and other different sorts of sensors can help build the story.

 


Technology

Sensors

Heart beat

I am using a heart beat sensor that I made using various examples found in research.  The basic principle behind it is that the skin (which is slightly translucent) becomes slightly darker when the heart pulses because the arteries fill with blood and then becomes slightly lighter in between pulses as they empty slightly.  So what you do is place a light source against the skin and then a photo-detector against the skin.  The detector will output a weak signal, which is then amplified by a simple power amplifier and transmitted to a micro controller for analysis.

Accelerometer

I am using an ADXL202E.  It measures up to two g’s on two axis’s.  It is used to tell when the user is up or down (sitting or standing) and still, walking or running.

Breathing

A microphone placed in front of the mouth and nose can pick up breathing when it blows across the element.  That noise is easily identifiable using fast Fourier transform and band pass filtering.  Each breath is analyzed as a beat and beat analysis algorithms are used to measure frequency.

Voice

The same microphone can pick up voice.  Fast Fourier Transform can identify voices easily.  Coupled with an envelope analysis the system can tell how loud the user is speaking.




Embedded computation

A BX 24 is used to receive the signals from the heart beat sensor and accelerometer and send them via serial to the computer.

Pseudo code:

Listen for 10 heartbeats, analyze for frequency

Listen for 10 readings on the accelerometer on the X axis (do a period transform analysis for movement)

Listen for 10 readings on the accelerometer on the Y axis (do the same transform for movement)

If call for heartbeat has been received via serial send out current frequency

If call for X axis has been received via serial send out current movement

If call for Y axis has been received via serial send out current movement

Repeat

Prototype


BX microcontroller at the top right, Accelerometer at the bottom right, signal amplifier (for the heartbeat signal) in the middle of the board, potentiometers at the left for fine-tuning the heart beat monitor


Microcontroller enclosure with the top on, you can see the serial jack, a blue led that flashes with the heartbeat (for debugging and calibration purposes only) and sockets and plugs for the power and heart beat sensor.



Heart beat sensor: a red led (middle top) and a cds photocell (bottom left at 45 degrees) encased in a cube of foam that has been hollowed out to make space for the finger.

The system is powered by either a 9-volt battery attached to the bottom of the enclosure or a 120-volt adapter.  The BX24 receives signals from the amplifier and the accelerometer.  The amplifier creates the signals out of the variation of light that the photocell, which is flush against the skin)

 

The BX then communicates with the PC (actually the PC – BX communication is serial call and response) sending the data at least at 38,000 baud. 

 

The PC then, in Pure Data, receives the data and analyzes the data in light of the current narrative state.  If the data indicates any change in state then assume the new state and play the appropriate sound.

Final proposed version

 

A small programmable mp3 player with a flash card interface has an input for multiple sensors and the microphone.  The pulse and temperature sensor are embedded in the ear bud 

 


Next steps

Biometrics

Other types of sensors could be incorporated to the system.  This would increase the number and type of narrative situations that the SYL system can detect.  Some of these are:

PVP Measuring blood pressure can complement the pulse readings.  It can tell the system how strenuous the exercise being done is. Also, elevated blood pressure is an indicator of stress and anger, better than arterial pulse.

Skin temperature Skin temperature can be used to detect certain sympathetic nervous system responses such as blushing, which in conjunction with other readings can indicate certain narrative states.

Galvanic Skin Conductance Measures electric conductivity of the skin.  Electric conductivity is affected by pores, pore size, sweat and ph.  Sharp changes in skin conductance are a measure of stress, not just any stress but the type produced when a person lies, is startled or surprised.  

Electromyography Measures electrical fields generated by muscles when activated.  If we could strategically place them over specific areas we can find many ways to determine narrative states.  For example muscles in the jaw clench during frustration, muscles in the abdomen, fists, brow, even the back of the neck can all tell parts of the story.

EEG Can be used to determine mental states by analyzing brain waves.  It can be useful to detect confusion, relaxation or concentration.

Biochemistry Almost all biological responses are either produced by a chemical action or result in one.  Detection of these hormones and enzymes, as well as the concentration of them can be useful.  For example Yamaha has just developed a small portable amylase detector that analyzes saliva samples.  High concentrations of amylase are an indication of stress.

Others The Centre for Physical Electronics at the University of Sussex has developed a sensor (ultra high impedance field) that can measure signals as far as one meter away.  These could be sued to detect heartbeat, brain waves, muscle movement as well as incredibly weak internal signals such as the His-Purkinje discharge - a weak current that travels from the atrium to the ventricle in the heart.  Normally sensors need to be placed inside the aorta to detect these signals.  See Harland (C. J. Harland 2002) for the complete paper.


Appendix

Schematics

There are 3 areas, the Microcontroller, the accelerometer and the Heartbeat sensor

 

Codes

These are the codes at the moment of writing this paper.  However they are being developed and refined constantly.  I expect this to continue for a time.  Therefore it is advisable to visit the website of this thesis (http://thesis.ing66.com) for better versions of these codes.

BX24

'-------------------------------------------------------------------------------

Option Explicit

 

'-------------------------------------------------------------------------------

Public Sub Main()

 

 

 

delay (0.5)

 

' This program reads an Analog Devices ADXL202 accelerometer and

' displays each component of the 2D acceleration vector.

 

dim ins (20) as integer

dim insind as integer

dim insav as integer

dim corazon as integer

dim lub as integer

 

insind =0

 

    Dim Ax As Single, Ay As Single

    Dim Tx As String

    Dim corazon1 as Boolean

    Dim corazon2 as Boolean

    Dim gotit as byte

    Dim value as byte

    Dim success as Boolean

   Call Init

    gotit = 2

 

    Do

call putPin(9,1)

 

 

corazon = getADC(16)

'   ins (insind) = corazon

'   insind = insind + 1

'   if insind > 19 then

'                   insav =(ins(0)+ins(1)+ins(2)+ins(3)+ins(4)+ins(5)+ins(6)+ins(7)+ins(8)+ins(9)+ins(10)+ins(11)+ins(12)+ins(13)+ins(14)+ins(15)+ins(16)+ins(17)+ins(18)+ins(19))\20

'                  

'                   if insav > 0 then

'                  

'                                   corazon1 = true

'                                  

'                                   call putPin (9,1)

'                   else

'                                   corazon2 = true

'                                  

'                                   call putPin (9,0)

'                   end if

'                   insind = 0

   

'   end if

call putPin (9,0)

'if (corazon1 and corazon2) then

'   lub = 99

'   corazon1 = false

'   corazon2 = false

'else

'   lub = 00

'end if

 

 

 

Call GetByte (value,success)

       ' Read acceleration vector.

if value = 1 then ' if PD is ready to recieve data

    call PutI(corazon)

end if

 

 

'   call NewLine

    Call GetAccelerations(Ax, Ay)

        ' Convert to cm/s^2.

  '      Tx = "X: "

      '  Call PutStr(Tx)

    '               Call PutI(0)

    '               Call PutI(0)

if value = 2 then

        

    Call PutI(CInt(Ax * 981.0))

end if

'        Tx = ", Y: "

      '  Call PutStr(Tx)

if value = 3 then

    Call PutI(CInt(Ay * 981.0))

end if

 

'        Call NewLine

'   if (getPin(8)=0) then

'                   call putPin (9,1)

        

'                   debug.print "stopping"

'                   delay(0.8)

'                   call putPin(9,0)

'   end if

Loop

 

End Sub

'-------------------------------------------------------------------------------

Private Sub Init()

 

    Call OpenSerialPort(1, 38400) ' used to be 19200 but I munged it

 

 

    ' For calibration.

    Call GetPeriod

 

End Sub

 

'------------------------------------------------------------------------

'-------------------------------------------------------------------------------

Option Explicit

 

' This module is for reading the output of an Analog Devices ADXL202

' 2-axis accelerometer.

'

' These values depend on calibration.

Private Const CenterX As Single = 0.5

Private Const DeltaX As Single = 0.125

Private Const CenterY As Single = 0.5

Private Const DeltaY As Single = 0.125

 

Private Const PinX As Byte = 13

Private Const PinY As Byte = 14

 

Private Period As Single

'-------------------------------------------------------------------------------

Public Sub GetAccelerations( _

    ByRef Ax As Single, _

    ByRef Ay As Single)

 

' This procedure reads each axis of an ADXL202 accelerometer. Both components

' of a 2D acceleration vector are returned. Units are in gravities.

'

'      <------ Period ----->

'     +--------+            +----

'     |        |            |

'  ---+        +------------+

'      <--T1-->

'

' Acceleration = (T1/Period - 0.5)/0.125

 

    Dim T1X as single, T1Y As Single

    Dim SumX As Single, SumY As Single

    Dim i As Byte, T1 As Single

    Const Samples As Byte = 10

 

    SumX = 0.0

    SumY = 0.0

    For i = 1 to Samples

        Call PulseIn(PinX, 1, T1)

        SumX = SumX + T1

 

        Call PulseIn(PinY, 1, T1)

        SumY = SumY + T1

    Next

 

    T1X = SumX / CSng(Samples)

    Ax = ((T1X / Period) - CenterX) / DeltaX

 

    T1Y = SumY / CSng(Samples)

    Ay = ((T1Y / Period) - CenterY) / DeltaY

 

End Sub

'-------------------------------------------------------------------------------

Public Sub GetPeriod()

 

' This procedure determines the average period generated by the X axis

' channel of an ADXL202 accelerometer.

'

' The period is also denoted as T2 in Analog Devices documentation.

'

'      <------ Period ----->

'     +--------+            +----

'     |        |            |

'  ---+        +------------+

'      <--T1--> <--- T3 --->

 

    Dim SumT1 As Single, SumT3 As Single

    Dim T1 As Single, T3 As Single, i As Integer

    Dim AvgT1 As Single, AvgT3 As Single

    Const NSamples As Integer = 20

 

    SumT1 = 0.0

    SumT3 = 0.0

    For i = 1 to NSamples

        Call PulseIn(PinX, 1, T1)

        Call PulseIn(PinX, 0, T3)

 

        SumT1 = SumT1 + T1

        SumT3 = SumT3 + T3

    Next

 

    AvgT1 = SumT1 / CSng(NSamples)

    AvgT3 = SumT3 / CSng(NSamples)

 

    Period = AvgT1 + AvgT3

 

End Sub

'-------------------------------------------------------------------------------

 

 

 

Attribute VB_Name = "SerialPort"

'-------------------------------------------------------------------------------

Option Explicit

 

' This module is used to transfer data to and from the serial port.

 

Private Const InputBufferSize As Integer = 13   ' 4-byte buffer.

Private Const OutputBufferSize As Integer = 10  ' 1-byte buffer.

 

Private InputBuffer(1 To InputBufferSize) As Byte

Private OutputBuffer(1 To OutputBufferSize) As Byte

 

Private Const ASCII_LF     As Byte = 10

Private Const ASCII_CR     As Byte = 13

Private Const ASCIIplus    As Byte = 43

Private Const ASCIIminus   As Byte = 45

Private Const ASCIIdecimal As Byte = 46

Private Const ASCIIzero    As Byte = 48

'-------------------------------------------------------------------------------

Public Sub OpenSerialPort( _

    ByVal PortNumber As Byte, _

    ByVal BaudRate As Long)

 

' Opens a serial port at the specified baud rate.

 

    ' Com1 requires that the network be disabled. On the BasicX-01

    ' Developer Board, it may be necessary to raise pin 14, which can be

    ' done here or in the chip I/O initialization.

    '>>If (PortNumber = 1) Then

    '>>    Call PutPin(14, bxOutputHigh)

    '>>End If

 

    Call OpenQueue(InputBuffer, InputBufferSize)

 

    Call OpenQueue(OutputBuffer, OutputBufferSize)

 

    Call OpenCom(PortNumber, BaudRate, InputBuffer, OutputBuffer)

register.ubrr = 14

 

 

End Sub

'-------------------------------------------------------------------------------

Public Sub PutByte( _

    ByVal Value As Byte)

 

' Sends one byte of binary data to the serial port. The byte is sent

' directly without translating it to a string.

 

    Call PutQueue(OutputBuffer, Value, 1)

 

End Sub

'-------------------------------------------------------------------------------

Public Sub GetByte( _

    ByRef Value As Byte, _

    ByRef Success As Boolean)

 

' Inputs a byte from the serial port, if available. Returns regardless.  The

' Success flag is set depending on whether a byte is available.

'

' The byte is in direct binary format -- it is not in string format.

 

    ' Find out if anything is in the queue.

    Success = StatusQueue(InputBuffer)

 

    ' If data is in the queue, extract it.

    If (Success) Then

        Call GetQueue(InputBuffer, Value, 1)

    Else

        Value = 0

    End If

 

End Sub

'-------------------------------------------------------------------------------

Public Sub NewLine()

 

' Outputs a <CR> <LF> to the serial port.

 

    Call PutByte(ASCII_CR)

    Call PutByte(ASCII_LF)

 

End Sub

'-------------------------------------------------------------------------------

Public Sub PutLine( _

    ByRef Tx As String)

 

' Outputs a String type, followed by <CR> <LF>. Output is to the serial

' port.

   

    Call PutStr(Tx)

   

    Call NewLine

 

End Sub

'-------------------------------------------------------------------------------

Public Sub PutStr( _

    ByRef Tx As String)

 

' Outputs a String type to the serial port.

 

    Dim Length As Integer, Ch As String * 1, bCh As Byte

    Dim I As Integer

 

    Length = Len(Tx)

 

    For I = 1 To Length

        Ch = Mid(Tx, I, 1)

        bCh = Asc(Ch)

        Call PutByte(bCh)

    Next

 

End Sub

'-------------------------------------------------------------------------------

Public Sub PutB( _

    ByVal Value As Byte)

 

' Outputs a Byte type to the serial port.

 

    Dim Digit(1 To 3) As Byte

    Dim i As Integer, NDigits As Integer

    Const Base As Byte = 10

 

    NDigits = 0

 

    Do

        NDigits = NDigits + 1

        Digit(NDigits) = Value Mod Base

        Value = Value \ Base

    Loop Until (Value = 0)

 

    For i = NDigits To 1 Step -1

        Call PutByte(Digit(i) + ASCIIzero)

    Next

 

End Sub

'-------------------------------------------------------------------------------

Public Sub PutHexB( _

    ByVal Value As Byte)

 

' Outputs a Byte type to the serial port. Hexadecimal format is used.

 

    Dim Digit(1 To 2) As Byte, D As Byte

    Dim i As Integer, NDigits As Integer

    Const Base As Byte = 16

    Const ASCIIhexBias As Byte = 55

 

    NDigits = 0

 

    Do

        NDigits = NDigits + 1

 

        D = Value Mod Base

        If (D < 10) Then

            D = D + ASCIIzero

        Else

            D = D + ASCIIhexBias

        End If

 

        Digit(NDigits) = D

 

        Value = Value \ Base

    Loop Until (Value = 0)

 

    For i = NDigits To 1 Step -1

        Call PutByte(Digit(i))

    Next

 

End Sub

'-------------------------------------------------------------------------------

Public Sub PutI( _

    ByVal Value As Integer)

 

' Outputs an Integer type to the serial port.

 

    Call PutL(CLng(Value))

 

End Sub

'-------------------------------------------------------------------------------

Public Sub PutUI( _

    ByVal Value As UnsignedInteger)

 

' Outputs an UnsignedInteger type to the serial port.

 

    Dim L As Long, Tmp As New UnsignedInteger

 

    Tmp = Value

 

    L = 0

 

    ' Copy Value into the lower two bytes of L.

    Call BlockMove(2, MemAddress(Tmp), MemAddress(L))

 

    Call PutL(L)

 

End Sub

'-------------------------------------------------------------------------------

Public Sub PutUL( _

    ByVal Value As UnsignedLong)

 

' Outputs an UnsignedLong type to the serial port.

 

    Dim UL As New UnsignedLong, L As Long, Digit As New UnsignedLong

    Dim I As Integer, Temp As New UnsignedLong

 

    ' If the top bit is clear, the number is ready to go.

    If ((Value And &H80000000) = 0) Then

        Call PutL(CLng(Value))

        Exit Sub

    End If

 

    ' Divide by 10 is done by a right shift followed by a divide by 5.

    ' First clear top bit so we can do a signed divide.

    UL = Value

    UL = UL And &H7FFFFFFF

 

    ' Shift to the right 1 bit.

    L = CLng(UL)

    L = L \ 2

 

    ' Put the top bit back, except shifted to the right 1 bit.

    UL = CuLng(L)

    UL = UL Or &H40000000

 

    ' The number now fits in a signed long.

    L = CLng(UL)

 

    L = L \ 5

 

    Call PutL(L)

 

    ' Multiply by 10. Since multiply is not implemented for UnsignedLong, we

    ' do the equivalent addition.

    Temp = CuLng(L)

    UL = 0

    For I = 1 To 10

        UL = UL + Temp

    Next

 

    ' Find the rightmost digit.

    Digit = Value - UL

    Call PutL(CLng(Digit))

 

End Sub

'-------------------------------------------------------------------------------

Public Sub PutL( _

    ByVal Value As Long)

 

' Outputs a Long type to the serial port.

   

    ' Reserve space for "2147483648".

    Dim Digit(1 To 10) As Byte

    Dim NDigits As Integer

    Dim i As Integer

    Const Base As Long = 10

 

    ' The working number must be zero or negative. Otherwise the negative

    ' limit will cause overflow if we take its absolute value.

    If (Value < 0) Then

        Call PutByte(ASCIIminus)

    Else

                    Call PutByte(ASCIIplus) ' my add *************************************

        Value = -Value

    End If

 

    NDigits = 0

    Digit(1)= CByte(0)

    Digit(2)= CByte(0)

    Digit(3)= CByte(0)

    Digit(4)= CByte(0)

 

    Do

        NDigits = NDigits + 1

        Digit(NDigits) = CByte( Abs(Value Mod Base) )

        Value = Value \ Base

    Loop Until (Value = 0)

 

    ' Digits are stored in reverse order of display.

    For i = 4  To 1 Step -1 ' aca antes el 4 era NDigits ***********************************

        Call PutByte(Digit(i) + ASCIIzero)

    Next

 

End Sub

'-------------------------------------------------------------------------------

Public Sub PutSci( _

    ByVal Value As Single)

 

' Outputs floating point number in scientific notation format. The format

' is such that 13 characters are always generated. Sign characters are

' included for both mantissa and exponent. Exponents have 2 digits,

' including a leading zero if necessary.

'

' Example Formats:  "+1.234567E+00"

'                   "-7.654321E-20"

'                   "+3.141593E+05"

'                   "+0.000000E+00"

 

    Dim Mantissa As Single, Exponent As Integer, LMant As Long

 

    Call SplitFloat(Value, Mantissa, Exponent)

 

    ' Sign.

    If (Mantissa < 0.0) Then

        Call PutByte(ASCIIminus)

    Else

        Call PutByte(ASCIIplus)

    End If

 

    ' Convert mantissa to a 7-digit integer.

    LMant = FixL((Abs(Mantissa) * 1000000.0) + 0.5)

 

    ' Correct for roundoff error. Mantissa can't be > 9.999999

    If (LMant > 9999999) Then

        LMant = 9999999

    End If

 

    ' First digit of mantissa.

    Call PutByte( CByte(LMant \ 1000000) + ASCIIzero)

 

    ' Decimal point.

    Call PutByte(ASCIIdecimal)

 

    ' Remaining digits of mantissa.

    LMant = LMant Mod 1000000

   

    Call InsertZeros(LMant)

   

    Call PutL(LMant)

 

    ' Exponent.

    Call PutByte(69)  ' E

 

    If (Exponent < 0) Then

        Call PutByte(ASCIIminus)

    Else

        Call PutByte(ASCIIplus)

    End If

 

    ' A 2-digit exponent has a leading zero.

    If (Abs(Exponent) < 10) Then

        Call PutByte(ASCIIzero)

    End If

 

    Call PutI(Abs(Exponent))

 

End Sub

'-------------------------------------------------------------------------------

Private Sub InsertZeros( _

    ByVal X As Long)

   

    Dim NumZeros As Byte, I As Byte

 

    If (X >= 100000) Then

        Exit Sub                ' 100 000 <= X

    ElseIf (X >= 10000) Then

        NumZeros = 1            '  10 000 <= X <= 99 999

    ElseIf (X >= 1000) Then

        NumZeros = 2            '   1 000 <= X <=  9 999

    ElseIf (X >= 100) Then

        NumZeros = 3            '     100 <= X <=    999

    ElseIf (X >= 10) Then

        NumZeros = 4            '      10 <= X <=     99

    Else

        NumZeros = 5            '       0 <= X <=      9

    End If

   

    For I = 1 To NumZeros

        Call PutByte(ASCIIzero)

    Next

   

End Sub

'-------------------------------------------------------------------------------

Public Sub PutS( _

    ByVal Value As Single)

 

' Outputs a floating point number to the serial port. If the number can be

' displayed without using scientific notation, it is. Otherwise scientific

' notation is used.

 

    Dim X As Single, DecimalPlace As Integer, Mantissa As Single

    Dim Exponent As Integer, DigitPosition As Integer, Factor As Long

    Dim LMant As Long, DecimalHasDisplayed As Boolean

 

    ' Special case for zero.

    If (Value = 0.0) Then

        Call PutByte(ASCIIzero)

        Call PutByte(ASCIIdecimal)

        Call PutByte(ASCIIzero)

        Exit Sub

    End If

 

    X = Abs(Value)

 

    ' Use scientific notation for values too big or too small.

    If (X < 0.1) Or (X > 999999.9) Then

        Call PutSci(Value)

        Exit Sub

    End If

 

    ' What follows is non-exponent displays for 0.1000000 < Value < 999999.9

 

    ' Sign.

    If (Value < 0.0) Then

        Call PutByte(ASCIIminus)

    End If

 

    If (X < 1.0) Then

        Call PutByte(ASCIIzero)    ' Leading zero.

        Call PutByte(ASCIIdecimal)

        DecimalHasDisplayed = True

        DecimalPlace = 0

       

        ' Convert number to a 7-digit integer.

        LMant = FixL((X * 10000000.0) + 0.5)

    Else

        Call SplitFloat(X, Mantissa, Exponent)

        DecimalPlace = Exponent + 2

 

        ' Convert mantissa to a 7-digit integer.

        LMant = FixL((Abs(Mantissa) * 1000000.0) + 0.5)

 

        ' Correct for roundoff error. Mantissa can't be > 9.999999

        If (LMant > 9999999) Then

            LMant = 9999999

        End If

   

        DecimalHasDisplayed = False

    End If

 

    Factor = 1000000

   

    For DigitPosition = 1 To 7

       

        If (DigitPosition = DecimalPlace) Then

            Call PutByte(ASCIIdecimal)

            DecimalHasDisplayed = True

        End If

   

        Call PutByte( CByte(LMant \ Factor) + ASCIIzero )

       

        LMant = LMant Mod Factor

        

        ' Stop trailing zeros, except for one immediately following the

        ' decimal place.

        If (LMant = 0) Then

            If (DecimalHasDisplayed) Then

                Exit Sub

            End If

        End If

       

        Factor = Factor \ 10

    Next

 

End Sub

'-------------------------------------------------------------------------------

Private Sub SplitFloat( _

    ByVal Value As Single, _

    ByRef Mantissa As Single, _

    ByRef Exponent As Integer)

 

' Splits a floating point number into mantissa and exponent. The mantissa

' range is such that 1.0 <= Abs(Mantissa) < 10.0 for nonzero numbers, and

' zero otherwise.

 

    Dim X As Single, Factor As Single

 

    ' Zero is a special case.

    If (Value = 0.0) Then

        Mantissa = 0.0

        Exponent = 0

        Exit Sub

    End If

 

    X = Abs(Value)

 

    Exponent = 0

    Factor = 1.0

 

    ' Multiply or divide by ten to transform number to value between 1 and 10.

    Do

        If (X >= 10.0) Then

            X = X / 10.0

            Factor = Factor * 10.0

            Exponent = Exponent + 1

        ElseIf (X < 1.0) Then

            X = X * 10.0

            Factor = Factor * 10.0

            Exponent = Exponent - 1

        Else

            ' When we reach this point, then 1.0 <= mantissa < 10.0.

            Exit Do

        End If

    Loop

 

    ' Determine mantissa.

    If (Exponent = 0) Then

        Mantissa = Value

    ElseIf (Exponent > 0) Then

        Mantissa = Value / Factor

    Else

        Mantissa = Value * Factor

    End If

           

End Sub

'-------------------------------------------------------------------------------

PureData

#N canvas 451 52 813 901 10;

#X obj 125 72 r comctl;

#X obj 95 216 spigot;

#X obj 66 -16 bng 15 250 50 0 empty empty Rcv_beat 0 -6 0 8 -262144

-1 -1;

#N canvas 756 177 506 356 start 1;

#X msg 200 70 bits 8;

#X msg 198 122 parity 0;

#X text 278 125 parity 1=even \, -1=odd \, 0=off;

#X text 278 96 extra stopbit 1=on \, 0=off;

#X text 280 71 databits 5 \, 6 \, 7 \, 8;

#X text 279 42 use exact or higher baudrate;

#X obj 182 202 s comctl;

#X text 280 150 use handshake xon/off 1=on 0=off;

#X text 278 176 cts/rts hardwarehandshake 1=on 0=off;

#X text 308 244 set pollintervall for read in ms;

#X text 308 258 (default is 1 tick 1ms);

#X msg 79 165 close;

#X msg 26 63 open 0;

#X msg 199 94 stopbit 1;

#X msg 199 151 xonxoff 0;

#X msg 205 177 rtscts 1;

#X obj 57 36 loadbang;

#X msg 200 45 baud 38400;

#X connect 0 0 6 0;

#X connect 1 0 6 0;

#X connect 11 0 6 0;

#X connect 12 0 6 0;

#X connect 13 0 6 0;

#X connect 14 0 6 0;

#X connect 15 0 6 0;

#X connect 16 0 17 0;

#X connect 16 0 0 0;

#X connect 16 0 12 0;

#X connect 17 0 6 0;

#X restore 494 122 pd start;

#X obj 264 -83 tgl 30 0 on empty Comm_link 0 -6 0 8 -262144 -1 -1 0

1;

#X obj 126 201 tgl 15 0 empty on Comm_link 18 7 0 8 -262144 -1 -1 0

1;

#X obj 175 -11 bng 15 250 50 0 empty empty Rcv_X 0 -6 0 8 -262144 -1

-1;

#X obj 284 -13 bng 15 250 50 0 empty empty Rcv_Y 0 -6 0 8 -262144 -1

-1;

#X obj 158 33 s control;

#X obj 66 72 r control;

#X obj 56 271 s llego;

#X obj 222 239 r llego;

#N canvas 237 315 355 403 numberator 0;

#X obj 163 28 inlet;

#X obj 212 29 inlet;

#X obj 257 26 inlet;

#X floatatom 179 77 2 0 0 0 - - -;

#X floatatom 206 79 2 0 0 0 - - -;

#X floatatom 180 169 5 0 0 0 - - -;

#X obj 180 140 - 48;

#X floatatom 217 169 5 0 0 0 - - -;

#X obj 207 105 - 48;

#X floatatom 256 76 2 0 0 0 - - -;

#X floatatom 254 170 5 0 0 0 - - -;

#X obj 257 102 - 48;

#X obj 176 202 * 100;

#X obj 220 202 * 10;

#X obj 202 234 +;

#X obj 241 234 +;

#X floatatom 91 326 5 0 0 0 - - -;

#X obj 186 328 outlet;

#X obj 107 29 inlet;

#X floatatom 123 78 2 0 0 0 - - -;

#X floatatom 124 170 5 0 0 0 - - -;

#X obj 124 141 - 48;

#X obj 120 206 * 1000;

#X obj 156 234 +;

#X obj 42 30 inlet;

#X floatatom 58 79 2 0 0 0 - - -;

#X obj 50 142 select 45;

#X msg 39 171 -1;

#X msg 82 172 1;

#X obj 84 291 *;

#X obj 18 238 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1

-1;

#X connect 0 0 3 0;

#X connect 1 0 4 0;

#X connect 2 0 9 0;

#X connect 3 0 6 0;

#X connect 4 0 8 0;

#X connect 5 0 12 0;

#X connect 6 0 5 0;

#X connect 7 0 13 0;

#X connect 8 0 7 0;

#X connect 9 0 11 0;

#X connect 10 0 15 1;

#X connect 11 0 10 0;

#X connect 12 0 23 1;

#X connect 13 0 14 1;

#X connect 14 0 15 0;

#X connect 15 0 29 1;

#X connect 16 0 17 0;

#X connect 18 0 19 0;

#X connect 19 0 21 0;

#X connect 20 0 22 0;

#X connect 21 0 20 0;

#X connect 22 0 23 0;

#X connect 23 0 14 0;

#X connect 24 0 25 0;

#X connect 25 0 26 0;

#X connect 26 0 27 0;

#X connect 26 1 28 0;

#X connect 27 0 30 0;

#X connect 27 0 29 0;

#X connect 28 0 29 0;

#X connect 29 0 16 0;

#X restore 234 323 pd numberator;

#X floatatom 204 368 5 0 0 0 - - -;

#X obj 26 -93 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1

-1;

#X floatatom 176 490 5 0 0 0 - - -;

#X obj 146 496 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1

-1;

#N canvas 0 0 961 826 graphs 0;

#X obj 66 40 inlet;

#X obj 147 43 inlet;

#X obj 280 44 inlet;

#N canvas 0 0 450 300 graph2 0;

#X array xmovement 100 float 1;

#A 0 1594 1595 1594 1594 1594 1595 1595 1595 1595 1594 1595 1595 1594

1594 1595 1594 1594 1595 1595 1595 1595 1594 1595 1595 1596 1594 1595

0 1594 1595 1594 1594 100 100 100 100 100 100 100 100 100 100 100 100

100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100

100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100

100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100

100 100 100 100 100;

#X coords 0 2000 99 -2000 200 140 1;

#X restore 244 161 graph;

#X obj 95 313 tabwrite xmovement;

#X floatatom 161 229 5 0 0 0 - - -;

#X obj 89 226 +;

#X msg 89 199 0.5;

#X obj 119 253 moses 100;

#X msg 203 283 1;

#N canvas 0 0 450 300 graph2 0;

#X array ymovement 100 float 1;

#A 0 100 -109 -109 -108 -109 -109 -109 -109 -109 -109 -109 -109 -110

-109 -110 -109 -109 -109 -109 -109 -109 -109 -108 -109 -109 -109 -110

-109 1595 -109 -110 -110 -109 -109 100 100 100 100 100 100 100 100

100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100

100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100

100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100

100 100 100 100 100 100 100;

#X coords 0 2000 99 -2000 200 140 1;

#X restore 272 360 graph;

#X obj 78 524 tabwrite ymovement;

#X msg 527 266 \; xmovement const \$1 \; ymovement const \$1;

#X obj 344 45 inlet;

#X floatatom 165 419 5 0 0 0 - - -;

#X obj 93 416 +;

#X msg 93 389 0.5;

#X obj 123 443 moses 100;

#X msg 207 473 1;

#X connect 0 0 7 0;

#X connect 0 0 16 0;

#X connect 1 0 4 0;

#X connect 2 0 11 0;

#X connect 5 0 6 1;

#X connect 5 0 8 0;

#X connect 6 0 5 0;

#X connect 7 0 6 0;

#X connect 8 0 4 1;

#X connect 8 1 9 0;

#X connect 8 1 12 0;

#X connect 9 0 5 0;

#X connect 9 0 14 0;

#X connect 13 0 16 0;

#X connect 13 0 7 0;

#X connect 14 0 15 1;

#X connect 14 0 17 0;

#X connect 15 0 14 0;

#X connect 16 0 15 0;

#X connect 17 0 11 1;

#X connect 17 1 18 0;

#X connect 17 1 12 0;

#X connect 18 0 14 0;

#X connect 18 0 9 0;

#X restore 215 514 pd graphs;

#X floatatom 288 473 5 0 0 0 - - -;

#X obj 258 479 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1

-1;

#X floatatom 94 468 5 0 0 0 - - -;

#X obj 73 438 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1

-1;

#X obj 56 251 zl group 5;

#X obj 224 291 unpack f f f f f;

#X obj 29 224 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1

-1;

#X obj 617 365 vradio 15 1 0 8 empty empty empty 0 -6 0 8 -262144 -1

-1 0;

#X obj 641 419 up;

#X obj 639 375 down;

#X obj 416 514 / 100;

#X obj 500 530 hsl 128 15 0 10 0 0 empty empty empty -2 -6 0 8 -262144

-1 -1 0 1;

#X obj 347 496 - 1000;

#X obj 455 479 / 10;

#X obj 413 467 + 200;

#X obj 89 524 change;

#X obj 95 572 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1

-1;

#X msg 440 62 \; pd dsp 1;

#N canvas 60 111 365 425 voice_breathing 0;

#X obj 140 113 fiddle~;

#X obj 212 35 adc~;

#X floatatom 140 143 5 0 0 0 - - -;

#X obj 104 131 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1

-1;

#X obj 239 101 bonk~;

#X obj 299 119 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1

-1;

#X obj 21 119 timer;

#X obj 21 71 t b b;

#X floatatom 30 149 5 0 0 0 - - -;

#X obj 178 166 snapshot~;

#X floatatom 136 199 5 0 0 0 - - -;

#X obj 136 229 max;

#X floatatom 136 256 5 0 0 0 - - -;

#X floatatom 214 241 5 0 0 0 - - -;

#X obj 214 214 abs;

#X connect 0 0 2 0;

#X connect 0 1 3 0;

#X connect 1 0 0 0;

#X connect 1 0 4 0;

#X connect 1 0 9 0;

#X connect 3 0 7 0;

#X connect 4 0 5 0;

#X connect 5 0 9 0;

#X connect 6 0 8 0;

#X connect 7 0 6 0;

#X connect 7 1 6 1;

#X connect 9 0 10 0;

#X connect 9 0 14 0;

#X connect 10 0 11 0;

#X connect 11 0 12 0;

#X connect 14 0 13 0;

#X restore 638 128 pd voice_breathing;

#X obj 177 398 gate 3;

#X msg 57 16 1;

#X msg 206 16 2;

#X msg 315 16 3;

#X obj 139 317 r control;

#X obj 71 -121 r control;

#X obj 71 -91 gate 3;

#X obj 180 -143 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144

-1 -1;

#X obj 315 142 timer;

#X floatatom 324 205 5 0 0 0 - - -;

#X obj 223 116 timer;

#X floatatom 232 179 5 0 0 0 - - -;

#X obj 95 97 comport 0 38400;

#X connect 0 0 24 0;

#X connect 0 0 49 0;

#X connect 1 0 22 0;

#X connect 2 0 38 0;

#X connect 2 0 47 0;

#X connect 4 0 35 0;

#X connect 4 0 44 0;

#X connect 5 0 1 1;

#X connect 6 0 39 0;

#X connect 6 0 45 0;

#X connect 6 0 47 1;

#X connect 7 0 40 0;

#X connect 7 0 45 1;

#X connect 9 0 49 0;

#X connect 11 0 23 0;

#X connect 12 0 13 0;

#X connect 13 0 37 1;

#X connect 14 0 43 1;

#X connect 15 0 17 1;

#X connect 15 0 30 0;

#X connect 16 0 17 0;

#X connect 18 0 17 2;

#X connect 18 0 32 0;

#X connect 19 0 17 3;

#X connect 20 0 33 0;

#X connect 22 0 10 0;

#X connect 22 0 14 0;

#X connect 23 0 12 0;

#X connect 23 1 12 1;

#X connect 23 2 12 2;

#X connect 23 3 12 3;

#X connect 23 4 12 4;

#X connect 24 0 22 0;

#X connect 28 0 29 0;

#X connect 30 0 28 0;

#X connect 31 0 25 0;

#X connect 32 0 31 0;

#X connect 33 0 34 0;

#X connect 37 0 20 0;

#X connect 37 0 21 0;

#X connect 37 1 15 0;

#X connect 37 1 16 0;

#X connect 37 2 19 0;

#X connect 37 2 18 0;

#X connect 38 0 8 0;

#X connect 39 0 8 0;

#X connect 40 0 8 0;

#X connect 41 0 37 0;

#X connect 42 0 43 0;

#X connect 43 0 6 0;

#X connect 43 1 7 0;

#X connect 43 2 2 0;

#X connect 44 0 2 0;

#X connect 45 0 46 0;

#X connect 47 0 48 0;

#X connect 49 0 1 0;


Additional Reading

Included in this section are readings that have proven useful to this work but have not been directly cited.  They have however had a powerful influence in it’s making:

(Chellappa 1995)  A good example of how psychologists study emotions and how humans recognize them.

(Hegel, Knox et al. 1979)  Hegel’s seminal courses on Aesthetics

(Maker and Hegel Society of America. Meeting 2000) Interpretations and introduction to Hegel’s thought.

(Isaac 1995) A great introductory text to many complex probability functions, some of which are relevant to the decision making process used in this system

(Norvig 1995) Another introductory text relevant to the decision making process.  Great approach from the computer side of the problem.


References

 

Ben-Ze'ev, A. (2001). The Subtlety of Emotions. Princeton.

C. J. Harland, T. D. C., and R. J. Prance (2002). "Remote detection of human electroencephalograms using ultrahigh input impedance electric potential sensors." Applied Physics Letters 81(17): 3284-3286.

Chellappa, R., Wilson, C. L., and Sirohey, S. (1995). Human and machine recognition of faces: A survey,. IEEE,.

Fernandez, R. (1997). Stochastic Modeling of Physiological Signals with Hidden Markov Models:  A Step Toward Frustration detection in Human-Computer Interfaces. EECS. Cambridge, MIT.

Gause, G. F. (1990). Value and Justification. Cambridge, Cambridge University Press.

Hegel, G. W. F., T. M. Knox, et al. (1979). Hegel's Introduction to aesthetics : being the introduction to the Berlin aesthetics lectures of the 1820s. Oxford

New York, Clarendon Press ;

Oxford University Press.

Isaac, R. (1995). The Pleasures of Probability. New York, Springer.

J. Bates, A. B. L., and W.S. Reillly. (1992). An architecture for actions, emotion, and social behavior. School of Computer Science CMU-CS-92-144. Pittsburgh, PA, Carnegie Mellon University.

Kuhl, S. (1994). The Nazi Connection: Eugenics, American Racism and German National Socialism. New York, Oxford University Press.

Leighton, S. R. (1985). The concept of emotion. Ann Arbor, MI, Ann Arbor.

Lyons, W. (1980). Emotion. Cambridge, Cambridge University Press.

Maker, W. and Hegel Society of America. Meeting (2000). Hegel and aesthetics. Albany, State University of New York Press.

Nørretranders, T. (1998). The User Illusion, Cutting Consciousness Down to Size.

Norvig, S. R. a. P. (1995). Artificial Intelligence a modern approach. New Jersey, Prentice Hall.

Ryle, G. (1949). The concept of mind. London, Hutchinson.

Spinoza, B. (1677). Ethics. Princeton, NJ, Princeton University Press.

 

Copyright

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.



[1] To transcend time is to momentarily escape perception of it.  Children do this all the time when engrossed in play.  Adults have been known to escape this in deep prayer,  deep thought and certain artistic experiences.  It is useful to begin to think of this as those times in which a person can do these activities with such intensity that not only does the person lose track of time, it is as if time did not exist, thoughts can be multiple, almost simultaneous and can be produced in a way that when recollecting about them it feels as if they had been produced at incredibly large speeds.  It is no coincidence that products made during these times tend to have a lasting effect on humans: they evoke this special time, some so much that they become timeless themselves.

[2] I’m sinning a great sin here believing that western history is the history of the world.  However parallels can be found for other civilizations when they decide to become “modern” or westernized. It is an Illustration of sorts.

[3] For more on this see Kuhl, S. (1994). The Nazi Connection: Eugenics, American Racism and German National Socialism. New York, Oxford University Press.

[4] Just as Reason replaced Religion and took over certain key roles, whatever comes next would do the same.  If Religion gave people a reason to exist, Reason (or rationality) did the same when it took over.  The next paradigm will do the same.  When Reason replaced religion it did so in both rational and religious terms.  And the key players came from the fringes of religion but within religion anyway (Liebniz and Newton were educated by the colleagues of Huygens and Descartes who dabbled in alchemy and practiced astrology.  (Copernicus supported himself making astrological charts among others, his astronomy was his “hobby”.  Wikipedia (http://www.wikipedia.org/wiki/Nicolaus_Copernicus ) says that he was a besides being an astronomer, a church canon, governor and administrator, a jurist, astrologer and a doctor).  Reason’s replacement will come from the fringes of reason and will be able to play both the new game and rationality.  It is at the intersections, at the boundaries where there is enough energy to make revolutions.

[5] This is a difficult statement to uphold because when you place something on reality you must cover something else.  Reality has no real blank spaces that can be filled.  Yet the intention of Augmented Reality is not to supplant but to add.

[6] It should be clear by now that while I believe there is a difference between what exists and how it is perceived, for me, there is no effective difference between what is perceived and what is reality.  If I perceive an object as something, that something is what it really is.  A cell phone can be a cell phone, but if someone jams one into my eye it has become an eye poker.

[7] I strongly believe that art is the embodiment of life.  Even dark depressive nihilistic art is a product of life and vital energy that powers humanity.  As such, art as a motivator will tend to favor choices that better life, protect life and even encourage it.

[8] By narrative state I mean a peculiar combination of emotions, situations and external physical factors.  A narrative state is what a person would use to describe a past action.  Think "I was quietly minding my own business, reading a book in an outdoor cafe, when Britney Spears walks in, grabs me by the coat and slaps the hell out of me.  Then she suddenly stopped, a look of surprise came over her face, apologized and ran out, leaving me standing there, feeling hurt, embarrased and totally confused. 

[9] The system assumes a constant state until it can detect a change.  Once it decides on one state it assumes that the user remains in that state forever, or until a change happens.  If the narrative state is walking calmly, it remains as such until it changes.  This sounds obvious yet it is important to point out that the system is a responsive system, not a generative one, it waits for the change to happen and spends most of the time listening for clues that tell it a change has occurred.

[10] Human conscious bandwidth is around 16 bits/second.  That is something like 20,000 times less than the $50 microcontroller I’m using for this project.  For more on the subject of human conscious bandwidth see:  Nørretranders, T. (1998). The User Illusion, Cutting Consciousness Down to Size. 

[11] See Ryle, G. (1949). The concept of mind. London, Hutchinson, Leighton, S. R. (1985). The concept of emotion. Ann Arbor, MI, Ann Arbor, Gause, G. F. (1990). Value and Justification. Cambridge, Cambridge University Press.

[12] For example the muscles around the eye, which produce emotional results so quickly that we consciously have a hard time controlling them (when some one you do not like tells you something bad happened to them, these tend to smile first (for a microsecond) and then they are quickly controlled.

 

[13] Electromyograms detect and measure the electrical impulses directed at muscles (and probably the electrical fields generated when muscles activate).  An Electromyogram sensor on the jaw can indicate frustration as people tend to clench their jaw when stressed.  See Fernandez, R. (1997). Stochastic Modeling of Physiological Signals with Hidden Markov Models:  A Step Toward Frustration detection in Human-Computer Interfaces. EECS. Cambridge, MIT.