SlideShare a Scribd company logo
Programming Interactivity 2nd Edition 2nd
Edition Joshua Noble download
https://ebookbell.com/product/programming-interactivity-2nd-
edition-2nd-edition-joshua-noble-2509586
Explore and download more ebooks at ebookbell.com
Here are some recommended products that we believe you will be
interested in. You can click the link to download.
Programming Interactivity A Designers Guide To Processing Arduino And
Openframeworks 1st Edition Noble
https://ebookbell.com/product/programming-interactivity-a-designers-
guide-to-processing-arduino-and-openframeworks-1st-edition-
noble-55308452
Programming Languages And Systems 31st European Symposium On
Programming Esop 2022 Held As Part Of The European Joint Conferences
On Theory And Practice Of Software Etaps 2022 Munich Germany April 27
2022 Proceedings Ilya Sergey
https://ebookbell.com/product/programming-languages-and-systems-31st-
european-symposium-on-programming-esop-2022-held-as-part-of-the-
european-joint-conferences-on-theory-and-practice-of-software-
etaps-2022-munich-germany-april-27-2022-proceedings-ilya-
sergey-44887738
Programming 101 Learn To Code Using The Processing Programming
Language 2nd Edition 2nd Jeanine Meyer
https://ebookbell.com/product/programming-101-learn-to-code-using-the-
processing-programming-language-2nd-edition-2nd-jeanine-meyer-46238180
Programming 101 The How And Why Of Programming Revealed Using The
Processing Programming Language Jeanine Meyer
https://ebookbell.com/product/programming-101-the-how-and-why-of-
programming-revealed-using-the-processing-programming-language-
jeanine-meyer-46318424
Programming And Gui Fundamentals Tcltk For Electronic Design
Automation Suman Lata Tripathi
https://ebookbell.com/product/programming-and-gui-fundamentals-tcltk-
for-electronic-design-automation-suman-lata-tripathi-46318712
Programming With Openscad A Beginners Guide To Coding 3dprintable
Objects 1st Edition Justin Gohde
https://ebookbell.com/product/programming-with-openscad-a-beginners-
guide-to-coding-3dprintable-objects-1st-edition-justin-gohde-46410140
Programming In Two Semesters Using Python And Java Quentin Charatan
https://ebookbell.com/product/programming-in-two-semesters-using-
python-and-java-quentin-charatan-46494972
Programming The Future Politics Resistance And Utopia In Contemporary
Speculative Tv Sherryl Vint Jonathan Alexander
https://ebookbell.com/product/programming-the-future-politics-
resistance-and-utopia-in-contemporary-speculative-tv-sherryl-vint-
jonathan-alexander-46771488
Programming For Health And Wellbeing In Architecture Keely Menezes
Pamela De Oliveirasmith A Vernon Woodworth
https://ebookbell.com/product/programming-for-health-and-wellbeing-in-
architecture-keely-menezes-pamela-de-oliveirasmith-a-vernon-
woodworth-46780126
Programming Interactivity 2nd Edition 2nd Edition Joshua Noble
Programming Interactivity 2nd Edition 2nd Edition Joshua Noble
Programming Interactivity 2nd Edition 2nd Edition Joshua Noble
SECOND EDITION
Programming Interactivity
Joshua Noble
Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo
Programming Interactivity, Second Edition
by Joshua Noble
Copyright © 2012 Joshua Noble. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (http://my.safaribooksonline.com). For more information, contact our
corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com.
Editors: Shawn Wallace and Brian Jepson
Production Editor: Melanie Yarbrough
Proofreader: Kiel Van Horn
Indexer: Ellen Troutman Zaig
Cover Designer: Karen Montgomery
Interior Designer: David Futato
Illustrator: Robert Romano
July 2009: First Edition.
January 2012: Second Edition.
Revision History for the Second Edition:
2012-01-10 First release
See http://oreilly.com/catalog/errata.csp?isbn=9781449311445 for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. Programming Interactivity, Second Edition, the cover image of guinea fowl, and
related trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.
ISBN: 978-1-449-31144-5
[LSI]
1326301522
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
1. Introducing Interaction Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
What This Book Is For 1
Programming for Interactivity 2
The Nature of Interaction 3
Messages and Interaction 5
Interfaces and Interaction 6
Languages of Interaction 7
Design and Interaction 15
Art and Interaction 16
Data Exchange and Exploration 17
Working Process 21
2. Programming Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Why You’ll Read This Chapter More Than Once 24
The Nature of Code 24
Variables 25
Simple Types 26
Arrays 31
Casting 35
Operators 35
Control Statements 39
if/then 39
for Loop 40
while Loop 41
continue 42
break 42
Functions 43
Defining a Function 43
Passing Parameters to a Function 44
iii
Some Suggestions on Writing Functions 45
Overloading Functions 46
Objects and Properties 48
Scope 51
Review 52
3. Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Downloading and Installing Processing 56
Exploring the Processing IDE 56
The Basics of a Processing Application 58
The setup() Method 58
The draw() Method 60
The Basics of Drawing with Processing 63
The rect(), ellipse(), and line() Methods 63
RGB Versus Hexadecimal 64
The fill() Method 66
The background() Method 67
The line() Method 67
The stroke() and strokeWeight() Methods 68
The curve() Method 68
The vertex() and curveVertex() Methods 69
Capturing Simple User Interaction 70
The mouseX and mouseY Variables 71
The mousePressed() Method 71
The mouseReleased() and mouseDragged() Methods 72
The keyPressed and key Variables 75
Importing Libraries 80
Downloading Libraries 80
Loading External Data into Processing 81
Loading and Displaying Images 81
Displaying Videos in the Processing Environment 83
Using the Movie Class 83
Reading and Writing Files 85
Running and Debugging Applications 87
Exporting Processing Applications 88
Conclusion 91
Review 91
4. Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Starting with Arduino 94
Installing the IDE 95
Configuring the IDE 97
Touring an Arduino Board 99
iv | Table of Contents
The Controller 99
Uno Versus Mini Versus Mega 99
Touring the Arduino IDE 105
The Basics of an Arduino Application 108
The setup Statement 108
The loop Method 108
Features of the Arduino Language 110
Constants 112
Methods 112
Arrays 114
Strings 114
How to Connect Things to Your Board 118
Resistors 120
Hello World 121
Debugging Your Application 124
Importing Libraries 127
Running Your Code 130
Running Your Board Without a USB Connection 130
Review 130
5. Programming Revisited . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Object-Oriented Programming 133
Classes 134
The Basics of a Class 135
Class Rules 136
Public and Private Properties 137
Inheritance 139
Processing: Classes and Files 141
C++: Classes and Files 143
.cpp and .h 144
A Simple C++ Application 146
Pointers and References 148
Pointer 150
Reference 151
When to Use Pointers 153
When to Use References 154
Some Rules for Pointers 154
Some Rules for References 155
Pointers and Arrays 156
When Are You Going to Use This? 157
Review 158
Table of Contents | v
6. openFrameworks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Your IDE and Computer 160
Windows 160
Mac OS X 161
Linux 161
Taking Another Quick Tour of C++ 162
Basic Variable Types 163
Arrays 163
Methods 164
Classes and Objects in C++ 165
Getting Started with oF 166
Touring an oF Application 172
Methods 172
Variables 174
Creating “Hello, World” 174
Drawing in 2-D 176
Setting Drawing Modes 179
Drawing Polygons 179
Displaying Video Files and Images 182
Images 182
Video 184
Compiling an oF Program 186
Compiling in Xcode 186
Compiling in Code::Blocks 188
Debugging an oF Application 188
Using the cout Statement 189
Using the GNU Debugger 190
Using the Debugger in Xcode 190
Using the Debugger in Code::Blocks 192
Importing Libraries 193
ofxOpenCv 195
ofxVectorGraphics 195
ofxAssimpModelLoader 195
ofxNetwork 195
ofxOsc 196
Review 196
7. Physical Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Interacting with Physical Controls 199
Thinking About Kinetics 200
Getting Gear for This Chapter 201
Controlling Controls 202
The Button As an Electrical Object 202
vi | Table of Contents
The Button As an Interactive Object 202
Reading the Value of a Button 202
Turning Knobs 203
The Dial As an Interactive Object 203
Potentiometers 203
Using Lights 206
Wiring an LED 206
Detecting Touch and Vibration 208
Reading a Piezo Sensor 209
Getting Piezo Sensors 210
Detecting Proximity 210
Proximity Through Capacitance 210
Detecting Motion 216
PIR Motion Sensor 216
Reading Distance 218
Reading Input from an Infrared Sensor 220
Understanding Binary Numbers 222
Binary Numbers 222
Bits and Bit Operations 222
Why Do You Need to Know Any of This? 225
Communicating with Other Applications 225
Sending Messages from the Arduino 228
openFrameworks 229
Detecting Forces and Tilt 232
Introducing I2C 237
Gyroscopes 240
What’s Next 243
Review 244
8. Programming Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
The Screen and Graphics 248
Seeing Is Thinking, Looking Is Reading 250
Math, Graphics, and Coordinate Systems 251
Drawing Strategies 254
Use Loops to Draw 254
Use Vectors to Draw 256
Draw Only What You Need 262
Use Sprites 263
Transformation Matrices 263
Creating Motion 267
Shaping the Gaze 268
Setting the Mood 268
Creating Tweens 270
Table of Contents | vii
Using Vectors 276
Using Graphical Controls 285
ControlP5 Library 286
Event Handling 286
Importing and Exporting Graphics 288
Using PostScript in Processing 289
Using PostScript Files in oF 290
What’s Next 294
Review 294
9. Bitmaps and Pixels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Using Pixels As Data 298
Using Pixels and Bitmaps As Input 300
Providing Feedback with Bitmaps 301
Looping Through Pixels 302
ofPixels 303
Manipulating Bitmaps 306
Manipulating Color Bytes 309
Using Convolution in Full Color 310
Analyzing Bitmaps in oF 311
Analyzing Color 312
Analyzing Brightness 314
Detecting Motion 315
Using Edge Detection 321
Using Pixel Data 328
Using Textures 331
Textures in oF 332
Textures in Processing 335
Saving a Bitmap 338
What’s Next 339
Review 339
10. Sound and Audio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Sound As Feedback 342
Sound and Interaction 345
How Sound Works on a Computer 347
Audio in Processing 350
Instantiating the Minim Library 350
Generating Sounds with Minim 352
Filtering Sounds with Minim 356
Sound in openFrameworks 362
openFrameworks and the FMOD Ex Library 364
Maximilian 371
viii | Table of Contents
Physical Manipulation of Sound with Arduino 381
A Quick Note on PWM 382
Creating Interactions with Sound 385
Further Resources 385
Review 386
11. Arduino and Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Using Motors 390
DC Motors 391
Stepper Motors 394
Motor Shields 396
Smart Feedback 397
Using Servos 399
Connecting a Servo 400
Communicating with the Servo 400
Wiring a Servo 401
Using Household Currents 405
Working with Appliances 408
Introducing the LilyPad Board 414
Using Vibration 416
Nano, Fio, and Mini 419
Using an LED Matrix 419
Using the LEDControl Library 419
Using the SPI Protocol 422
Serial LED Matrix 423
Using LCDs 425
Using Solenoids for Movement 429
What’s Next 432
Review 432
12. Protocols and Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Communicating over Networks 436
Using XML 438
Understanding Networks and the Internet 441
Network Organization 441
Network Identification 442
Network Data Flow 443
Handling Network Communication in Processing 443
Client Class 444
Server Class 445
Sharing Data Across Applications 448
Understanding Protocols in Networking 453
Using the ofxNetwork Add-on 454
Table of Contents | ix
Creating Networks with the Arduino 469
Initializing the Ethernet Library 470
Creating a Client Connection 470
Creating a Server Connection 472
Wireless Internet on the Arduino 475
Communicating with Bluetooth 479
Using Bluetooth in Processing 479
Using the bluetoothDesktop Library 480
Communicating Using MIDI 482
Review 486
13. Graphics and OpenGL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
What Does 3-D Have to Do with Interaction? 489
Understanding 3-D 490
What Is OpenGL? 491
Working with 3-D in Processing 492
OpenGL in Processing 493
Lighting in Processing 494
Controlling the Viewer’s Perspective 496
Making Custom Shapes in Processing 501
Using Coordinates and Transforms in Processing 503
Transformations 506
3-D in openFrameworks 506
Drawing in 3-D 508
Transformations in openFrameworks 509
Lighting in OpenGL 509
Blending Modes in OpenGL 511
Creating 3-D Objects in oF 515
Using Textures and Shading in Processing 519
Using Another Way of Shading 520
What Does GLSL Look Like? 520
Vertex Shaders 521
Geometry Shader 522
Fragment Shader 522
Variables Inside Shaders 523
Using ofShader 524
Using Shaders in Processing 530
What to Do Next 531
Review 532
14. Motion and Gestures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
Computer Vision 536
Interfaces Without Controls 537
x | Table of Contents
Example CV Projects 538
OpenCV 539
Using Blobs and Tracking 539
Starting with ofxOpenCV 540
Detecting Features with oF 545
Using OpenCV in Processing 549
Feature Tracking in Processing 554
Using Blob Tracking with Physics 559
Exploring Further in OpenCV 565
Detecting Gestures 566
Using ezGestures in Processing 567
Using Gestures in oF 570
Capturing iOS gestures with oF 574
Touch with oF 577
Tuio 577
reacTIVision 578
CCV 578
What’s Next 578
Using the Microsoft Kinect 579
Processing 579
openFrameworks 580
Review 580
15. Movement and Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
Using Movement As and In Interaction 583
Using Software-Based Serial Ports 585
Understanding and Using GPS 587
Storing Data 599
Logging GPS Data to an Arduino 602
Using the breadcrumbs Library 602
Implementing Hardware-Based Logging 603
Sending GPS Data 606
Getting Location on a Mobile Device 608
On the iPhone 608
On an Android Phone 609
What to Do Next 610
Review 610
16. Spaces and Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613
Using Architecture and Space 613
Sensing Environmental Data 614
Using an XBee with Arduino 615
Creating a Simple Test 619
Table of Contents | xi
Configuring the XBee Module 621
Addressing in the XBee 622
XBee Library for Processing 624
Placing Objects in 2-D 628
Using the X10 Protocol 634
Setting Up an RFID Sensor 638
Reading Heat and Humidity 644
Determine Position of an Object 649
What’s Next 656
Review 656
17. Further Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659
What’s Next? 659
Software Tools 659
Construction Processes 662
Artificial Intelligence 663
Physics 664
Hardware Platforms 670
Bibliography 672
Interaction Design 672
Programming 673
Hardware 674
Art 674
Conclusion 675
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
xii | Table of Contents
Preface
This book is broken into three parts. The first introduces the three projects that will be
used throughout this book, the second introduces some of the most common themes
in creating interaction in designs and applications, and the third introduces some of
the more advanced topics that you may want to explore further. Also included with
some of the chapters are interviews with programmers, artists, designers, and authors
who work with the tools covered in this book. Covering such a massive range of topics
means that this book doesn’t go into great depth about most of them, but it is filled
withreferencestootherbooks,websites,designers,andartiststhatyoumayfindhelpful
or inspiring.
What Is—and Isn’t—in This Book
My excitement about the ideas and rapid growth of the field of interaction design is
hard to contain. However, as exciting and far-reaching as interaction design is, the
limitations of time and physical book size dictate that I be selective about what is and
isn’t covered in this book.
What’s In
This book covers Processing, Arduino, and openFrameworks. To help novice pro-
grammers, it covers some of the core elements of programming in C and C++ for Ar-
duino and openFrameworks and also covers the Processing language. We introduce
dozens of libraries for openFrameworks and Processing—too many to list here. Some
of these are official libraries or add-ons for the two frameworks, and some are simply
extensions that have been created for this book or provided by altruistic coders.
We also introduce some of the basics of electronics and how computer hardware
functions, as well as many tools and components that you can use with an Arduino.
The Arduino and Processing IDEs are covered, as are two different IDEs for
openFrameworks, namely, Code::Blocks, and Xcode. The Arduino Uno and Mini are
covered in depth, and we discuss other boards only briefly. We cover many electronic
xiii
components that have designed expressly for the Arduino, called shields, in depth as
well.
What’s Not In
While this book shows how to create some circuits, it doesn’t cover a great deal of the
fundamentals of electronics or hardware, how to create circuits, or electronics theory.
Chapter 17 lists some excellent tutorials and references. While the book does cover the
Processing subset of the Java programming language, to conserve space and maintain
focus, it doesn’t cover Java. The book doesn’t cover many aspects of C++, such as
templates, inline functions, operator overloading, and abstract classes. Again, though,
listed in Chapter 17 are several excellent resources that you can use to learn about these
deeper topics in C++.
There are so many Arduino-compatible boards now that it’s almost impossible to cover
them all in depth; the book mentions the Mega, the Nano, Fio, and several other boards
only in passing and leaves out many of the Arduino-compatible boards that are not
created by the Arduino team. Quite a few components and other tools that we would
havelikedtodiscussindepthcouldnotbeincludedtomaintainscopeandtosavespace.
Many topics that we would have liked to include have been left out because of space
considerations: artificial intelligence, data visualization, and algorithmic music, among
others. Though these are all potentially interesting areas for artists and designers, the
focus of the book is on teaching some of the theory and techniques for interaction
design as well as the basics of hardware and programming. The resources listed at the
end of the book can provide the names of some materials that might help you explore
these topics.
Conventions Used in This Book
The following typographical conventions are used in this book:
Italic
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements
such as variable or function names, databases, data types, environment variables,
statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values deter-
mined by context.
xiv | Preface
This icon signifies a tip, suggestion, or general note.
This icon indicates a warning or caution.
Companion Website
All the code included in this book is available for download from the book’s companion
website, http://www.oreilly.com/catalog/9781449311445.
Using Code Examples
This book is here to help you get your job done. In general, you may use the code in
this book in your programs and documentation. You do not need to contact us for
permission unless you’re reproducing a significant portion of the code. For example,
writing a program that uses several chunks of code from this book does not require
permission. Selling or distributing a CD-ROM of examples from O’Reilly books does
require permission. Answering a question by citing this book and quoting example
code does not require permission. Incorporating a significant amount of example code
from this book into your product’s documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the title,
author, publisher, and ISBN. For example: “Programming Interactivity, Second Edi-
tion by Joshua Noble (O’Reilly). Copyright 2012 Joshua Noble, 978-1-449-31144-5.”
If you feel your use of code examples falls outside fair use or the permission given above,
feel free to contact us at permissions@oreilly.com.
Safari® Books Online
Safari Books Online is an on-demand digital library that lets you easily
search over 7,500 technology and creative reference books and videos to
find the answers you need quickly.
Withasubscription,youcanreadanypageandwatchanyvideofromourlibraryonline.
Read books on your cell phone and mobile devices. Access new titles before they are
available for print, and get exclusive access to manuscripts in development and post
feedback for the authors. Copy and paste code samples, organize your favorites, down-
load chapters, bookmark key sections, create notes, print out pages, and benefit from
tons of other time-saving features.
Preface | xv
O’Reilly Media has uploaded this book to the Safari Books Online service. To have full
digital access to this book and others on similar topics from O’Reilly and other pub-
lishers, sign up for free at http://my.safaribooksonline.com.
How to Contact Us
Please address comments and questions concerning this book to the publisher:
O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)
We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at:
http://shop.oreilly.com/product/0636920021735.do
To comment or ask technical questions about this book, send email to:
bookquestions@oreilly.com
For more information about our books, courses, conferences, and news, see our website
at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
Acknowledgments
I need, first and foremost, to thank the wonderful engineers, artists, programmers, and
dreamers who created the platforms that I’ve covered in this book. It is to all of them
that I would like to dedicate this book. A woefully short list has to include Massimo
Banzi, Tom Igoe, David Cuartielles, Gianluca Martino, David A. Mellis, Ben Fry, Casey
Reas, Zach Lieberman, Theo Watson, Arturo Castro, and Chris O’Shea, the creators
of the frameworks covered in this book. There are dozens, if not hundreds, of other
names that should be on this list, but space is too limited to list them all. All I can say
is thank to you to all the creators of these frameworks and to everyone who uses them
to inspire, invent, amaze, and enrich the dialogue about design, technology, and art.
This book is a humble attempt to thank you all for everything you’ve given to me—
and to every other programmer, artist, or designer interested—for working with com-
puting in novel and interesting ways and bringing more people into the conversation.
I would also like to extend my deepest thanks to all my interviewees for taking the time
xvi | Preface
to respond to my questions and enrich this book and for so enriching the world of
interaction design and art. To everyone who provided code for this book as well, created
open source code, or answered questions on any of the forums for beginners: thank
you for your efforts to create a community.
This book is as much my effort as it is the sum of the efforts of the editorial team that
worked on it. My technical editors, Michael Margolis, Adam Parrish, Matt Obert, Jeff
Crouse, and Jeremy Rotzstain, have been absolutely fantastic. Their expertise, sugges-
tions, and fresh look at what I was working on shaped not only this book but enlight-
ened me, showed me new ways of solving problems, introduced me to new tools and
techniques, sharpened my thinking, and broadened my horizons for the better. This
book is a collaboration among all four of us in every sense of the word. I cannot pay
them enough thanks for their excellent work. I would also like to thank Justin Hunyh
and Mike Gionfriddo from LiquidWare as well as Nathan Seidle from Sparkfun for all
of their help. My editors—Shawn Wallace, Robyn Thomas, and Kim Wimpsett—have
been incredible, helping me with my sometime torturous grammar and patiently work-
ing with my propensity for sending in extremely rough drafts to bounce ideas off of
them. They have made this book better than it ever could have been without their
watchful eyes and guidance. Finally, I need to thank Steve Weiss for listening to my
idea when I first proposed it and helping guide it through to completion.
I need to thank all of my friends in New York, Portland, Amsterdam, Geneva, London,
Zurich, Boston, Paris, Copenhagen, and Toulouse for their support, their ideas, their
Internet, and their encouragement. I would like to thank my family as well, and par-
ticularly my mother, for their support and humor.
Preface | xvii
Programming Interactivity 2nd Edition 2nd Edition Joshua Noble
CHAPTER 1
Introducing Interaction Design
The scientist and philosopher Alfred Korzybski once remarked, “The map is not the
territory,” and it’s in that spirit that this book was written. The map may not be the
territory, but it is helpful for getting around the territory and for finding where you are
and where you want to go. This book covers a vast range of topics from programming
to electronics to interaction design to art, but it doesn’t cover any one of them in great
depth. It covers all of these topics because they are part of an emerging territory that is
often called interaction design, and that territory encompasses art, design, psychology,
engineering, and programming. It’s also a territory that is becoming more and more
accessiblethankstoexcellentprojectsliketheonesthatwe’llbeexploringinthebook—
tools that have been created to make code and coding easier to do.
You should use this book like a map to see what technologies exist and the areas in
interaction design that you might want to explore. This isn’t a cookbook or an in-depth
technical manual, but it will point you in the direction of other books, researchers,
designers,projects,andartistsasyougoalong.Thisbookwillalsogiveyouthetechnical
understanding to know how to find information on almost any kind of project that you
want to explore and what to do with that information once you find it.
What This Book Is For
This book was created under the premise that technology and code are not tools solely
for computer scientists or engineers to create applications and that no one be intimi-
dated by or shy away from working with and exploring electronics, hardware, and code.
Artists and designers can be interested in enabling interaction between users and be-
tween applications in ways that can be accentuated by the addition of custom computer
applications or that can be realized only through the use of custom computer applica-
tions. You can focus on creating applications that emphasize their technological nature
or on creating applications that feel very high-tech or use familiar metaphors like a
keyboard and mouse or touchscreen. You can also choose to accentuate other aspects
of the interaction or hide the technology behind a more organic interface. This book
is specifically about the interactions that users or viewers can have with computers,
1
electronics, tools, and the platforms that artists and designers can use to create appli-
cations and electronics that users can interact with. You’ll be learning about three tools:
Processing, openFrameworks, and Arduino.
These frameworks are designed specifically for artists and designers and as such are
perfect for discussing how we can begin to create interactive designs and artworks. Each
of them has a different background and uses different kinds of technology, but all of
them are created with the goal of helping you explore and create applications more
painlessly and quickly. In addition to showing you specifics of those three tools, this
book focuses on three slightly more abstract concepts: code, interaction design, and
ideas. Creating code is a similar activity whether you’re writing something in C++ for
openFrameworks or you’re creating some logic in a circuit with Arduino. In both cases,
you’re creating a process that will run many times, perhaps even thousands of times,
and that will generate the outcome you want.
This book also makes a few assumptions about you, the reader. I assume that you don’t
have a deep, or even any, programming or technical background. I also assume that
you’re a designer, artist, or other creative thinker interested in learning about code to
create interactive applications in some way or shape. You might be a designer wanting
to begin playing with interactive elements in your designs, wanting to create physically
reactive applications to explore some interaction design concept, or wanting to proto-
type an idea for a product. You might be an artist wanting to begin working with
interactive installations or with interactive computer graphics. You might be an archi-
tect wanting to get a basic understanding of programming and hardware to explore
reactive architecture. You might be none of these at all, which is fine, too, as long as
you’re interested in exploring these themes while you learn about the three frameworks
this book describes.
You’ll explore the nature of interaction through common tools and techniques as well
as through some discussions with designers, engineers, and artists working with inter-
action. In all likelihood, this book will not radically alter your perception of what in-
teraction is, nor will it introduce you to radically new modes of interaction. This book
will introduce to you to methods of creating common interactive elements that you can
then use to explore further techniques of facilitating interactions between users or cre-
ating interactive elements that a user or viewer can experience.
Programming for Interactivity
This book is called Programming Interactivity because it’s focused primarily on pro-
gramming for interaction design, that is, programming to create an application with
which users interact directly. There are many styles of programming, and some tech-
niques and ways of thinking about code are better suited to programming servers or
databases than interaction. In this book, we’re going to concentrate explicitly on things
you can use to tell users something or to have users tell your application something.
2 | Chapter 1: Introducing Interaction Design
One of the great challenges in interaction design is actually creating real interactions
between what you’re designing and the user who will be using it.
The Nature of Interaction
So then, what exactly is interaction? Interaction could be defined as the exchange of
information between two or more active participants. The writer and video game de-
signer Chris Crawford describes interaction as “an iterative process of listening, think-
ing, and speaking between two or more actors.” Generally, when we’re talking about
interaction and programming it’s because one element in the interaction is a computer
system of some sort or some control element that a person is trying to get to do some-
thing. The person for whom the computer or mechanical system is being designed is
called the user, and what the user is using is called the system. There are many different
terms floating around today, such as human computer interaction, computer human
interaction, or experience design. All mean more or less the same thing: designing a
system of some sort that a person can interact with in a way that is meaningful to them.
As an interaction designer, you’re trying to understand what the user wants to do and
how the system that you’re creating should respond. That system can be almost any-
thing: a game, a menu, a series of connected sensors and lights, a complicated physically
interactive application, or even a group of other people.
There is another key concept in interaction design that you should understand: the
feedback loop. The feedback loop is a process of an entity communicating with itself
while checking with either an internal or external regulatory system. That sounds a
little more complex than it actually is. You’re actually already quite familiar with bio-
logical regulatory systems; sweating keeps your body cool, breathing keeps oxygen
flowing through your body, and blinking keeps your eyes from drying out. When you
need more oxygen, your body breathes harder. This isn’t something you have to tell
your body to do; it simply does it. To maintain a constant level of oxygen, it sends out
signals to breathe more and more deeply or frequently until it reaches the correct level.
It feeds back on itself, sending signals to itself to breathe more again and again until it
doesn’t need to send those signals anymore. You can also think of the feedback that
you give yourself while staying upright on a bicycle. You’re constantly adjusting your
balance minutely, with your brain feeding data to your body and your body feeding
data back in a constant loop that helps you stay balanced. These loops are important
in the notion of a system that does something constantly. Without feedback, systems
can’t regulate themselves because they won’t know what they’re doing.
Let’s start at messaging and work our way up to interaction. While one participant
certainly may be more active than the other, the “interaction” doesn’t really apply when
we use it to describe a transmission, that is, a message sent to someone with no way of
handling a response. Think of a television commercial or a radio broadcast: it’s simply
a signal that you can listen to if you’re in the right place at the right time and you have
the right equipment. These broadcasts flow on regardless of whether you or anyone
else is listening, and they occur on their own time, in their own tempo.
Programming for Interactivity | 3
When you give a user a way of rewinding or controlling the tempo of information, an
extra layer of user control is added. You can’t really interact with a book or a static web
page, or even the vast majority of dynamic web pages, but you can control the speed
at which you read them, and you can rewind information that you’re not sure about.
These are really guided transmissions in that they give you a chunk of information that
is more or less established and ask you which part of it you want to view. Scrolling,
linking, fast-forwarding, and rewinding are all the techniques of guided transmissions.
When you give a user a way to accomplish a task or input data into the system that
changes it in a substantial way and you create a means for that system to respond to
what the user is doing, then you’re creating interaction. Reactive interaction is really
the beginning of interaction because it gets you started thinking about what the user
will do and how your system or object will react. For everything that user does, the
system or object needs to have a response, even if that response is “I didn’t understand”
or another kind of error message. This can also be built into a single system. Many
kinds of applications monitor their own performance, checking the state of a property
in the system or the number of boxes available in a warehouse, for instance. If you
imagine this as being an interaction between two people, then you might imagine a
parent giving a child an order.
A somewhat more complex model of interaction is one where the system is constantly
doing a task and the users’ input regulates that task. Many industrial monitoring sys-
tems function this way, as do the underlying parts of game engines, and many inter-
active installations. The difficulty of creating this kind of interaction is ensuring that
users always know what the system is doing at any given time, understand how they
can modify it, and understand exactly how their modifications to one aspect of the
system might affect another. If you imagine this between two people, then you might
imagine a parent helping a child walk, ensuring that she doesn’t fall over as she goes.
You can also imagine how a regulatory system might function, where the system reg-
ulates the user as they’re executing a task. This isn’t really two entities fully commu-
nicating because the regulated system doesn’t respond—it simply changes its
behavior—but it does involve continuous systems. Systems can perform this task on
their own as well, monitoring a process and providing regulation of an ongoing process.
This last mode of interaction blends into another. It is a very similar but slightly more
complex model of creating interaction that might be described as the didactic, or learn-
ing, mode of interaction. Here, the system is still running continuously, and the user
can see into the system, but instead of regulating the behavior, the user is learning from
the output data. A lot of monitoring applications function this way, providing a view
into relevant data and data points that the user can use to learn about a process. Again,
the system isn’t actively conversing with a user; it’s just running and reporting infor-
mation to the user. The user also has his process driven by the reporting from the system
but not really modified by it, which is why it’s a learning model. Both systems and
people are more than capable of learning from themselves, albeit in quite different ways.
4 | Chapter 1: Introducing Interaction Design
A more complex mode of interaction is a management type model where the user com-
municates something to a system and the system communicates something back that
allows the user to carry on with a secondary task. This is where you begin to see the
real complexities of communication between users and systems. The user is commu-
nicating with a system and asks the system to perform some task. The system responds
in a way that allows a user to continue with a secondary task. The system continues to
run, and the user continues to run even while she has her own internal feedback loop
occurring. One can find this in many real-time monitoring applications in fields from
finance to medicine.
Finally, we have the most complex mode of interaction: a full-fledged conversation.
This is something that humans have mastered doing amongst one another, but it’s
another matter altogether to create this between a human and a machine because of
how complex the notion of a conversation really is. When you think about how much
data is communicated in a conversation through words, tone of voice, facial expres-
sions, body posture, subtext, and context, you realize it’s a substantial amount of in-
formation being exchanged and processed at extremely high rates. Most user-system
conversations are a great deal less complex.
A simple but good example of this is navigating using a mobile device: the device is
constantly updating its position and displaying that back to the user and providing
directions, while the user is actively traveling and querying the device for information.
Enabling this conversational mode of interaction between users and systems is one of
the most pressing challenges in interaction design and engineering. These modes of
interaction all present different challenges and help users do different kinds of things.
You’ll find that the appropriate mode depends on the users, the task, and the context
in which the interaction is taking place.
Messages and Interaction
Interaction happens via messages sent from systems to users, and vice versa. These
messages can be text, speech, colors, visual feedback, or mechanical and physical input
or feedback. Depending on the kind of application, winking can be just as clear and
important a message as pushing a button. One thing that interaction designers talk
about a great deal is how to construct and receive messages in a way that is simple and
unambiguous for users and for the system.
One of the most difficult tasks in creating interactive applications is to understand how
the system sees messages from users and how the user sees messages from the system.
With applications that have a great degree of interactivity, allow more tasks for the user
and the system, and allow for more sophisticated messages, it is easy for a conversation
to become unclear to one party. When a message isn’t understood, it’s quite important
to help the other party understand not just what wasn’t understood but also how it can
be fixed. If I don’t understand something that someone says to me, I ask that person
to repeat it. If I ask for a web page that doesn’t exist, the server responds with an error
Programming for Interactivity | 5
page that tells me the page doesn’t exist. The more freedom each party has, the greater
the possibility of erroneous, unintended messages, and the greater the need for edu-
cating one party about what the other party understands and how that understanding
is being constructed.
Think for a moment about a conversation between two adults. Communicating like
this requires years of what could be described as user training: learning a language,
learning appropriate and inappropriate behavior, learning a value system, and so on.
It is because of this that the interaction between two humans can be as rich as it is. This
idea of training the user to understand what messages the system understands and what
a message from the system means is a tricky process. Creating a program with a datagrid
where a user can select items is quite simple for the user to begin to understand because
most computer literate users are familiar with the notion of a datagrid. We see datagrids
quite frequently, and we generally have an understanding of what they can do, what
they can’t do, a rough understanding of what error messages coming from datagrids
might mean, and how to use them. If you’re using a new kind of control or interface,
you’ll have to make sure that you provide ways for users to learn what your system is,
how it works, and what they can do with it.
There is a correlation between the richness of interactive systems and the difficulty of
creating it: the richer the interaction, the more that can go wrong. This is part of why
designers spend so much time and energy attempting to create anticipatable experien-
ces: interactive experiences where a user or viewer can leverage other realms of knowl-
edge or other experiences interacting. Popular slogans in design, like “principle of least
surprise,” express the notion that the familiar interaction is the preferable interaction
because the learning curve for the user is much more shallow than a truly novel inter-
action. Users must learn how feedback is returned to them and how to modify their
behavior based on the feedback, both of which can be a lengthy process.
Interfaces and Interaction
One part of the feedback from a system is actual messages sent back and forth—text
prompts, for example—but the interface is another important part of the communi-
cation of an interaction. An interface sits between two actors and facilitates their com-
munication. This can be a screen, a control panel, an interactive wall, or simply a
microphone and a pair of speakers. The interface is whatever shared materials the user
and the system use to send and receive messages. Interface design is a very large topic
unto itself, but it gets a little more manageable if you consider it in terms of what it
means for designing an interaction.
The interface is the medium of the communication between the user and the system.
It drives a lot of what is possible and what is not possible, what is efficient and what
isn’t, and what the tone of the interaction is. If you think about how you talk to someone
on the phone versus how you talk to them in person, you’re probably using more hand
gestures, facial expressions, and other forms of nonverbal communication in person
6 | Chapter 1: Introducing Interaction Design
and being more direct and using your tone of voice more when you are on the phone.
What we use to do something affects a lot of how we do that thing. Having a functional,
expressive, and attractive interface is very important in creating the means for an in-
teraction to occur. The attractiveness of an interface is an important part of making an
interaction pleasant to a user; the colors, text, symmetry, sounds, and graphics are
important and are communicative elements that shape a great deal about what a user
thinks about your system. This shouldn’t come as a great surprise to anyone, but users
prefer good-looking interfaces. What makes those interfaces attractive is largely a mat-
ter of context, both for your users and for the task that they’re trying to accomplish
with your system. While users prefer attractive interfaces, they need functional inter-
faces. The functionality of an interface is part of what makes a system good for a task
and what makes a user able to use your system. Even if what that system does is rather
opaque, the user still needs a functional interface that shows him what his input does
and gives him feedback.
It’s important to remember that interaction is more than the use of an interface. When
we consider the most common interactions between a user and a machine—for exam-
ple, a cell phone call—they’re quite simple in terms of the interaction between the user
and the object. For a cell phone, you simply dial numbers to find someone else in a
system; it alerts you if you’re being sought, and it sends and receives sound. This rel-
atively simple interaction is important for reasons other than the interaction between
the person and the object; it’s important because of the context of that interaction: you
can make a cell phone call from almost anywhere. Before cell phones, you needed a
phone line available to you, but now, with a cell phone, you simply need a phone and
an account. You can reach people while both of you are away from home, and you can
be reached when you are away from your home or office. When the cell phone first
emerged, cell phone users already understood how to make and receive telephone calls,
and the general pattern of the user interface was already established. True innovations
in user interfaces are very difficult to realize because they often require very substantial
engineering efforts and serious thinking by the interaction designer to ensure that the
interface will function properly. Also, they require a lot of user training and retraining.
There aren’t a great deal of true revolutions in user interfaces: the creation of the key-
board, Doug Engelbart’s mouse (the prototype of the mouse we know today), Ivan
Sutherland’s sketchpad, the desktop GUI, and now the capacitive touchscreen. These
were technological changes and impressive feats of engineering, and they were also
shifts in the way people used computers. Revolutionary interfaces shape more than just
the way that a tool appears; they redefine the possibilities of how a tool can be used.
Languages of Interaction
All interactions have a certain vocabulary that they use. If you think of how you delete
something from the desktop with a mouse, you might say, “I select the file and drag it
to the trash.” The actual actions that you’re performing when you do this are a little
different from what the system understands you to be doing, but that’s not really what’s
Programming for Interactivity | 7
important. What’s important is that you understand what the actions you can perform
are and you know that the system understands those actions in the same way and will
perform them in the same way that you expect. Having a meaningful, efficient, and
productive interaction, just like creating a language or a code, requires that both parties
agree on the meaning of the symbol and the meaning of the order in which actions
occur. Those particular understandings are going to be quite different depending on
the interface and type of interaction that the user undertakes.
In this book, we’ll examine some of the many different kinds of interactions, but don’t
take this next section as a list of categories. Considering the pervasiveness of computing
and interactions that exist with computing, there are so very many kinds of interaction
between humans and computers that it is difficult to even reference some of the most
common modes of interaction without some overlap among categories.
Physical manipulation
These are the first interfaces that were created for electronics and some of the first
designed multifunction man/machine interactions. Typically, before the advent of
the car and radio, which were the first two common machines with multiple in-
terface elements, a machine had a single switch or use. The user’s attention was
focused on a single task at a time. Radios and automobiles presented novel chal-
lenges because both required multiple actions by nonspecialists; in the case of the
automobile, this included speed and direction at all times and other tasks at irreg-
ular times. The interface might be a control that represents either a state that can
be activated by flipping a switch or pushing a button or a range that can be set by
turning a knob or pushing a slider. The interface lets users not only control the
values that they are setting but also check values via labeling of sliders, knobs, dials,
and switches. Dials, oscilloscopes, and other feedback interface elements let users
verify information more quickly without referring to the actual interface element
that they were manipulating. This requires that the user monitor multiple sources
of information at a given time while manipulating controls. Physical manipulation
ofacontrolisoneofthemostimportantandinterestingwaysofcreatinginteraction
with a system.
Input using code
At the dawn of the age of computing, the classic user interaction model was a
terminal where a user input code commands that were then run and the results
were reported to the screen in the form of text. The driving interactive concept was
to command the machine via a system of commands that the computer had been
preprogrammed to recognize. The user had to be knowledgeable or at the very least
comfortable with requesting help from a very bare interface. This is certainly not
the end of keyboard-based interactive behaviors, though. Consider the notion of
the hot key, for instance Ctrl+Z for undo, beloved by so many programmers and
ubiquitous in all applications from word-and image-processing applications to
browsers. The hot key is no different from the command line but accentuates the
8 | Chapter 1: Introducing Interaction Design
user interface by allowing the user to automate repetitive tasks or perform a task
quickly without diverting their attention from another task.
Mouse manipulation
This is the most common method of interacting with a computer at this moment
and the interface for which almost all commonly used applications have been de-
signed. Consider the language of working with the mouse, the techniques that have
been implemented by designers and learned by users: drag-and-drop, double-click,
and click-and-hold. These movements and the meanings behind them in different
applications are not completely standard, nor are they entirely fixed. One appli-
cation may use a given gesture in many different ways in a single application and
rely on the user understanding the feedback given to them by the application to
know which meaning of the gesture will be used in the current context.
Presence, location, and image
Theuseofthepresenceandabsenceoftheparticipantoruserisanextremelysimple
but profoundly intuitive way of interacting. This can be detected by weight, mo-
tion, light, heat, or, in certain cases, sound. The reaction to simple presence or
absence acts as a switch, begins a process, or ends a process. The presence of the
body, though simple, is a powerful basis of interaction; it engages users and asks
users to engage with their presence, their position, and their image. This can be as
simple as an automatic door sliding open as we approach, or as complex as Theo
Watson’s Audio Space, where visitors don a headset equipped with earphones and
a microphone and record messages that are then placed in the spot where they were
recorded. As another user enters the location where a message was left, the message
is played back along with any recorded by previous visitors. Each message sounds
as if it is coming from the spot where it was recorded. We can imagine the body as
a switch, or we can imagine the body as the image of the body and analyze this
using photos or videos in any great number of ways. This theme of embodiment
drives a great deal of fascinating interactions using what is called computer vision,
that is, the analysis of images input using a camera, turned into pixels, and then
analyzed. Later in this book, we’ll examine using computer vision to detect move-
ment in an image and even to detect the location of a human face within an image.
Haptic interfaces and multitouch
At the time of the writing of this book, Apple iPhone, Microsoft Surface, and a
great number of new tools for multiple touch-based interfaces have already been
introduced. Given the excitement around these technologies, the speed of change
and innovation will likely outstrip any attempts by myself or my editors to keep
this text abreast of the most cutting edge products or technologies. Nevertheless,
the fundamentals of designing and structuring interactions using these gesture-
based interfaces will likely not change. These essentials are based on what will be
familiar gestures to anyone who has used any of these products: using two fingers
to expand or contract, turning two fingers to rotate, tapping to select. These are
not used simply for software applications, either. Consider how often the waving
gesture is used in an airport bathroom with sinks to turn on the water, paper towel
Programming for Interactivity | 9
dispensers, and hand driers. The language of these gestures becomes a language
that we can use to enable interaction much as a common natural language, an icon,
or a pattern of buttons pressed on a video game controller.
Gesture
The gesture is a fascinating interactive model because it so readily associates itself
with signs, writing, and physicality. This notion of the interaction that is not driven
by a keyboard or a mouse is particularly powerful because mouse and key inter-
action is often nonintuitive for certain kinds of tasks. Gestures are often imple-
mented with touchscreen interfaces or mouse movements or pens and are very
often used for drawing applications, simple navigation elements, adaptive tech-
nologies, or applications for children. There are many different cutting edge inter-
active approaches that are being explored, from writing recognition systems and
novel key input strategies like Swype to hand motion recognition systems via video.
Voice and speech recognition
Voice recognition is the programming of a computer to recognize certain words or
phrases and perform certain tasks based on those commands. Commands can be
as simple as voice activation, that is, having the voice act as a switch to turn some-
thing on, and as complex as recognizing different words as commands. For a com-
puter, words or commands are recognized as patterns of sounds that are then
strung together and compared with a dictionary of patterns to determine what the
command could be. Speech recognition is a much more advanced topic, using
roughly the same approach as a simple command recognition engine, but with a
far larger dictionary and more powerful tools to determine the input. Beyond
speech, the voice itself can be used to provide input, volume, tone, and duration,
and can be used to drive the interaction between users and applications.
This is just a short list of some of the most prevalent themes in interaction design. In
this book, there won’t be space to cover all of these approaches to interactivity, but you
will learn some of the basics behind each of them and get information about further
resources that you can use for your own design work.
Interview: Matt Cottam
Matt is the CEO and cofounder of Tellart and provides both inspiration and direction
for the company through involvement in conferences, lectures, academia, and design
culture worldwide. He has been teaching studio courses at RISD on topics ranging from
design for extreme environments to physical computing since 1999. Matt holds the
position of Adjunct Professor at Umeå Institute of Design (UID Sweden). He is also a
Visiting Teacher each year at Copenhagen Institute for Interaction Design (CIID, Den-
mark), Oslo School of Architecture and Design (AHO, Norway), and The Central
Academy of Fine Arts, Beijing (CAFA, China).
What does it mean to sketch in hardware?
Matt Cottam: When I was a freshman at Rhode Island School of Design (RISD) in the
early nineties, only doctors had car phones (the size of shoe boxes) and the web felt
10 | Chapter 1: Introducing Interaction Design
like a clickable fax machine with a screen. By the time I graduated just five years later,
all of my student peers had mobile phones and we all had multiple email addresses and
were using browsers with color pictures, animation, and sound. It was overwhelmingly
clear that digital and networked technology was going to change the way we use, per-
ceive, and design products.
We had spent the past five years shaping blocks of wood and foam to look like digital
products, representing onscreen content by gluing printouts under acetate to the mod-
els, role playing with fellow students to explore and communicate the behavior of in-
teractive systems. This was good and we were after all at a very traditional, hands-on,
craft-based school, but something critical was missing. When you design a chair, you
cangotoa workshopandplayaround,cutting,shaping,andconnectinglotsofdifferent
materials: steel, aluminum, leather, plywood, plastic, cork, foam; pipe, rod, sheet,
resin. You can explore the capabilities of particular tools like a spot-welder or thermal
former, see when they burn, melt, stretch, scratch, and when they seem to work without
friction-when creating nice things seems effortless. You can work directly at the inter-
section of a particular tool and particular material to find the size and shape of an object
that shows off their unique strengths; you can create a form that feels to be in
harmony—because it was born directly from the intrinsic qualities of the medium and
method.
When I was a student it was impossible for a designer to sketch directly and fluidly
with the materials and tools of software and electronics. This led to an inability for the
designer to create physical product forms and software interfaces that felt synthesized.
There was no way to feel the real behavior, unlike the chair that you could just sit in.
When we started Tellart in 1999, we set out to create a studio of industrial and graphic
designers as well as electrical and software engineers that could work closely together
and quickly sketch a model of interactive with the real stuff products. We have been
active in the “sketching in hardware” or “physical computing” community since the
early days and have developed many hardware and software tools during our work with
students and clients. Now there are hundreds if not thousands of tools designed specif-
ically to close the gap between design and engineering—some of the most important
of which are taught in this book. Now the things Tellart makes not only have physical
form, including graphical and tangible user interfaces, but we are designing the content
and service layers holistically.
Do you see a relationship in being able to prototype and research? Or, I suppose, assuming
that you do see at least some relationship there, how do they fit together optimally? How
have you handled that in your design practice?
Matt: Just the other day I received a letter saying that I had been on the faculty at RISD
for 12 years, and I’ve been teaching at Umeå Institute of Design (UID) for 6 years and
Copenhagen Institute of Design for 3. Almost everyone at Tellart teaches at least a little
each year and we have lead courses in as far away places as China and Taiwan. People
often ask me how I make time for both teaching and Tellart, and the answer is simple:
they are a symbiotic relationship. We work with students who are always looking over
the horizon, always aiming to invent. We work closely, shoulder to shoulder in the
workshops with them, at table saws and APIs trying to constantly understand what the
Programming for Interactivity | 11
modern designer needs to do their work in optimal conditions. We create new hardware
and software toolkits—a constantly evolving suite we call Sketchtools—and test them
out with students. They get a new, experimental way of working and we get to see what
is possible when some of the brightest minds create with Sketchtools. We then take
documentation of our work together with the students and show it at international
conferences and to our clients. Almost our entire team is composed of former students.
I hesitate to call the work we do at schools “research” since it is not really academic or
even conceptual—it is really very tactical.
What tools do you find most influential and useful to you and your design practice on a
day-to-day basis?
Matt: The beautiful thing about working at Tellart and with students is that we switch
hardware and software tools like colors of paint. You can rarely work successfully with
just one, and learning how to mix them is where real talent comes in.
What does open source mean to you? What does sharing and communicating mean for
your practice?
Matt: We have always open sourced all of our Sketchtools and plan to keep doing so.
We have a handshake contract with our students to the effect of: the only way I can
share 100 percent openly with you is if you do the same with me—any ideas exchanged
in our class, including our toolkits, are up for grabs in for anyone involved any form
and at any time. I find that people who are possessive and competitive about their
knowledge tend to be insecure and fall behind quickly—the people who share effec-
tively know this. I’m not really interested in a magnum opus, I encourage students to
be prepared to come up with new ideas every day, not once in a lifetime. Of course
there is a role for client confidentiality but that is another mode of practice and the two
can live in parallel and even share a symbiotic relationship.
How do you move from a drawing or a video to a physical prototype? Also, if I can stay
on that line of thinking for a moment: how do you move from a physical prototype to an
electronic one (i.e, one that has at least some active element in it)?
Matt: This may be a bit of an oversimplification, but I like to think that we are getting
closer to having hardware and software tools that are no harder for a designer to become
competent with than a milling machine or thermal-former. I see tables covered in Ar-
duino, sensors, motors, pencil sketches, bits of plastic, fake fur, and clay. I guess it
depends whether you define prototype as an exact model for manufacture or as a
working sketch model. I find the term prototype problematic when used this way in
courses and with clients; we prefer to talk about working sketch models at varying
degrees of fidelity. If you mean developing a concept through making working sketches,
then I think pencil, electronics, software, physical model sketches can all be used used
simultaneously—they can be a sounding board for the designer while she gets an idea
out into the world (often making discoveries along the way) and not just a process for
building something predetermined.
What tools do you find most helpful for beginners?
Matt: Drawing and filmmaking. Call me old-fashioned but I believe that any profes-
sional designer worth their salt should be able to draw. I don’t mean portraits; I mean
12 | Chapter 1: Introducing Interaction Design
being able to make their ideas visible and understandable by others. To go further, I
find that being able to facilitate group work involving people from various disciplines
(often marketing, business leadership, manufacturing, technology) through improvi-
sational drawing is an essential skill—maybe more today than ever before, as things
like software and services are so intangible and things like data so formless, networks
so complex. Interaction designers have to concern themselves with product and service
ecosystems that are experienced by users over time and often over a variety of touch-
points, so developing a visual vocabulary for expressing changes and transactions (like
storyboards) is an invaluable skill. An interaction designer who can draw, build low-
to-medium fidelity working sketch models involving electronics and software and also
make short persuasive films that communicate how their product/service is culturally
and economically relevant, has it made.
Can you explain a little about the NADA project?
Matt: NADA was the first software toolkit Tellart made, back in 2001 (Brian Hinch
was the project lead). It allowed designers to use predecessors to the Arduino like Teleo,
Phidgets, and all kinds of MIDI devices to be connected to Flash. Design students in
2002 were connecting RFID readers to websites, and connecting the Web to lights and
motors within just a few weeks. Today this seems normal, but at the time it solved a
lot for us and our students.
Flash was something we already knew from making web projects and there was a ton
of books, online tutorials, and courses available on the topic aimed directly at designers.
Flash, especially back in version 4 when NADA appeared, was largely a graphical au-
thoring environment, which meant we could draw a blue square, select it, and tell it to
turn on a lightbulb when clicked (even less abstract for designers than writing HTML
referencing images in a folder).
Schools already had Flash as part of their annual purchase and installation (any teacher
knows that getting a new software package into that group can take years of begging).
NADA was a server written in Java. In all of our early interactive documentation, tu-
torials were always offered in both Java and Flash, encouraging collaboration between
engineers and designers.
Our documentation had code snippets, but more importantly it provided a very visual
diagnostic interface that detected which hardware you had connected and gave the
values for all analog inputs and PWM outputs. It seems simple enough to just trace all
of these values but I can tell you most designers working with NADA left this window
open most of the time. The interface even had an interactive resistor calculator that you
could adjust and see the effects directly on the outputs of your sensors.
We used NADA on countless client and classroom projects. Most of the time NADA
was a way to sketch and prototype, but many times it ended up in end products.
NADA then became NADA Mobile, which was an iApp and server combination that
allowed designers to make iPhone/iPod apps using just JavaScript and CSS and our
custom functions. Version 2 allowed for connecting Arduino to iDevices. We also
added the ability for connecting analog sensors to the headphone/mic jack of iDevices
to control apps, which made the hardware side of sketching dirt simple. Our most
Programming for Interactivity | 13
recent courses have involved iDevices and Android devices connected to Arduino, Zig-
bee and relays, allowing us to sketch with controlling everyday appliances from our
mobiles and tablets.
We also made several hardware toolkits and they are all part of the lineage we call
Sketchtools.
NADA is now just one of dozens of options for doing the same stuff, many of which
are in this book. Future versions of our Sketchtools will require less building from
scratch and be more about building combinations of hardware and software tools and
writing design briefs that push us, our clients, and our students to think beyond what
is currently possible. We never intended to be in the toolmaking process; we were just
at one of those awesome times in history when you have more ideas than ways to make
them. Now, thanks to all of the amazing toolkit projects out there, many of them made
by our good friends, we can focus more of our time on using the tools to make great
experiences.
I’m really intrigued by the “What Is a Switch?” course that you teach as an intro course
in a few different Interaction Design programs.
Matt: The “What Is a Switch?” design project brief was developed for our Designing
Interactions course at RISD in 2001. We had no way to experiment with tangible user
interfaces in a manner that made sense to teach in a one semester industrial design
course—we wanted to explore the need, use, value of technology, not the technology
itself. I asked students to go into the metal and wood and plastics shops and gather as
much interesting scrap as they could. The brief was then to each create 20 examples of
how a human gesture or an environmental influence (light, wind, or water flow, etc.)
could close a circuit. The circuit could be two lines drawn in pen on paper and the
paper then folded to connect them—there were no electronics at all; the circuits were
purely symbolic of connecting two components. Even today when our students come
in on the first day as Arduino experts, we still see the most inventiveness in this project.
There is just no friction and students allow themselves to be influenced by the qualities
of the materials they find—a pile of plastic circles or some wool strips or some perfo-
rated sheet metal. The project encourages listening to materials and forms and thinking
about scale and anatomy of components. This project is always done in under 24 hours,
from brief to critique—speed is a key ingredient.
The “advanced” version of “What Is a Switch?” came about when we found a pile of
keyboards in the school trash. We hacked the keyboard microcontrollers into these
kinds of sketch switches (now including just a bit of wire but still no batteries) and
captured the keystrokes in Flash. In literally a day worth of teaching and with zero
dollars in materials, the students could make something as complex as “open the door
and the video on the web plays, close the door and it stops.” This is still my favorite
project. The great thing about the low cost is that students treat the materials like
pencils or clay—they are fearless, as the materials flexible and rugged. The most amaz-
ing ideas come out.
14 | Chapter 1: Introducing Interaction Design
Design and Interaction
The great industrial designer Henry Dreyfuss called design “the measure of man.” By
this, he meant that the design of things is an excellent way to understand and analyze
the activities of human beings. Defining the word design is a task better left to others,
so I’ll leave my contribution at this: interaction design is the creation of tools for how
we do specific things. The more specific the thing, the more finely the tool can be honed
for it, and the more specific the interaction design can be. Interaction is sometimes
confused with “doing something with a tool,” and although that’s important, it’s a little
less specific than “how we do things with a tool.” Thinking about tools in terms of
how, rather than just what, when, or why, isolates those things about the interaction
that define the experience of doing that task. A lot depends on the task as well. A
singular task with a singular action does not foster much dissonance; therefore, it can
bear a lot more dissonance before it becomes meaningless. A task of multiple actions
creates much greater dissonance and can lose meaningfulness much more quickly.
The design of an interaction is a complex process that involves a lot of modeling of how
a system will work, how a user will approach the goal she’s trying to accomplish, and
how the interface needs to be configured to allow for all of these different operations.
All of these taken together create the context of the interaction that you’re making. The
context is very important to what choices you should make for the design of an inter-
action. You might want to make the interaction very cut and dry so that everything that
the user expects is given to her as quickly as possible and in an unambiguous manner.
Most business applications or very task-based applications function this way; users
know what they can do in unambiguous terms, and the interaction doesn’t deviate
much from that initial information. There is a real pleasure in knowing what to expect
and getting it so that you can make the interaction—and by extension the application
or object—attractive. Or, you might want to make something much more playful,
where the reward is in discovering the interaction and seeing it change throughout the
use of it. Either way, a good understanding of the context of the user will help you
create a better system and a better experience.
One of the tricks of interaction design is that, fundamentally, what users are trying to
do when they’re interacting with a system is to correlate it to something else that they’re
more familiar with. Anyone who has ever said or heard anyone else say “the computer
is thinking” has seen a little bit of anthropomorphic thought applied to a computer. As
human beings, we are very good at a few different things, and when it comes to inter-
action design, one of the more important things is using our understanding of the inner
processes of other people. Interaction with a system doesn’t really involve understand-
ing what someone else is thinking, but it does use some of the same cognitive processes.
To that end, as an interaction designer, you want to give good cues that will help users
understand what’s going on. They may not need to know exactly what the process of
your system is, and probably shouldn’t, but they do need to know more or less what
your system is doing with the information that they give it.
Design and Interaction | 15
Art and Interaction
Interactivity in art has been a hotly discussed and debated topic for at least 20 years
now, and the kinds of interactivity that you see in art pieces are constantly changing to
expand the definitions of art and interaction. There are many computer games that can
be considered art, many art pieces that can be considered industrial design, and a vast
and ever-increasing number of projects that can fit comfortably into art galleries and
design shows.
For the purposes of this book, there isn’t much point in differentiating between the
fields of interactive art, industrial design, interaction design, and traditional software
engineering. Although these different fields might seem quite different from one an-
other, they actually all share common goals. They all attempt to create objects and
experiences for users, they use similar tools and processes, and they all share a common
workflow that goes from sketch to prototype to final product to showing. You can think
of a continuum, where at one end there are predictable and well-defined things that
may be more suited for completing a task, and at the other end are more unpredictable
and dissonant works that challenge and provoke us but may not be useful in our ev-
eryday lives. There is a curious dance between art and design in interactive art that plays
on the relationship between simplicity and complexity, usefulness and uselessness, and
goals and open interpretations. Deciding which end of that spectrum is more interesting
to you has a lot of bearing on how you think about the interaction, but it doesn’t change
the code that you write or the way that you design your hardware.
Making interactive art is quite different from making noninteractive art because the
real object of interactive art is the situation. In painting, the object is the painting itself;
in sculpture, it is the object and the space around it; in a video piece, the object is the
video projection. In an interactive artwork, the object of the art is really the interaction
between the viewer and the system that the artist has created. That system can be very
technologically complex, it can have a single simple technical element, or it can have
none at all. This book discusses artists and artworks that make heavy use of technology,
what are often called new media artists, because they are artists who use or develop the
tools that you’ll be learning how to use. I distinguish new media art from interactive
art because projects that use programming (but that aren’t interactive) don’t have that
key characteristic of being created in the situation where the viewer encounters them.
There are many technologically sophisticated projects that use the tools covered in this
book but that are not actually interactive. For the most part, this book covers artists
who work with interactivity and projects that generate feedback in response to the
actions of a user.
One of the interesting challenges of working with interactive art is that the art can be
truly useful and functional in many ways while still being art. You also have a great deal
of control over the context of what that art is; an artwork can be viewed or experienced
in any location that the user chooses, altered to become something unrecognizable, or
used in a way that it was not intended to be used when it was first created. Many
16 | Chapter 1: Introducing Interaction Design
designers are exploring what they call critical design, designed objects that not only
function but exist to be thought-provoking as well, making users think in critical ways
that are usually associated with art rather than with design. This overlap between the
design of an object and the creation of an art experience is part of what makes inter-
activity such a rich topic for artists to explore because you can open the realm of what
a user can experience and explore in deeply expressive ways.
Data Exchange and Exploration
The task or goal that an interaction facilitates is as important as the way in which an
interaction is carried out between a user and a system. Again, the types listed here aren’t
being included to make a list of types of interactive work, but to show some of the
common themes that run through interactive art and design and to help you get an idea
of what you’ll be exploring in this book:
Supporting data visualization
Data visualization is an increasingly relevant theme given the amount of data that
we as members of an increasingly information-centric society must process. A well-
formed data visualization is a powerful tool because it lets a user not only com-
prehend individual data points but also understand the relationship between what
are called data points, detect patterns in the data, and even reconfigure and re-
contextualize information. Data visualization accelerates the ability of the user to
process and synthesize new information by not simply learning a fact but by lo-
cating the fact within a discourse quickly.
As the designer and writer Frank van Ham notes, “They should be massively col-
laborative...not focus on analysis but on communication...it should be visual and
end user driven.” The goal of data visualization is to generate, for the user, a view
into data. This can be a view that will help the user understand the data better, as
in the work of Ben Fry, where he creates beautiful diagrams that let a viewer more
quickly and more fully understand the relationships between the objects in the
data. His approach is informed by aesthetic considerations and by careful cognitive
and psychological research. I Want You to Want Me by Jonathan Harris and Sep
Kamvar retrieves data from online data sites and uses that information to generate
interactive visualizations. While still data visualization, this piece is a far more
dynamic and whimsical approach than the usual graph-and-chart approach used
in standard visualizations, and yet it performs deep and meaningful data parsing
and analysis.
The interaction of the user can be a process of refining, exploring juxtaposition,
mining new data, or storytelling. When designing data and the interaction with it,
we must consider not only what data is presented, but also how users will interpret
that data, what they might want to do with it, and how they would want to interact
with it. Interaction is far easier when the view into data and the visual representa-
tion of that view are clearly related. For instance, the visual representation of the
Data Exchange and Exploration | 17
data and the visual representation of filtering should be clear so that the user easily
understands what is being filtered and how to change it.
Organizing tasks
Some interactions are interesting because of what they allow us to accomplish. The
organization of tasks or actions or of discrete and discontinuous objects is the
driving force behind much of the thinking in interface design. When you look back
at the history of interfaces for machines and computers, you can see an evolution
of organizing tasks, applications, information, and acts. The now ubiquitous desk-
top model allowed the user to organize tasks in a way that leveraged both natural
cognitive abilities, like the ability to organize things spatially, and a familiar motif
for any office worker, namely, the desktop.
One challenge for interaction design is to conceive of ways to effectively put work-
ing spaces and organizational tools in places other than the traditional desktop
environment. Computing is everywhere, and users want access to programs and
data at more places. How to enable interaction on very small screens or with no
screen at all is an increasingly relevant challenge given the environments in which
users are interacting with environments.
Some of the themes of exploration are how to develop novel desktop environments
using new tools like multitouch screens, how to create tools for users to create their
own interfaces to fit their needs at a particular time, and how to create interfaces
for data visualization and tasks around data visualization.
These types of interactive applications tend much more to practical and functional
concerns, enabling users to complete tasks, organize information, and save infor-
mation. This certainly does not mean that they need to attempt to replicate an
operating system in functionality, but rather that they draw on that vocabulary of
interaction. This can be used in somewhat more subversive ways as well, as with
Adrian Ward’s Auto-Illustrator.
Creating experiences
Not all interactive designs need to rely on the traditional application model. In fact,
one of the most common and powerful modes of interaction is what might be called
the experiential model of interaction. These are often computer games, reactive
drawings, or eye-catching graphic displays that engage and entertain without a set
purpose. They often use novel connections between audio and visual stimulation
and create either spectacles that entertain users or have entertaining interactions.
The experiential interaction is very evident in the design of many kinds of computer
games, where the user can play a character in the game and see the world through
that character’s eye. Many times the interaction in these kinds of games is goal
oriented, whether that goal be moving to the next level, killing enemies, or scoring
points in some way or another. Many interactive installations use a similar model
ofinteraction,wheretheinteractionisplayfulbutoftenlacksthegoal-drivennature
of gaming and instead focuses on enabling the viewing of a spectacle or playing
18 | Chapter 1: Introducing Interaction Design
with some engine that creates sounds or graphics. The goal of this kind of inter-
action is often simply to entertain or engage.
Both games and interactive installations often allow for fast switching between
multiple views, perspectives, or models within the flow of the applications. This
can be useful not just in gaming but also in an architectural fly-through, to show
what a building will be like to walk through, or in data visualization. Gaming-style
interfaces are also quite common, with first person views onto a 3-D world or with
a 2-D view onto a world with the user controlling the view onto that world. These
also often involve creating an environment that is reactive to user actions and in-
dependently active when the user is inactive to create the illusion of a world. In-
teractive installations or more playful and less task-oriented pieces will sometimes
alsoinvolveinvertedmediums,whereonedrawsasound,asoundcreatesanimage,
a physical object becomes a virtual one, or vice versa.
Enabling collaboration between users
The interactiveness of an art piece most certainly does not need to be driven by
data or a virtual world; it can be driven by multiple participants in concert with
one another. We can conceive of this in a very straightforward way, such as in a
whiteboard collaborative application, or in an unpredictable and experimental
way, where the input of one user is added to the input of the others in a way that
can’t easily be anticipated. As with many of these topics, a range exists of predict-
able and consonant works to unpredictable and dissonant works. Locative gaming
where the game play is driven by the users’ locations is another kind of interactive
application that uses collaboration between users to drive the interaction. Many
network-based applications also use the model of collaboration between users to
drive the interaction. The system in these kinds of interactions tends to facilitate
communication and ensure that messages from one user are received by another
instead of generating messages and feedback for a user like a single-player game.
These applications can use chat-based metaphors or presence-based metaphors
like some of the large multiplayer games that have become popular lately, or they
can create a physical manifestation of each user. As long as the user has some
indication of how many other users are interacting and how their actions are af-
fecting the environment or those other users, the interaction can be
very compelling.
Controlling mechanics
One of my favorite teachers, writers, and engineers, Tom Igoe, wrote, “Computers
should take whatever physical form suits our needs for computing.” It is very lim-
iting to think of computing strictly in terms of the computer itself and the tradi-
tional interface to the computer, that is, the screen. In fact, interactive designs and
artworks can be far more. With the Arduino, we can easily create computers that
control machines out in the physical world. These machines can perform tasks as
simple as turning lights on and off or as complex as the control of robotics. The
machine can be controlled manually by a user or by many users, or it can be
Data Exchange and Exploration | 19
reactive, controlled by a program that dictates its responses in reaction to stimulus
from users or viewers or from a physical environment.
The control of mechanics can be very task-oriented with rigidly defined effects for
each user action, or it can be very playful as in a collaborative application. In the
latter case, the controls that the user has can be very loosely defined; that is, the
user may have to play with the installation to discover the action that the control
performs. In the case of task-oriented controls, the labeling and structure of the
controls should be very clearly delineated.
Using tools for performance and as performance
An application can be used as a way of creating an aspect of performance, aiding
aperformance,oraccentuatingaperformance.Youcanthinkofexamplesassimple
as the modification of an electric guitar to projects as complex as completely new
interfaces for musical development. An interactive application or tool is a means
to a performance or interaction, driven by a performer or driven by the audience.
Some of the most interesting uses of this mode of interaction involve sharing a
control between the performer and the audience, though this does require some
user training to ensure that the audience understands what they are supposed to
be doing. These tools don’t have to be as conceptually simple as creating a new
tool for a performer to use on a stage. They can allow users to create new elements
in a performance, control objects from remote locations, or create performers out
of the audience.
Creating environments
Many architects are beginning to explore what is called reactive architecture, the
marriage of architectural practices with computing to create houses and environ-
ments that react to users, environmental factors, and external commands. The
model of a feedback system is quite important to this model of interaction. The
environment needs to monitor itself using sensors or timers to know when to
change its state and when to maintain its state. At the simplest, a timer can be used
to tell a house to turn the lights on and off, a temperature sensor can be used to
maintain a certain temperature, a motion sensor can detect presence, or a humidity
sensor can be used to control a dehumidifier. However, by using more complex
sensors and systems, you can track movement in a space by using tags, cameras,
microphones, or wireless radios, and have a system use that data to make changes
in the environment to make it more comfortable, to make it louder, or to configure
it correctly. Many architects and technologists are designing spaces and buildings
that can be configured with a command by a user to change the way a space is used
or to make the space itself more interactive. These sorts of spaces are often called
smart rooms or enabled architecture, and they are an important area of research for
both architects and engineers. Computing doesn’t have to be limited to indoor
spaces, though; outdoor spaces like parks, walking trails, squares, or streets can
also be sites for interesting technological interventions that can be playful, helpful,
or thought-provoking. It is important, though, to always consider the appropri-
ateness of an application for the space in which it exists and how the user engages
20 | Chapter 1: Introducing Interaction Design
that interaction. In a public space, this becomes especially important since a user
should have the decision of whether to interact with it.
Telling a narrative or story
One of the more interesting themes beginning to emerge in interactive design is the
notion of using interaction to tell a story or narrative. These sorts of works typically
rely on the interface to allow the user to control the flow or direction of the narrative
using techniques cribbed from data visualization or gaming. Despite using con-
cepts familiar from gaming and visualization, narratives offer a different set of
challenges more familiar to filmmakers and authors than to engineering concerns.
Working Process
The actual process of creating interactive work generally follows a combination of any
of the following processes:
Conception
Conceptioncanconsistofsketchesinanotebook,adaydream,aproductorprocess
of research or something developed in consultation with a client who wants the
application for commercial purposes, or any combination of the three. You should
try to map out in as much detail as possible what you would like the application
to do, how the interaction should feel to the user, and the goals of the application.
All projects will require research and planning of some kind. You shouldn’t let this
suffocate you or stifle your creativity, but you should include it. Starting to sketch
without a clear plan of what you’re doing can often lead to great and new ideas.
For most people, I dare say that starting to write code without a clear plan of what
they’re doing usually doesn’t produce something usable.
Research
When you’ve decided what you would like your application to look like and how
you would like it to function, you’ll need to do the research on what components
you might need and what libraries or existing code might be available that can help
you create your project. If you need hardware, you should determine your budget
for your application and determine which components you’ll need and how they
fit into your budget. It’s important to ask questions either on forums or of collea-
gues to ensure that the components or approaches you’re considering will work.
Most projects will require different technologies, but almost all the requisite pieces
will be available, or you will be able to leverage existing projects that have been
created by you or by another artist or developer. Twenty years ago, this may not
have been true, but it is now.
Design
The design phase is one of the more amorphous because it blends so easily into the
research, conception, and actual building of your project. Sometimes you may not
have a design phase, and sometimes all you will have is a design phase, depending
on the requirements and nature of what you are building. At the very least, you
Working Process | 21
should define all the parts of your application clearly, have a clear vision of how
they will appear to a user and how they will respond to a user, and understand
exactly how a user’s action should correlate to an action by the system. It may help
to create diagrams that show the flow of actions and responses from the user to
the system and back. It may also help to create diagrams of different parts of the
system and show how those will appear to the user, what the user might want to
do with them, and how they relate to the interaction overall. You might not want
to plan everything in your application, but the more that you can plan, the easier
the actual building of your application will be.
Build
This is the process of actually putting together hardware and writing code. This is
where you’ll write, debug, probably research some more, and ultimately assemble
your application.
Test
Once you’re finished building your application, it’s important to test it. Testing
can be as complex as creating situations for users to use your application and ob-
serving how they use it, or it can be as simple as using the application or hardware
yourself and ensuring that everything works.
After testing, you might be ready to present your project by installing it or making
it available for download. If your project is a piece of hardware, then you may be
ready to prepare it for manufacture, if that’s your aim, or to place it in the location
and environment that you mean it to be used. You’ll want to make sure that ev-
erything works as intended before sending a project off, so having a good testing
phase is important.
Now that you’ve learned a little bit about what this book is about and the different
ideas that you’ll be exploring, you can start learning how to code.
22 | Chapter 1: Introducing Interaction Design
CHAPTER 2
Programming Basics
Writing code is never extremely easy; however, it is also not as difficult as you might
imagine. The basis of all programming is simple logic, and programming languages use
lots of simple math symbols and English words. So, if you’re comfortable with things
like equals signs, some very basic algebra, and a smattering of English words, you’ll
probably do just fine. This chapter is by necessity far shorter than it could be. Learning
all of the intricacies of writing code in even a single programming language, much less
multiple languages, takes years of study. However, you can easily learn some of the
basics, read documents, ask questions on user forums, and use what other people have
created, and then find yourself able to create projects and designs within a short amount
of time. With that in mind, this chapter is a simple introduction to the fundamentals
that the rest of this book relies on.
There are a few types of readers using this book. The first says, “I just want it to work.”
For you, this chapter will explain just enough that you’ll be able to follow along with
the examples in this book and the ones that you find online, and be able modify them
slightly to get them to do what you need them to do. You’ll definitely want to read this
chapter, probably more than once, but know that I understand your predicament. I
was there once myself. You should know, though, that simply copying and pasting
code with no understanding of what it’s doing is a very easy way to become seriously
frustrated. A general understanding of at least the basics of what your code is doing
will go a long way. Another kind of reader says, “I want it to work, and I want to know
why it works.” For you, this chapter will be an introduction. You’ll probably read it,
read some examples, and come back to this chapter again later. That’s a good thing.
You’ll probably also want other books soon. Some of the best are listed in Chap-
ter 17. Another kind of reader may be familiar with some material covered in this book
but not others. For you, this chapter will probably be a review and may not even be
necessary, but you might want to flip through it just in case you’re not familiar with
the Processing or Arduino languages or some of basics of C++. If you are familiar with
the basics of these languages, you might want to skip ahead to the chapters on the tools
themselves or to Chapter 5 for some more advanced material on programming.
23
Whichever type you are, you should read enough to understand what the code listings
in the rest of the book describe.
Why You’ll Read This Chapter More Than Once
In all likelihood, the first time you read this chapter, some of it will not make sense.
That’s perfectly normal and to be expected. As you read through the rest of this book,
when you have questions, return to this chapter. There’s no substitute for seeing how
code functions within the context of something interesting to you. Some of the ideas
might not make sense at first, but after seeing them put into practice, being patient,
and hacking at them, you’ll find that none of this is wildly complicated. Don’t be afraid
when you don’t understand something, don’t be afraid to look back at this chapter,
and above all, don’t be afraid to copy code from this book and change it until it breaks.
Hacking atcode,takingstuffthatworks,breakingit,andthen figuringoutwhyitbreaks
is the best way to understand. Of course, the goal throughout this book is to try to
provide code that will just work and thereby satisfy the first kind of reader, those of
you who simply want it to work and be done with it. In either event, though, this is
going to require some patience, because it simply won’t make sense the first time
through. With a little bit of patience, though, and the willingness to experiment, fail,
and try again, you’ll find that this isn’t all that difficult.
The Nature of Code
Throughout this chapter, you’ll be learning about programming—writing code, to be
more exact—so it’s important to know not only what code is but how it fits into the
process of creating a program. There are a few key terms that you should understand
before starting to program:
Code
Code is a series of instructions that a computer will execute when the code is run.
It is written in a programming language that, like natural languages, is essentially
a contract between two parties. In the case of code, though, the two parties are the
programmer and the compiler. You’ll learn more about a compiler shortly; for the
moment, we’ll just think of it as the listener who understands our code. Code can
be as simple as adding two numbers or as complex as rendering an animation.
What matters is that you write correct instructions to the compiler using a pro-
gramming language and a text editor of some sort and then tell the compiler what
files contain the instructions. Writing code is typing code instructions into a text
file that will later be passed to a compiler of some sort. To write a program can
mean writing source code from scratch, or it can mean putting several programs
together and creating a way for them to communicate. This can also mean config-
uring prebuilt projects. Creating applications and code doesn’t always require
24 | Chapter 2: Programming Basics
writing code, but if you have this book, then you’re probably interested in creating
code.
Files
Code is stored in text files that usually any text editor can open. These files contain
your code and nothing else. For larger and more complex projects, you can link
multiple files together. Sometimes, larger projects will have many hundreds of code
files that will all be linked together to create the sum of the code for the application.
Arduino projects use .ino files and sometimes .c files. Processing projects
use .pde files and sometimes .java files. openFrameworks projects use .cpp and .h
files. In each case, the different file types do different things and have different
purposes that you’ll learn more about later in this book.
Compiler
A compiler is a program that takes a code file (or many code files) and turns it (or
them) into a series of instructions that a computer will run as a program. Most
modern computers do not directly process any instructions that you write; instead,
you ask a compiler to turn your code into machine instructions. The compiler
optimizes machine instructions for the computer to run very quickly, but they
would be very difficult for a person to write, so the better step is to write code in
a more human-friendly way and convert it to machine-friendly instructions. This
means that when you write code for an Arduino controller or write some Java code,
you don’t simply run that code; you compile it and have the compiler create an
executable file that your computer can run. You can imagine the process of writing
code as a series of translations in which you tell the compiler what you want to do
with the program that it will create in a high-level programming language like
Processing or C++ and the compiler then creates a machine language file that will
run that file.
Executable
An executable is a file that can be run as an application. It is the result of writing
code and compiling it. Sometimes the terms application and executable are used
interchangeably, but they’re not the same. An application may consist of many
executable files, or it may consist of only one. In either case, for the kinds of projects
you’ll be learning to build in this book, you’ll always have an executable.
Now you’re ready to get started writing your own code.
Variables
Looking at variables is a good place to start. Everyone remembers variables from their
first algebra classes. You might have seen something like this written on a blackboard
or whiteboard:
x = 5
Variables | 25
That says, “There’s something called x, and it is equal to the number 5.” Variables in
computing are very similar. They represent something, and in fact they always represent
a certain kind of something. That’s a little different than the algebra example because
that example didn’t need to say that x is going to be a number; it just says, “x is a
number.” If you wanted to use code to make a number called x and use it as a variable,
you would do it like this:
int x;
The int indicates (or sets) the type of the variable. You can’t just make any type of
variable; you have to make specific kinds of variables. The kind of variable is called its
type; types are dealt with a lot more in the next section, so for right now, let’s concen-
trate on getting the basics of variables down:
int x = 5;
This code creates a variable named x that is an integer and has the value of 5. What this
means is that somewhere in your computer’s memory there is something called x that
is storing the value 5. You can set the value of x right away, as in int x = 5, or create
it and leave it for later use, as in int x. Look at another example:
int y = 10;
int x = 5;
int z = x + y;
This snippet shows some code that creates variables, gives two of them values, and sets
a third variable’s value to be the sum of the first two.
Simple Types
In the platforms covered in this book, all variables are typed. This means that they have
a type that tells the computer what sorts of things are going to be stored in the variable.
This is because numbers, letters (usually called characters), and true/false (called
Boolean values) all require different amounts of space to store and move around.
Here are some of the most common types that you’ll encounter in each of the pro-
gramming languages in this book.
int
This is the datatype for integers, which are numbers without a decimal point, like 2 or
20,392. Now, we’re about to run into our first real problem in this chapter: there are
three programming languages used in this book; they all have similar things, but they
sometimes work just a little bit differently. In Processing, integers can be as large as
2,147,483,647 and as low as -2,147,483,648. In Arduino and C++, the languages that
openFrameworks (oF) uses, things work a little differently, and understanding why
requires a quick explanation of signed and unsigned variables. The next small section
explaining signed and unsigned variables might be a bit heavy at first, so you may want
26 | Chapter 2: Programming Basics
to skim over it the first time, particularly if you’re more interested in working with
Processing.
Signed versus unsigned
As mentioned earlier, variables need to be declared with a type because the computer
needs to know how much space they will take up. That means that sometimes an int
is 4 bytes or 32 bits of information all the time and that it can store 4 bytes worth of
information. So, what happens when you need a negative int? Well, you have to store
whether it’s negative or positive, and the way you do that is by moving all the values
of the int down into the negative values. For the moment, you’ll see how this works in
C++, the language that oF uses, and then the rest of the languages will be addressed.
In C++, where the int represents a value in between -2,147,483,647 to 2,147,483,647,
if you have an int that is never going to use a negative number, you can use an unsigned
int that stores anything from 0 to 4,294,967,295. This is what’s called having signed or
unsigned variables. Unsigned variables don’t store negative numbers, whereas signed
variables do. The way this works requires a little bit of thinking about binary numbers.
An int is 32 binary values. Binary counting uses 1 and 0 to count instead of 0 through
9 like we’re used to doing. This means that when you want to set a variable to 1, you’ll
actually be storing the value 1 in the place where the variable is stored. When you want
to store the value 2, you’ll be storing 10, which means 1 in the 2’s place and nothing
in the 1’s place. Additionally, 3 is represented as 11, which means 1 in the 2’s place
and 1 in the 1’s place, for 2+1, which is 3. Further, 4 is represented as 100, which is 1
in the 4’s place and nothing in the 2’s or 1’s place. Therefore, 16 is 1,000, 17 is 1,001,
18is1,010,andsoon.Thisiscalledtwo’scomplementmathbecauseitcountseverything
up by squaring for the next value. That’s a very quick introduction to binary math, but
don’t worry, there’s a much more comprehensive discussion of this several chapters
later in this book where you begin using bits and binary.
Figure 2-1 shows the ways that signed and unsigned variables work. Remember that in
C++ the int is 32 bits, so there will be 32 boxes to show what each bit stores.
In unsigned numbers, the first bit is counted like any other bit. In signed numbers, the
first bit is used to store whether the number is positive or not, and this is why unsigned
variables can store larger values than signed variables.
Arduino and C++ use unsigned variables, and all variables are signed unless you indi-
cate otherwise by putting unsigned in front of the variable type:
unsigned int = 5;
Processing does not use unsigned variables; all numerical variables in Processing are
signed.
In C++, the language you’ll use with oF, signed ints are −2,147,483,647 to
2,147,483,647, and unsigned ints are between 0 and 4,294,967,295. In Arduino, the
int can be between −32,768 to 32,767. Tricky? Not really. Lots of times you won’t have
Variables | 27
to think about what you’re storing in the int. When you do have to think about how
large the value you’re going to be storing is, it’s time to use a bigger number type, like
long or double. We’ll discuss these later in this section. When using Processing, you
never have to think about how large the value will be at all, so it isn’t a problem. Simply
figure out whether you’ll need a decimal point. If you do, then use a float; if you don’t,
then use an int.
float
The float is the datatype for floating-point numbers, which are numbers that have a
decimal point. Floating-point numbers are often used to approximate analog and con-
tinuous values because they have a greater range of values than integers. Signed float
variables can be as large as 2,147,483,647 and as low as −2,147,483,647. Float variables
aren’t signed in C++ or Arduino.
char
This type can contain characters, that is, single letters or typographic symbols such as A,
d, and $. Here are two char variable declarations:
char firstLetter = 'a';
char secondLetter = 'b';
So,whatisdifferentaboutfloats,ints,andchars?charvariablescansometimesbeadded
together like numbers, but it’s not going to work the way you think it will. When
working with Processing or Arduino, it’s not going to work period, and with C++ in
openFrameworks it will work, but not as you might expect:
Figure 2-1. Setting the bits of signed and unsigned variables
28 | Chapter 2: Programming Basics
char thirdLetter = 'a' + 'b'; // this won't become 'ab' or 'c'
Like I mentioned earlier, Processing and Arduino aren’t going to like this at all. They’re
just going to throw errors at you and complain. C++, however, will work, and the next
section will explain why.
ASCII
Thereareafewwaysthatcharactersinacomputerarestored,andonewayisasnumbers
in a system called American Standard Code for Information Interchange, or ASCII. In
ASCII, a is 97, and b is 98. That’s why if you run the following snippet of code through
a C++ compiler or through Processing or Arduino, it’ll happily say that c is 195:
char a = 'a';
char b = 'b';
int c = a+b; // notice that a+b is being stored as an int
You can store the result of two characters being added together if you store the value of
the result as an int because adding the characters together is really adding the numbers
that they are stored as together.
All keyboard-related things can be stored as a char. That includes particular keys on
the keyboard. These are called character escapes, and they have a particularly special
place in programming because this is how you determine when the user has clicked a
key that can’t be represented with a letter or number. There are other encoding systems
that correlate numbers to letters, Unicode Transformation Format, or UTF, is a very
popular one that you might hear mentioned. Encoding is a complex topic and the most
important thing to understand is that the char is both a number and character.
bool or boolean
Boolean values store two possible values: true and false. In C++ and Arduino, the
true is actually a 1, and the false is actually a 0. It’s usually clearer to use true and
false, but you can use 1 and 0 if you like. They’re very handy for storing very simple
results: you received a message from the server or you didn’t, the user clicked the F key
or they didn’t.
For Arduino and Processing, you do the following:
boolean b = true;
In C++, you do this:
bool b = true;
Note that the Processing and Arduino version uses the word boolean, while C++ uses
the word bool.
Both true and false are reserved words. That means that the compiler only recognizes
them as being values that you can use to set Boolean variables. This means that you
can’t, for example, do this:
Variables | 29
boolean true = false;
It will cause errors, which is something that, although unavoidable, you generally want
to restrict to more interesting things that will help you create your projects.
string
A string is a sequence of characters. This is both a helpful, metaphorical way to think
about it and a matter of fact, and it is something that you’ll investigate more closely
later. The string includes helpful methods for looking at individual characters, com-
paring strings to see whether they’re the same or different, searching strings for parts
of the string (for example, finding “toast” in “toaster”), and extracting parts of strings
(getting “toast” out of “toaster”). The differences between a string and a char is that a
string is always defined inside double quotes ("Abc") and can consist of multiple char-
acters, while char variables are defined inside single quotes ('A') and can consist of
only one character.
Here are some strings in Processing:
String f = "foo";
String b = "bar";
String fb = f+b;// this will be "foobar"
Here are some strings in C++:
string f = "foo";
string b = "bar";
string foobar = f+" "+b;// this will be "foo bar" note the space w/in quotes
Note that Processing uses String, while C++ uses string. Why isn’t there any Arduino
example? Arduino doesn’t have a String or a string, because it doesn’t need one. We’ll
have to leave the explanation for this until the next section. Suffice to say, it’s not a
huge problem.
Since a String is defined within quotes:
String super = "super";
including quotes in a String requires the backslash character to be used preceding the
quote:
String quoted = "He said "It's super"."
This is known as an escape sequence. Other escape sequences include t for the tab
character, which is written t with the escape character, and n for newline, which is
written n. A single backslash is indicated by  because without the  in front, the
compiler would think that you’re writing an escape sequence. If you wanted to write
the characters that’s great!, you’d write this:
String quoted = "that's great!";
Otherwise, without the double backslash, you’d end up with this:
" hat's great!"
30 | Chapter 2: Programming Basics
Other documents randomly have
different content
"It's beastly weather, that's true enough!" cried Chicotin; "and cold! why,
my nose and fingers are frozen stiff. But it ain't very warm in your room
either, bourgeois; bigre! it's just the same as being on the boulevard."
"Well, stir up the fire, put on some wood."
"I ask nothing better."
Chicotin looked in all directions, then went into the outer room, and
returned in a moment, saying:
"There's one little difficulty, bourgeois, and that is that I don't find any
wood; the wood pile seems to have gone up in smoke."
"Already! the devil! the wood seems to go faster than the sugar!"
"Oh! that's easy to understand—it's dearer, because—look you,
bourgeois, here's a comparison: for fifteen sous, you get three or four sticks
of wood; they're bigger than a pound of sugar, to be sure, but they're very
soon burned up; in one day they're all gone; whereas, with a pound of sugar,
you've got something to lap and sip for a long while!"
"I'll do without fire," said Roncherolle. "Lying in bed, I don't need it, and
my little neighbor is going away."
"What a bungling fellow you are, Chicotin!" said Violette to the young
messenger, in an undertone; "you shouldn't have said anything, but when
you saw that there wasn't any wood in the other room, you should have
gone up to my room; you would have found some there. You know that
Monsieur de Roncherolle isn't willing that anybody should lend him
anything, so we must help him without letting him suspect it; and I don't
propose that he shall stay without a fire."
"That is true, I am an idiot!" muttered Chicotin, shaking his head; "but
bless my soul! I couldn't guess all that. Never mind, don't worry, I'll fix it all
right; I'll find some way to make a fire."
"Monsieur," said the girl, returning to the invalid, "if I remember right,
the doctor who came to see you yesterday prescribed medicine for your
gout."
"Doctors don't know of any remedy for this disease, my neighbor;
several of them have told me this themselves when talking with me."
"Nonsense! I have been told of several people who were entirely cured;
and I remember now—it was syrup of Boubée that he told you to take."
"That is quite possible."
"I beg you, monsieur, take some of it; even if it should do nothing but
lessen the pain, would that not be a great gain?"
"As you insist upon it, I will take some."
"If you are willing, monsieur, I won't stay long in my booth to-day, and I
will bring you some in a little while when I come home."
"No, no, my little neighbor, I won't have it; for you never tell me the
price of things; you manage so that they cost me almost nothing. But I don't
propose to have that, and I shall be angry if you go on acting in that way; I
shall be obliged to deprive myself of the pleasure of seeing you."
"Oh! it wouldn't do any good for you to forbid me to come, monsieur; I
should come all the same!"
Violette said this with such heartfelt earnestness that Roncherolle felt the
tears gather in his eyes. He pressed the girl's hand and replied in a cheerful
tone:
"I will obey you, neighbor; come, Chicotin, my groom, come here."
"Here I am, bourgeois."
"Go to the druggist's on the corner of the boulevard, and ask for some
syrup of Boubée. Will you remember that name?"
"I should say so; it isn't hard to remember. Syrup of Poupée."
"Boubée, you idiot! not Poupée."
"Oh! very good."
"Wait; I prefer to write it for you."
"On the whole, that will be better; my tongue might slip again."
"Here you are; and take that two-franc piece there—upon my table; I am
inclined to believe that that will be enough."
"Let us hope so! a paltry syrup—that can't cost so much as that; for two
francs you could get a lot of molasses.—I will go right away, bourgeois."
"Aren't you going to your stand, my little neighbor?" Roncherolle asked
Violette, who was stooping in front of the fire, trying to make the two sticks
burn by putting under them all the old papers that were lying about the
room.
"In a minute, neighbor; I will wait until Chicotin comes back."
"And your love-affairs, my child, how do they come on? You are fully
reconciled with your young lover now, I hope?"
"Yes, monsieur. Oh! Georget loves me dearly; he comes to see me every
day at my booth, and I am very happy, except when he frightens me."
"What's that? your lover frightens you?"
"You will understand, monsieur; Georget has never forgotten the
abominable remarks that that Monsieur Jéricourt made about me, and the
trap he led me into; but, monsieur, you don't know—Georget says that he
will kill Monsieur Jéricourt."
"He is right; he is a fine fellow; in his place, I would do the same."
"But I don't want him to fight; for, after all, monsieur, the man who is in
the right doesn't always win; and if Georget were killed, I should be very
unhappy."
"You are right; that boy must not take the risk; he is so young—eighteen,
did you tell me?"
"Yes, monsieur."
"Then he probably doesn't know anything about the sword or the pistol?"
"Nothing at all; he would be killed instantly."
"Patience, my little neighbor. Corbleu! if only I could get well!—But I
hear Chicotin, I believe."
The young messenger returned with a sheepish expression, holding the
two-franc piece in his hand.
"Well, where is the syrup, Chicotin?" asked Roncherolle.
"The syrup is at the druggist's, monsieur."
"What do you mean by that?"
"I mean that it's an outrage! Just fancy that a little bottle no bigger than
my wrist costs twelve francs!"
"Twelve francs?"
"Yes, monsieur, syrup of Poupée twelve francs, no less; it wasn't any use
for me to say: 'Put me up forty sous' worth in a little pomade box'; he
laughed in my face and told me they didn't sell it at retail; he showed me a
bottle, all sealed, with the price on it. Then I said: 'If the gout can only be
cured at that price, only rich people can be cured!'—'Only rich people have
the gout,' said the clerk. I say, bourgeois, that's nonsense, ain't it? For it
seems to me that you're none too well fixed."
Violette nudged Chicotin, saying in an undertone:
"You ought to have said that the syrup wasn't ready, and I would have
gone out and bought it and paid for it without letting Monsieur de
Roncherolle know the price."
"He would have found it out all the same, mamzelle, for the price is
pasted on the bottle; it wouldn't have been possible to deceive him, and how
he would have sworn then!"
Roncherolle had dropped his head on the pillow, and said nothing more.
Chicotin handed him the two-franc piece, saying:
"Shall I buy anything else with this, bourgeois?"
"You may buy some wood, my boy, and make a fire; but not until
evening; for my little neighbor comes to sit with me in the evening, and I
don't want her to freeze in my room.—Now leave me, my children; I don't
want anything more, and I am going to try to sleep."
Violette pressed the invalid's hand and went out, with a feeling of
oppression at her heart; Chicotin followed her, muttering:
"Poor dear man, not to be able to buy what might cure him; it ain't very
gay here; but never mind, I will come back soon and see if he wants
something else that don't cost so much."
"And you won't spend his two francs, will you, Chicotin? you must get
some wood in my room."
"Yes, mamzelle, but what shall I do with his money? I can't give it back
to him."
"Keep it; it will serve to buy something else which may be dearer still;
and you mustn't tell him, as you did to-day. To think of his being without a
fire, in such cold weather, and when he is suffering so! for to-day I could
see on his face the efforts he made to conceal his suffering; why, it makes
me want to cry!"
"After all, Mamzelle Violette, you mustn't feel so bad for somebody who
ain't anything to you."
"Oh! he is so wretched, without relations, or friends, sick and poor; and
then there are people for whom you feel affection right away; and Georget
won't be jealous of him; I feel that I have a sincere affection for him."
"I am going to see if Mirontaine is cured, and if Madame Lamort can go
up."
Violette had been at her stand for some time, when Monsieur de
Brévanne came there and inquired about her neighbor. The girl gave him an
exact description of his plight; she concealed nothing from him, neither his
suffering, nor the privations which he was obliged to undergo, nor the pride
which made him refuse any assistance in the form of money.
"He has no fire now," said Violette, her eyes wet with tear; "and he isn't
willing that we should make him one before evening, because I go to sit
with him in the evening, poor man! and he did not have the money to buy
something that might perhaps have cured him.—Ah! he is very
unfortunate!"
The count listened attentively to the girl's story; Roncherolle's position
touched him more than he chose to show. He stood for some time buried in
thought, then he said to Violette:
"I would like to judge for myself of this gentleman's plight, of his
situation, but I should not want him to see me."
"That is very easy, monsieur; in the first place, Monsieur de Roncherolle
never leaves his bed, and a person can stand in the outer room and look into
the other without his seeing him; in the second place, he often sleeps, and I
am always careful not to wake him."
"Well, I will go this evening, I will go to see you, with Georget."
"Oh! how kind it is of you, monsieur! I am very sure that you will have
compassion on my poor neighbor."
"On your account—it is possible.—But not a word concerning me, my
child!"
"Oh! I am dumb, monsieur; but I am very glad that you are coming to
see my neighbor."
About eight o'clock in the evening, Violette was installed in
Roncherolle's room; he had been dozing for some time, and when he woke,
his eyes met those of the young girl, who, as she mended her neighbor's
linen, glanced at him often to see if he were asleep.
"Really, my dear child," said Roncherolle, "your kindness to me fills me
with gratitude, and reconciles me to your sex; for, if I must admit it, I had
but a very slight esteem for women."
"Why so, monsieur? have they injured you?"
"Not exactly; but they are responsible for my having injured others, and
that amounts to the same thing."
"Why no, monsieur, if they didn't advise you to do it."
"They do not need to advise us to make fools of ourselves; they lead us
into it easily enough without that."
"I don't understand, monsieur."
"So much the better for you, my child.—But what are you doing there?
God forgive me, I believe that you are patching my rags!"
"Well! I had nothing to do, and I like to be busy; I thought that it
wouldn't offend you if I should take a few stitches in your linen."
"Offend me! ah! my dear girl, you are too kind to me; one does not take
offence with those who are so kind to them. Ah me! when I think——"
Here Roncherolle paused and heaved a profound sigh. Violette looked up
at him and said:
"What are you thinking about, monsieur, that makes you sigh so? You
mustn't think of melancholy things when you are sick."
"I am thinking, my dear child, that I might have with me—my own
daughter,—who, however, I am sure, would take no better care of me than
you do."
"Your daughter! what, monsieur, you have a daughter, and she is not
with you when you are ill and suffering!"
"If she is not with me, it is not her fault,—it is mine."
"Ah! then it is you who have sent her away, and she is not in Paris, of
course?"
"No, she is not in Paris."
"Why don't you write for her to come, to join you?"
"I don't want to disturb her."
"How old is your daughter?"
"Nineteen."
"Why, that is just my age!"
"Ah! you are nineteen? And what about your parents? I never see them
with you. But I remember now, that you told me that you had lost them."
"I never knew my parents, monsieur; I am an abandoned child!"
"Abandoned! is it possible? what a strange coincidence!—Were you
abandoned in Paris?"
Violette, remembering the count's injunction, replied hesitatingly:
"Why—I don't know, monsieur; I—I think so."
"Poor child, what a pity! her parents do not realize what a treasure they
cast away."
Roncherolle buried his face in his pillow, murmuring:
"But my child—I do not know her; perhaps she too is lovely and good!
ah! if I could only find her! But no! why should I wish to? to force her to
share my destitution?—No, it is better as it is."
The invalid dropped asleep. Violette was anxiously awaiting that
moment, for she had heard noises in the outer room for several moments,
and she guessed who it might be. As soon as she was certain that
Roncherolle was asleep, she arose and softly opened the door of the other
room, where she found Monsieur de Brévanne and Georget.
"My neighbor is asleep; you may come in, monsieur," said Violette to the
count.
"You are quite sure that he is asleep, my child?"
"Yes, monsieur. You can tell by listening to him, his breathing is so
difficult. Poor man! it seems that he has suffered terribly all day, and he is
taking advantage of a little respite from pain, to rest."
"But you were talking just now."
"Yes, monsieur.—Oh! if you knew—he has a daughter, the poor man,
and he said that he bitterly regretted not having her with him."
"Oho! he spoke to you of his daughter, did he?"
"Yes, monsieur; can you imagine that she does not come to take care of
him, her father, when he is sick?"
"Did he tell you why she was not with him?"
"No, monsieur; he simply said that it was his fault.—But come in,
monsieur; he is sound asleep."
"Yes, I will come in. Stay here, my child, and talk with Georget; but
don't talk too loud."
"No, there's no danger of that, monsieur," said Georget; "we understand
each other perfectly well simply by looking at each other."
The count entered the room occupied by Roncherolle. A single tallow
candle, which was badly in need of snuffing, lighted that room with a dim,
uncertain light; it enabled the visitor, however, to distinguish a cheap wall
paper, torn or lacking altogether in several places; a window with large
cracks, and without curtains, in which one pane was broken, its place being
ill supplied by paper; two or three pieces of cheap black walnut furniture; a
painted cot, on which was a coarse flock bed and a very thin mattress; on
the mantel, a small mirror in a wooden frame, and on the hearth two tiny
bits of wood, which were hardly burning.
Everything in that abode indicated poverty and privation; and the cold
that one felt there, the wind that one could hear whistling in all directions,
heightened the melancholy impression which one was certain to feel at
finding an invalid in such a place.
Monsieur de Brévanne noticed and scrutinized everything; then he
walked to the bed and gazed at Roncherolle, whose features were more than
ever changed by suffering and want, and who, even in his sleep, seemed to
be struggling with pain.
"The wretched man!" said the count to himself; "is this what the future
seemed to promise him? Endowed with every advantage, possessor of a
handsome fortune, this is what his passions have brought him to!—It is all
over; I can think no more of the vengeance which I was determined to
wreak upon him; heaven has undertaken that duty; and besides, I should not
have the courage to deprive Violette of her father; I do not know whether
men will blame me, but something tells me that the time has come to
forgive."
Roncherolle moved in his sleep, and the count instantly left the room and
joined the two young sweet-hearts, who had not found the time long.
"Well, monsieur, you have seen him," said Violette; "is he really the man
whom you used to know?"
"Yes, my child; but not a word about my visit!"
"Oh! have no fear, monsieur."
"Come, Georget, let us go."
Georget considered that he had had very little time to talk to Violette; but
he dared not make any remark, and took his leave with the count, after
exchanging a loving pressure of the hand with his sweetheart.
The next morning, about nine o'clock, Violette was in her neighbor's
room once more; he was feeling a little better, and was telling her about a
strange dream he had had, when Chicotin arrived, bringing with him a
letter, which he handed to Roncherolle.
"For you, bourgeois; it just came, so your concierge told me."
"Who can have written me? I don't know this writing," said Roncherolle,
as he broke the seal. But in an instant, he uttered a cry of surprise.
"My children, you could never guess what this letter contains; listen.
"'Monsieur:
"'One of your debtors, Monsieur de Juvigny, has instructed me to send
you a thousand francs on account of what he owes you.'
"Signed—the devil take me if I can read it—Dubois or Dubosc.—But
the thousand-franc note is inside all right; here it is!"
"Ah! what good luck, monsieur! how happy it makes me for you!" said
Violette.
"Name of an—excuse me, bourgeois, but I am so glad that I brought that
letter for you!"
"Thanks, my friends, thanks, I am trying to remember—Yes, Juvigny did
owe me money—I can't remember just how much; but when I inquired
about him a few months ago, I was told that he was travelling."
"He must have sent word to this person to send you this sum, monsieur."
"Faith! I hardly expected this restitution. The money arrives most
opportunely, but I can't get over my surprise!"
"You see, monsieur, that I told you that your dream meant good luck."
"You can buy all the syrup of Poupée that you want now, bourgeois."
"Yes, my boy, and my little neighbor will be kind enough to do that for
me, and change this note. Here, my dear, is the note, here's the thousand
francs which seems to have fallen from heaven!"
"Ah! I have a strong suspicion where it fell from, myself!" thought
Violette as she left the room.
XLII
THE PIE
Ten days after the receipt of the letter containing the thousand francs,
Roncherolle was walking on the boulevard, alert and active, feeling not a
trace of his gout, and wrapped in a warm, stylish overcoat, with a new hat
on his head, patent leather shoes on his feet, in a word, dressed with a care
and elegance which changed him completely and made him look almost
like a young man.
In front of the Gymnase Theatre, Roncherolle felt a hand on his arm, and
he turned and recognized his former neighbor, young Alfred de Saint-
Arthur.
"Ah! good-morning, my dear monsieur, delighted to meet you!"
"Good-morning, my dear Monsieur de Roncherolle. I can no longer say
my neighbor, for you are not my neighbor now. You went off like a bomb
without telling me, without leaving me your address; that was very unkind.
That idiot of a Beauvinet,—you know, the young man at the hotel,—
insisted upon it that you lived at Passage I-don't-know-where. Ah! that was
a good one! that was very good!"
"You didn't try to find me at that place?"
"Oh, no! I wasn't taken in by that blockhead of a Beauvinet. I said to
myself: 'My neighbor must have had reasons for moving and not leaving his
address; such things happen every day, and indeed I think that it may
happen to me very soon.'—But I regretted you all the same; on my word of
honor I regretted you."
"That is too kind of you."
"But there was someone who regretted you much more than I did. Can't
you guess?"
"Faith, no."
"It was Zizi—you know—Zizi Dutaillis."
"Oh, yes! I remember perfectly—a very agreeable little woman."
"Well, you made a conquest of her. Every day she said to me: 'Do find
Monsieur de Roncherolle; invite me to dine again with Monsieur de
Roncherolle; I want him to teach me other ways of—you know what.'—In
fact, I never see her that she doesn't talk about you, and if you were younger
and—and—and fresher, I should be jealous of you."
"Thanks, thanks, a thousand times!"
"By the way, allow me to congratulate you; you walk very well; have
you got rid of your gout?"
"For the time; it has held me pretty tight this fall."
"And you have a bearing, a style—that coat you have on is very well-
made, very well-cut, and of handsome cloth; is it wadded?"
"As you say."
"On my word of honor! I don't say it to flatter you, but in that overcoat
you look ten years younger!"
"In that case I am very sorry that I have only one."
"By the way, let me tell you that I have profited by your lessons—you
know, the way to drink champagne,—two glasses, one on top of the other,
in a plate."
"Yes; well?"
"I have succeeded, I can do it; to be sure, I broke a dozen glasses, but I
succeeded; your pupil does you credit."
"I never doubted your ability—to drink champagne."
"And that isn't all: you know my parrot, that I was teaching—the one
that led to our becoming acquainted?"
"Yes, I remember him; is he dead?"
"No indeed; he is as well as you or I. But the delightful part of it is that I
have succeeded again."
"Really, you have made great progress since we last met."
"My parrot says now what I wanted him to."
"That was 'Good-morning, Monsieur Brillant,' I believe?"
"No, deuce take it! he said that too much! He says—and only since
yesterday, so you see that it isn't an old story—he says: 'Dutaillis is lovely!
applaud, clap Zizi!'"
"Ah! if he says all that, it's very fine; your friend must be enchanted."
"I haven't given him to her yet, because it was only yesterday that he
said the whole sentence; and you understand that, before giving him to Zizi,
I wanted to be certain that he wouldn't make a mistake, that he wouldn't
make a slip of the tongue."
"That was decidedly prudent on your part."
"By the way, an idea, a splendid idea has just occurred to me!"
"The deuce! try to hold on to it."
"You must be kind enough to dine with Zizi and me. In the first place,
you owe us more lessons in champagne drinking."
"Really, you are very tempting, but——"
"Listen: during the dinner, I will have my parrot brought in, in—no
matter what, I will find something—and he will deliver his compliment to
my wife; you know we say 'my wife' now in speaking of a mistress, and she
says 'my husband.'"
"I didn't know that, and I confess that I should prefer anything else."
"And what do you say to my idea about the bird? Fancy Zizi's surprise
when she hears a compliment, and doesn't know where it comes from!"
"Why yes, that may well be amusing."
"Then it is agreed; we will dine together the day after to-morrow. Yes,
two days more, and then I shall be very sure that my parrot won't make a
mistake. Just we three will dine together, to laugh as loud as we please, and
talk nonsense; and at Bonvalet's as before. You agree, do you not, my dear
neighbor? I say 'my dear neighbor' from habit."
"Excuse me, my dear Saint-Arthur, your invitation is certainly very kind,
but——"
"Oh! no buts! Zizi will be so pleased to dine with you again! you can't
refuse."
"I accept, but on one condition."
"Well, what is it? Speak; I agree to it in advance."
"Well, it is that your friend, Monsieur Jéricourt, shall also be of the party
as before."
"The deuce! you surprise me! you want Jéricourt to be one of us? Why, I
thought that you didn't like him."
"I say again, if you wish to have me, have that gentleman too; I have a
special reason for wishing to meet him."
"That makes a difference; in that case, I will invite him; he shall be one
of us. I have not seen so much of him lately. He lives in the Chaussée
d'Antin. He puts on a lot of airs because he has had a play accepted at the
Odéon.—But no matter, he will come."
"Don't mention me to him; I fancy that that would make him disinclined
to come."
"I will mention nothing but the bird to him."
"What I ask you will not annoy mademoiselle, I hope?"
"Annoy her? why, pray? She will worry Jéricourt, and we will laugh at
him.—I may rely upon you now, may I not?"
"Absolutely."
"Until the day after to-morrow then, at half-past five, at Bonvalet's."
"I shall not fail you."
Saint-Arthur shook Roncherolle's hand and left him; Roncherolle
continued his walk, but more slowly, like a person too much engrossed to
notice what is going on about him.
On the second day thereafter, about five o'clock in the afternoon,
Roncherolle, who had taken much pains with his toilet, walked toward the
booth of the pretty flower girl of the Château d'Eau.
Violette greeted her neighbor with a pleasant smile, saying:
"Ah! what a pleasure it is to see you like this, monsieur! how well you
look! no one would ever suspect that you had been so sick."
"If I have recovered my health, it is due to you, my dear child, due to
your nursing, to your pleasant company."
"Oh! monsieur, you forget that syrup which did you so much good,
which cured you."
"Perhaps the syrup may have had something to do with it, but you had
much more."
"Are you going to walk, monsieur? It is cold, but fine."
"I am going to dine out, my little neighbor; a feast at Monsieur
Bonvalet's, nothing less."
"Oh! do be prudent then, monsieur; they say, you know, that with gout
you mustn't drink champagne."
"But I no longer have the gout."
"True, but suppose that should bring it back again?"
"We mustn't anticipate misfortunes so far ahead. However, I will be
prudent, and in order that I may not forget your advice, I will ask you for a
small bunch of violets."
"With pleasure, monsieur.—See, is this one big enough?"
"Quite big enough; be kind enough to fasten it tight into my buttonhole."
"Gladly; there, now it is done, and I promise you that it won't come out.
—That is very nice! you look as if you were my true knight now."
"And so I am, my child," replied Roncherolle, emphasizing his words,
"and I hope to perform the duties of the post."
"Why, how solemnly you say that!"
"Au revoir, my dear neighbor, au revoir!"
The young flower girl looked after Roncherolle, overcome by an
emotion which she could not understand, and still murmuring:
"How he said that! I will bet that he has some purpose in wearing that
bouquet in his buttonhole."
Meanwhile, Roncherolle, who did not propose to keep the others
waiting, soon arrived at Bonvalet's, where he found the young actress and
Saint-Arthur. Mademoiselle Zizi expressed all the pleasure that she felt at
renewing her acquaintance with the professor of champagne, and said to
him, scrutinizing him from head to foot:
"Why, how fine we are! how coquettish we are! we walk almost without
limping, and we have such a chicarde air!—you look after yourself, you do,
whereas Alfred takes no care of himself at all."
"What's that? I take no care of myself?"
"No, monsieur; your cravats have been wretchedly tied lately, and your
trousers don't fit as tight as they used to."
"They are not worn tight now."
"If I want you to wear tight ones, why it seems to me that you ought to
adopt my taste.—Ah! what a pretty bunch of violets you have there, old
fellow! where did you get that, you old Cupid? From some charmer, I will
wager!"
"It is true that I got them from a charming young girl."
"Aha! give us the story; tell us all about it."
"I will tell you about it, but not now; at dessert, with your permission; it
will have all the more charm."
"All right, at dessert it is. By the way, so you wanted to dine with
Jéricourt, did you? When Alfred told me that, I confess that I was mightily
surprised, you agreed so badly the other time. I said to myself: 'There's
something underneath this; Monsieur de Roncherolle has invented some
practical joke, some farce that he proposes to play on him;' am I right?"
"I don't say no; but don't ask any more questions; I am keeping that also
in reserve for the dessert."
"Well, well! it seems that we shall laugh at dessert."
"Yes, yes," said Saint-Arthur with a meaning glance at Roncherolle. "Oh
yes! our dinner will be most amusing, and we shall laugh, I trust, at dessert.
We shall have some surprises, some unexpected incidents."
"What on earth is that idiot talking about? He assumes a mysterious air.
Frefred, I have an idea that you have some gallant attention in store for me
—is it true, my adored one?"
"I can't tell you anything; you will see!"
This conversation was interrupted by Jéricourt's arrival. That gentleman
seemed surprised at sight of Roncherolle; however, he manifested no
annoyance, and saluted the party with a smile.
"Aha! Jéricourt doesn't keep us waiting to-day; that is magnificent!"
cried Zizi; "but something extraordinary must have happened to him."
"Nothing has happened to me but the desire to be in your company as
soon as possible, fair lady."
"Well! what did I say? that is extraordinary enough!"
While the literary man addressed a few words to the young actress,
Saint-Arthur approached Roncherolle and whispered in his ear:
"I have thought of a delightful way to have my bird come in and speak,
without being seen."
"Indeed! what is it?"
"A pie—you know, like those they have on the stage; it will be brought
in and put on the table, and the parrot will be inside."
"That may be amusing, in truth; but on the stage pasteboard pies may
create an illusion; here, on the contrary, seen at such close quarters, I am
afraid that it will miss its effect."
"Oh! I anticipated that, and so it will have a genuine pie crust. I gave my
orders to Beauvinet, and he is to take the bird to an excellent pastry cook,
who is to cover it with the crust; then Beauvinet will bring us the pie."
"That makes a difference; in that case, the illusion will be perfect."
"Isn't it an ingenious plan?"
"But aren't you afraid that your parrot will stifle in the pie?"
"Why so? They are shut up in cages."
"True, but I should say that they have more air there."
"Bah! just for a short time. Besides, I told Beauvinet to tell them to make
some little holes on top, so that he may have light, and that we may hear
him plainly."
"In that case, everything will be all right."
They took their places at the table. Jéricourt treated Roncherolle with the
utmost ceremony; but from time to time, he cast his eyes upon the bunch of
violets which the latter wore in his buttonhole, and then a mocking smile
played about his lips; but Roncherolle apparently did not notice it.
"The champagne lessons will come with the dessert," said Saint-Arthur,
"because they always disarrange the table a bit. We spill the champagne
over ourselves, so it is better to wait."
"It is all one to me," said Zizi; "I am quite willing to wait now, for I have
fallen violently in love with madeira."
"And monsieur is arranging some lessons even more unique than the
last, no doubt?" said Jéricourt, addressing Roncherolle.
"Yes, monsieur; in fact, I am preparing a lesson for you, which, I fancy,
you hardly expect."
Meanwhile, after the first course, Saint-Arthur betrayed the liveliest
impatience, and kept ringing for the waiter and asking him:
"Has no one come to see me? Isn't there any messenger outside for me?"
"No, monsieur, no one has come."
"The deuce! he is very late!"
"What! are you expecting other guests?" said Jéricourt.
"Yes,—that is to say, I am expecting something for the dinner."
"A surprise he has arranged for me," said Zizi; "I haven't any idea what it
is, but I like to think that it will be superb!"
At last the waiter announced:
"Monsieur, there's a man here with a pie."
"Ah! very good! bravo! show him in."
"What! is your surprise a pie?" cried the young woman; "why, that is
perfectly ridiculous. I don't like pie at dinner!"
"This one, my dear love, is not like most pies.—Come, Beauvinet, come
in!"
The old young man from the lodging house appeared, bringing a very
handsome pie, which he held as if it were the keys of a conquered town; he
placed it on the table, looked about at everybody with a self-satisfied
expression; then pulled his wig over his left ear.
Everybody looked at the pie, which had an inviting aspect. Saint-Arthur
seemed overjoyed; he jumped up and down on his chair, exclaiming:
"Ah! I should say that that is the thing!"
"It is a very handsome pie," said Jéricourt. "Where did it come from?
Strasbourg?"
"Oh, no! not from so far away."
"Come, Frefred," said Zizi, "if the pie is so delicious, cut into it and let
us taste it."
"One moment, my dear love, one moment; it isn't to be cut into like that;
I request silence for a moment, and attention."
And the young host, putting his face down to the pie, said in an
undertone:
"Dutaillis is lovely.—Come, Coco, come, come!"
"What's this? Alfred is talking to the pie now!" cried Zizi, opening her
eyes to their fullest extent.
"Hush, my dear love! hush I say!—Come, Coco—Dutaillis is—go on."
But in vain did they listen and wait; the pie maintained the most
profound silence.
"Are you playing proverbs with the pie, my Bibi?"
"Yes, I am playing—that is to say, the pie is going to speak."
"The pie going to speak! ah! I would like right well to hear it, on my
word!"
"Just a little patience. I can't understand what the matter is with him; he
must have gone to sleep in there.—Coco, Coco—Dutaillis is lovely.—Ah!
you won't speak, won't you? I will wake you up."
And Saint-Arthur, taking the huge pie in both hands, began to shake it
with all his strength; then he replaced it on the table, saying:
"Will you speak now, you beast?"
While they waited again in silence, Monsieur Beauvinet ventured to
blow his nose, which drew down upon his head a stern reprimand from his
tenant.
"But whom are you calling a beast, and what is it that's in the pie?"
asked Mademoiselle Zizi, beginning to get tired of keeping still for nothing.
"Well, my dear love, it is a parrot, a magnificent parrot, which I have
taught to say: 'Dutaillis is lovely! applaud, clap Zizi!'"
"Ah! the poor creature! is it possible? Why, he must be stifled in there;
that's why he doesn't speak.—Monsieur de Roncherolle, take the crust off at
once."
"Are all the windows closed?" asked Saint-Arthur; "we must look out
that he doesn't fly away.—See to it, Beauvinet."
Beauvinet made a strange grimace, but did not stir.
"I have a shrewd idea that he won't fly away;" said Roncherolle, as he
ran his knife around the crust of the pie.
"Look out, be careful, don't stick the knife in, or you will cut the bird."
"There's no danger."
At last the upper crust was taken off, and nothing came out of the pie.
They all put their heads forward to look inside; but instead of a living bird,
they saw only what is always found in a chicken pie: jelly, and the stuffing
around the principal piece, on top of which there was a slice of pork.
Saint-Arthur was stupefied; his guests with difficulty restrained their
desire to laugh.
"What does this mean, Beauvinet? where is my bird, my parrot? what
have you done with him?"
"Your bird is there, monsieur; I did what you told me to: I carried him to
the pastry cook, and told him to put him into the pie."
"Ah! you villain! you miserable wretch! how could you fail to
understand me? I told you that I only wanted the crust put around him."
"Well, there is nothing but crust around him."
"And I added: 'You must have holes made in the top to give him air, so
that we may hear him plainly.'"
"I understood: 'So that we may smell him plainly;'[B] and the pastry cook
said: 'I never make holes in my pies; your parrot will be a little tough, but
I'll just lard him and stuff him, so that no one will ever know what it is.'"
[B]
I said: 'pour qu'on l'entende bien.'
I understood: 'pour qu'on le sente bien.'
At that point, roars of laughter from Zizi, Roncherolle and Jéricourt
made it impossible to hear the groans and lamentations of Alfred, who, in a
fit of desperation, attempted to throw the pie at Beauvinet's head; but he
was prevented, and Roncherolle said to him:
"As the harm is done, we must make the best of it; as I presume that no
one here has ever eaten parrot pie, I suggest that we taste it."
"Yes, let us taste it," said Zizi. "I will tell this story at the theatre, and my
comrades will have a good laugh at it."
"It doesn't make me laugh! the result of such long-continued toil; and
just at the moment when I had finished his education, and when he began to
talk so famously!"
"Will you have a little piece, Saint-Arthur?"
"I? never! but yes—just a taste.—That rascally pastry cook! he was quite
right to say that no one would know what it was; but he will have to give
me back the feathers, at least."
"Pouah! how nasty it is," said Zizi, pushing her plate away. "So tough
that you can't chew it."
"And a certain flavor which is not exactly agreeable," said Jéricourt.
"The pastry cook did not disguise it quite enough."
"Here, take all this away," said Roncherolle, handing the plate with the
pie to Beauvinet; "and for your punishment, eat it!"
"Yes, clear out with it, you stupid beast!" cried Saint-Arthur. "Off with
you, and if I wasn't holding myself back—What an ass he is! I am sure that
if one should tell him to take a dog to the pastry-cook he would have it
made into a pie."
Beauvinet took the pie under his arm, and angrily pulled his wig over his
right ear, grumbling: "They don't know what they want; I do what they tell
me to, and they ain't satisfied! Let them make their pies themselves after
this."
XLIII
A DUEL
The adventure of the pie amused the guests mightily; Saint-Arthur alone
did not share his friends' gayety; at every mouthful that he swallowed, he
muttered:
"My poor parrot! my poor Coco! how prettily he said: 'Dutaillis is
lovely!'—What a misfortune!—'Applaud, clap Zizi!'—I shall never be
consoled."
"You are going to begin by being consoled right away," said the young
actress; "and don't bore us any longer with your complaints. Don't you see
that the story of your pie is a hundred times better and funnier than your
bird would have been? But here comes the dessert. I want some champagne
now, and I want my good friend Roncherolle to keep his promise to us."
"Monsieur is going to begin his exercises!" said Jéricourt ironically. "Let
us see if it is the same thing as at Nicolet's: worse and worse and more of
it."
"We will do our utmost to satisfy monsieur," replied Roncherolle,
emptying a glass of champagne.
"But first of all," said Zizi, "as I am rather inquisitive, I want to hear the
story of that little bunch of violets that you promised me."
"Ah! so he has stories too!" muttered the literary man; "sapristi! we are
going to have a deal of entertainment!"
"Perhaps you will have much more than you expect, monsieur," replied
Roncherolle, with a meaning glance at Jéricourt. "But I begin—this little
bunch of violets I got from a flower girl,—nothing more commonplace than
that, eh? But what is less commonplace is that this young flower girl, who
is remarkably pretty, is as virtuous and respectable as she is pretty. Now,
this is what happened to her last summer: a young man of the world, a
dandy, who, I believe, claims to be a literary man, saw the charming flower
girl and found her to his liking; he made such speeches to her as all young
men make to pretty girls—thus far there was nothing that was not perfectly
natural."
"I say!" cried Saint-Arthur; "why, that's like Jéricourt and——"
"Pray let monsieur finish!" said Jéricourt, who had become very
attentive within a few seconds.
"But, as I was saying, the pretty flower girl, who is virtuous and who,
moreover, is in love with a handsome young fellow, did not listen to our
dandy's suggestions, but received them very coldly. What does he do to
triumph over the girl? He sends a man to order and pay for a very handsome
bouquet, with a request to the flower girl to carry it herself to a lady whose
address he gives her, informing her that that lady will have other orders for
her. The girl falls into the snare—for you will guess that she was sent to the
gallant himself, who had told his concierge to allow the flower girl to go up
to his room."
"Why, this is strange, it resembles——"
"Hold your tongue, Frefred! this story interests me immensely."
Jéricourt did not utter a word, but he had become very pale. Roncherolle
continued his narrative, with his eyes still fastened upon him.
"Behold then our flower girl in the young man's room, which she had
entered without suspicion, for a woman had opened the door. But soon he
who has been persecuting her with his addresses appears; he is alone with
her, he no longer conceals his purpose to triumph over her resistance; the
girl sees her danger, summons all her courage, and resists so effectively that
the enterprising gentleman receives upon his face the marks of that stout
defence—indeed, they have not altogether disappeared yet; he is obliged to
let a woman who defends herself so well go her way. You will assume that
that was the end of it all; and indeed, it should have been; but no, because
that girl was virtuous, because she did not choose to cease to be virtuous,
because she had given her heart to another, the gentleman in question
deemed it becoming to proclaim everywhere that the pretty flower girl had
been his mistress, that she had come to his room of her own free will,—in
short, that she was an abandoned girl; he dishonored her in the eyes of all
those who loved her. I say that that is dastardly, infamous! and do not you
think that so much lying and slander deserve to be punished?"
Zizi said nothing because she had guessed the truth; Jéricourt bit his lips
and also held his peace; but Frefred exclaimed:
"This is strange—your story—one would say—where does your pretty
flower girl stand?"
"Near here, on Boulevard du Château d'Eau; you know her perfectly
well."
"What! is it Violette?"
"It is Violette."
"Why, in that case, the young man who pretends to have had her favors
—is——"
"Just so; it is monsieur."
Thereupon Jéricourt felt called upon to draw himself up and assume an
impertinent tone.
"Monsieur," said he to Roncherolle, "I do not understand all the absurd
stories and fairy-tales which you have been telling us, and which have
neither head nor tail; but what seems even more inconceivable is that a man
of your age should pose as the knight of flower girls!"
"A man of my age, monsieur, knows the world well enough to
distinguish the false from the true; and when one can avenge a woman who
has been shamelessly defamed by a conceited coxcomb, age makes no
difference, monsieur, as I hope to prove to your satisfaction."
"Really, I am very condescending to answer you!" retorted Jéricourt,
throwing himself back and swinging his legs. "Be off with you, monsieur;
leave me in peace."
"I will be off, monsieur, but with you, I hope."
"Oh! that would be amusing! Faith, my dear monsieur, lose your temper
if you choose, but I will not fight for a flower girl."
"Well! will you fight for this, monsieur?"
As he spoke, Roncherolle, who had left his seat and walked toward
Jéricourt, struck him across the face with his glove.
The young man leaped from his chair, his face became livid, and he
seemed to contemplate rushing upon Roncherolle; but the latter maintained
such a calm and impassive attitude, while holding the prongs of a fork
toward his adversary to keep him at a respectful distance, that Jéricourt
contented himself with saying in a voice choked with wrath:
"That insult will cost you dear, monsieur!"
"I shall be enchanted to find out whether that is so, monsieur; and I
propose that we finish this matter not later than to-morrow morning."
"Yes, monsieur; to-morrow, at nine o'clock in the morning, I will be in
the woods, near Porte Saint-Mandé."
"I will be there at that time."
"Saint-Arthur, you witnessed the insult, you must be my second."
"I, your second; why, I don't know if——"
"Be kind enough to have two seconds," said Roncherolle, "for I shall
bring two."
"Until to-morrow, monsieur; Saint-Arthur, be at my rooms before eight
o'clock."
Jéricourt seized his hat and rushed from the room like a madman,
without saluting anybody.
The young actress did not think of laughing, she was deeply impressed
by all that had happened. As for Alfred, he turned white, red and yellow by
turns, and seemed to be inclined to weep.
"My dear friends," said Roncherolle, resuming his seat at the table, "I am
truly sorry to have disturbed the end of your dinner thus. But what would
you have? I have been waiting for a long time for an opportunity to settle
affairs with this fellow Jéricourt."
"Then you are certain that the pretty flower girl has been slandered?"
said Zizi.
"Perfectly sure. However, this duel will be the judgment of God. Let us
drink to the triumph of the truth."
"I am not thirsty any more," faltered Saint-Arthur. "Here I am forced to
be a second in a duel! I don't like that at all, for—are your seconds quick-
tempered?"
"Not the least in the world; I shall bring two mere boys; you have
nothing to fear; your part will be absolutely passive; you will be there only
to look on, for there is no possible adjustment of the affair with my
adversary."
"Ah! if it's only a matter of looking on, that's different; rely on me."
"Oh! how I wish it were to-morrow noon," said Zizi. "But now good-
night, let us separate; I am no longer in the mood for talking nonsense. I am
only a good-for-nothing, Monsieur de Roncherolle, but all the same I will
pray to God for you; and who knows? perhaps He will listen to me."
On leaving the restaurant, Roncherolle walked back and forth in front of
the theatres on Boulevard du Temple; he knew that Chicotin was
particularly devoted to that place, where he often succeeded in obtaining an
admission ticket, which he did not sell, but with which he went into the
theatre. And in fact Roncherolle had not been walking there ten minutes
when he spied the person for whom he was looking.
"Hello! is that you, bourgeois?" cried the young messenger. "Have you
been to the play? If you are not going back, make me a present of your
check."
"No, my boy, I haven't been to the play; but listen carefully to what I am
going to say to you, for it is very serious, very important; I need you to-
morrow, you must be at my room at eight o'clock at the latest."
"That is easy enough, I will be there. Is that all?"
"No, I also want your friend Georget, Violette's young sweetheart, to
come with you; I need him too."
"Is that so? What for, bourgeois?"
"I will tell you both to-morrow, not before; meanwhile, let your friend
understand that his future happiness and Violette's are concerned."
"Oh! in that case, never fear; he won't fail to come!"
"But don't mention this to anybody, not even to Violette; it is a secret."
"We won't say a word."
"Are you sure of seeing Georget this evening?"
"Pardi! when he doesn't go to walk with Violette, he is at home; at any
rate, he must go home, and I will wait for him."
"Very well, is he still with Monsieur Malberg?"
"Yes, but he sleeps in his own lodgings."
"Don't let him say a word of this to—to Monsieur Malberg."
"Never you fear; indeed, he probably won't see him until after he sees
you."
"Until to-morrow then, and both of you."
"We will be there, monsieur."
"By the way, bring a cab with you; don't forget."
"A cab, all right, monsieur."
The next morning at half-past seven, Roncherolle was up and dressed
and was cleaning a pair of pistols, which, despite his destitution, he had
always kept. At a few minutes before eight, the door was opened softly and
Chicotin appeared, accompanied by Georget. The latter, instead of a blouse,
wore a short coat buttoned to his chin, and on his head a blue cloth cap of
stylish shape; he held himself very erect, and his new costume heightened
the attractiveness of his face and the grace of his figure.
Roncherolle could not help admiring the fine appearance of the young
man, and he offered him his hand, which Georget took with an air of
respect.
"Here we are, bourgeois," said Chicotin; "I hope we haven't kept you
waiting; I bring Georget, as you see, and the cab is downstairs."
"That is very good, my boy. Monsieur Georget, I thank you for coming
here at my invitation; when you know what is on foot, I am sure that you
will not be sorry."
"I am very happy, monsieur, if I can be of use to you in any way; I know
you already through Violette, whom you were kind enough to visit when
she was sick; and Chicotin told me——"
"I told him that this morning's business had something to do with her;
but monsieur will explain the whole thing to us, and tell us why——"
"You are in a great hurry; the most important thing now is to start; and
especially to avoid meeting my little neighbor on the stairs, for she would
ask questions which we could not very well answer at this moment."
"Oh! it's only eight o'clock; it's cold too, and Violette doesn't go out so
early in such weather."
"Very well, let us start, young men."
Roncherolle took his box of pistols, which seemed to puzzle Chicotin
greatly. Georget went out first, walked to the stairs cautiously, then
motioned to them that they might go down. All three were soon at the door,
which was kept by Mirontaine only; he barked when anybody came in, but
never when they went out.
Monsieur de Roncherolle entered the cab, told Georget and Chicotin to
enter with him, although the latter declared that he would be quite as
comfortable behind, and bade the coachman take them to the Porte Saint-
Mandé, by the Vincennes road.
"Oho! we are going to the country," cried Chicotin; "we shan't find much
shade there!"
"I can tell you now, messieurs, why I have brought you with me," said
Roncherolle. "It is for the purpose of being my seconds; for I have a duel on
hand, I am going to fight a duel with pistols this morning."
"You are going to fight?" cried Georget, deeply moved.
"Yes, my friend; if I had told you that beforehand, would you have
refused to come with me?"
"Oh, no! on the contrary, I would have begged you to take me."
"I was sure of it beforehand, young man."
"And I too, bourgeois; I like fights! they just suit me! But what are we
two going to fight with? We haven't any weapons; are we to fight with fists?
I like that too."
"No, not with fists or anything else; you are my seconds, and you will
not be called upon to fight at all."
"So much the worse! of what use shall we be then?"
"To affirm the innocence of a young girl whom I hope to avenge. I am
going to fight with Monsieur Jéricourt."
"With Monsieur Jéricourt?" cried Georget; "with that man who laid the
trap for Violette and then slandered her so abominably?"
"Just so; do you consider that I am doing wrong?"
"Oh, monsieur! what good fortune! that Jéricourt! I have been looking
for him everywhere, and haven't found him. But you are not the one who's
going to fight with him, monsieur; I am; for I am the man whom he insulted
most cruelly; I am the man whom he injured most; I am to be the husband
of the woman whom he tried to dishonor. You must see, monsieur, that I am
the one who must fight with him."
"My dear Georget, I was very sure that you would say all that; I expected
it; but be calm and listen to me. I was in this gentleman's company
yesterday; I have long been looking for an opportunity. I told him what I
thought of his conduct toward Violette. I demanded satisfaction for his
slanders, but he refused; then I struck him in the face. The duel was
instantly arranged for this morning. Now, this gentleman has the right to
demand satisfaction for the outrage inflicted upon his face; if I did not fight,
if I allowed you to fight in my place, I should act like a coward; and as I
have never had that reputation, you will permit me not to earn it now. All
that I can do, my dear Monsieur Georget, is, if I fall, to allow you to take
my place and to renew the combat with this gentleman. Now it is all
understood and arranged. Not a word more on that subject, for it would be
useless.—But we have arrived."
The carriage stopped on the outskirts of the wood; Roncherolle alighted
with the two young men, Chicotin carrying the box of pistols. They looked
about in all directions but saw nobody.
"Is it possible that he will not come?" murmured Georget, stamping the
ground impatiently.
"Is he going to squeal?" said Chicotin.
"There is no time wasted yet, messieurs, and his seconds may have kept
him waiting.—But look, I see a carriage in the distance.—I'll wager that
they're the people we expect."
The carriage reached the wood and they saw Jéricourt, Saint-Arthur and
little Astianax at once alight from it.
"Saperlotte! the seconds are not big fellows," cried Chicotin; "I know
'em; both of 'em together wouldn't make one decent man. I could eat half a
dozen of them without difficulty!"
Roncherolle imposed silence upon Chicotin with a glance. Jéricourt
came forward with his two friends; Saint-Arthur acted as if he had a pain in
his stomach, and little Astianax looked in both directions at once.
"What does this mean?" cried Jéricourt, as he scrutinized Chicotin, while
Georget glared at him with flaming eyes; "what! Monsieur de Roncherolle
chooses a messenger for his second? Really, I should have supposed that he
could find some one better than that.—You see, messieurs, the honor that he
does you, and with whom you are brought into relations!"
"What's that? what's that?" cried Chicotin, turning up his sleeves; "do I
hear anybody sneering at me? Ah! as I live! I'll smash the principal and his
seconds in a second."
"Be quiet," said Roncherolle sternly. Then, walking toward his
adversary's two seconds, he said to them:
"I have brought this young man, messieurs, Monsieur Georget, because
he is the fiancé, the future husband of the young girl whom monsieur
attempted to ruin. No one has a better right to be here than he, for the honor
of the woman whom he is to marry is the motive of this duel. As for my
other second, this honest fellow here, he is only a messenger, it is true, but
it was he who saved the young flower girl when, driven to desperation by
contemptuous treatment and humiliation, and by the thought of passing for
what she was not, she was on the point of jumping into the canal and
seeking an end to her suffering there. Do you not think, messieurs, that this
honest fellow who brought back hope to Violette's heart, also has a right to
be present at a battle which is to rehabilitate her honor? Come, messieurs,
which of you will undertake to maintain the contrary, and will blush to have
to deal with such seconds? Neither of you, I am sure!"
Saint-Arthur and Astianax contented themselves with bowing low to
Roncherolle, who continued:
"Very good, everything is arranged; now, my adversary has the choice of
weapons."
"He chooses pistols," said Astianax.
"Pistols it is; I have brought some."
"So have we."
"We will take yours, if you choose; it makes no difference to me. My
adversary has the right to fire first also, I recognize that; you see that we
shall have no difficulty. Let us go a little way into the woods, and have done
with it."
The whole party walked into the woods and stopped in a solitary place,
where there was a clearing suitable for the duel. Astianax, having spoken to
Jéricourt, returned to Roncherolle and said:
"Is fifteen paces satisfactory to you, monsieur?"
"Ordinarily, the seconds would decide such matters among themselves;
but no matter, that is satisfactory to me; mark off the distance and I will
take my place."
Astianax counted the paces, while Saint-Arthur leaned against a tree at a
distance; as for Georget and Chicotin, Roncherolle was obliged to hold
them back by his glance.
Young Astianax, having finished measuring the distance, handed to each
combatant a pistol, which he took from the box he had brought; then he
stood aside, saying:
"They are loaded; I believe there is nothing more for me to do now."
"It is for you to begin, monsieur," said Roncherolle, bowing to Jéricourt.
Jéricourt took a long aim, then fired; the ball from his pistol grazed his
adversary's right side and made him turn slightly; Georget started to run to
him, but Roncherolle motioned to him not to stir and speedily resumed his
position, saying:
"That was not bad, but it was not quite the thing."
He fired almost instantly, and Jéricourt, wounded in the breast, fell to the
ground.
The four seconds rushed at once to the assistance of the wounded man,
who was already discharging blood through his mouth; and when he saw
Georget, he said to him in a faint voice:
"I lied—she is innocent—tell her that I confess, that——"
The unhappy wretch closed his eyes and could say no more; Chicotin
took him in his arms and carried him to the carriage which had brought him,
which Astianax also entered. As for Saint-Arthur, he had disappeared and
they were unable to find him.
Georget ran back to Roncherolle, crying:
"He confessed, monsieur; he confessed; he admitted that he had
slandered Violette! all those gentlemen heard him as well as I!"
"That is well, my young friend; that is what I wanted. Now you must
give me your arm to help me to walk back to the carriage."
"Oh! are you wounded too, monsieur?"
"A scratch, a mere scratch, but it troubles me when walking. I will lean
on you."
"Oh! as hard as you please, monsieur. What a debt of gratitude I owe
you! And Violette, when she knows it——"
"I knew perfectly well that she deserved to be defended; but I am very
glad to have spared you that trouble; and then, you see, I have done a lot of
foolish things in my life, and I am not sorry to do some good now and
then."
Chicotin reached the carriage just as Monsieur de Roncherolle and
Georget entered it. The young messenger's face was all awry, and he
faltered:
"All the same, it gives a man a shock—a young man, who was so well a
minute ago——"
"Well? Monsieur Jéricourt, how is he?" asked Roncherolle.
"He is stone dead!"
XLIV
THE EMBROIDERED HANDKERCHIEF
While the duel which concerned the pretty flower girl was in progress,
the girl herself was greatly surprised to see Pongo appear at her door about
nine o'clock.
"Master," he said, "he want mamzelle to come and see him after her
dress herself all fine; yes, dress herself all fine, and bring a big bouquet."
Violette hastened to answer that she would obey Monsieur Malberg's
orders; but as she donned her best dress and her prettiest cap, she said to
herself:
"Probably Monsieur Malberg wants to send me somewhere, for he would
not tell me to dress in my best just to go to his house. Besides, the bouquet
that he wants—no doubt I shall have to go to Madame de Grangeville's.—
So much the better! I like that lady very much, and it's a long time since I
carried her a bouquet."
When he saw Violette enter his room, so fresh and pretty and graceful,
and wearing a dress, which, although appropriate to her rank in life, gave an
added charm to her person, none the less, the count could not help sighing,
as he said to himself:
"I should have been very happy if I could have called her my daughter."
"Here I am, monsieur, I have obeyed your orders," said Violette; "I have
done what your servant told me to do; do I look well, monsieur?"
"Yes, my child, yes, very well; and I have no doubt that Madame de
Grangeville will find you charming thus."
"Am I going to that lady's house? I suspected it, monsieur."
"So much the better!—Listen to me, Violette; I must tell you now that
this lady to whom I am sending you knew your mother and the secret of
your birth; if your mother is still alive, if she is disposed to recognize you as
her daughter, this lady will tell you so."
"Is it possible, monsieur?"
"Yes, and for that purpose, you are going to-day to tell her all that you
know about your birth, giving her to understand that you have known it
only a short time; and then you will finish your story by showing her this
handkerchief, which I give back to you to-day, so that it may help you to
find your parents."
"Ah! I am all of a tremble, monsieur; the thought that perhaps I am
going to find my mother—why haven't you let me say all this to that lady
before?"
"Because, my child, before confiding such an important matter to her, I
wanted her to have time to appreciate you, so that you might not be a
stranger to her."
"And suppose this lady, after listening to me, after seeing this
handkerchief, should not mention my mother to me?"
"In that case, my poor girl, it would mean that you no longer have a
mother, that all hope of finding her is vanished. But such a supposition does
not seem possible to me; no, she cannot spurn you again; and those who
brought you into this world will be only too happy to lavish their caresses
upon you."
"Shall I tell this lady it's you who send me this time?"
"Not by any means; let her still think that it is Monsieur de Merval.—
Go, Violette; and if it is possible, come back here and tell me the result of
your visit to—to Madame de Grangeville."
"If it is possible! who could prevent me from coming back to you,
monsieur?—I will go at once, and you will see me again soon."
The young girl took her bouquet and started for the abode of the lady
who, as she had been told, might restore her mother to her; a thousand
confused thoughts, a thousand hopes surged through Violette's mind, and
she reached the house intensely excited and trembling from head to foot,
and asked Mademoiselle Lizida if she could see her mistress.
"I think so," said the lady's maid; "madame was at a ball last night, but
she did not return very late; it is twelve o'clock, and she has just risen; I will
announce you and your bouquet."
After a few moments, Violette was ushered into the presence of Madame
de Grangeville, who was seated before her mirror, completing her morning
toilet, and who smiled at the young girl, saying to her:
"Ah! here is my pretty little flower girl. It is a long while since you came
last, little one; I am neglected nowadays; Monsieur de Merval is less
attentive to me."
"I don't know, madame——"
"Let me see your bouquet; it is very pretty, but I saw finer ones at the
ball last night. Sit down, my girl, and let us talk a bit. Why! how you are
dressed up to-day! where are you going this morning, pray?"
"I am going nowhere but here, madame."
"Oho! then it was for me that you made this toilet. You look very well;
and I—this cap—do you think that it is becoming to me? I look a little tired,
do I not? They absolutely insisted upon making me dance last night.—But
what ails you, my child? One would say that you were not listening to me;
you seem distraught."
"Ah! madame, it is because——"
"Because what? finish your sentence."
"Since I had the honor to see you last, I have learned something about
——"
"About what?"
"About my birth, about my family."
"Your family; you told me that you were an abandoned child."
"True, madame; but someone who knew my nurse has told me several
things which may help me, they say, to find my parents."
"Really—I think I will put on a blue ribbon instead of a pink one, it will
look better.—Were you not left at the Foundling Hospital in Paris?"
"No, madame, I was born in Paris, but I was given in charge of a nurse,
who came from Picardie, and who went back to her province at once."
Madame de Grangeville ceased to toy with her cap and said to
Mademoiselle Lizida, who was putting the room in order:
"Leave us, go.—You were saying that your nurse lived in Picardie?"
"Yes, madame."
"What was her name?"
"Marguerite Thomasseau."
"Marguerite—are you sure that her name was Marguerite?"
"Yes, madame."
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
More than just a book-buying platform, we strive to be a bridge
connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.
Join us on a journey of knowledge exploration, passion nurturing, and
personal growth every day!
ebookbell.com

More Related Content

PDF
Programming Embedded Systems With C And Gnu Development Tools 2nd Edition 2nd...
PDF
Programming iOS 4 Fundamentals of iPhone iPad and iPod Touch Development 1st ...
PDF
Programming iOS 4 Fundamentals of iPhone iPad and iPod Touch Development 1st ...
PDF
LearningPython.pdf
PDF
Linux System Programming 1st Edition Robert Love
PDF
Ios 12 Programming Fundamentals With Swift Swift Xcode And Cocoa Basics 5th E...
PDF
Php In A Nutshell A Desktop Quick Reference 1st Edition Paul Hudson
PDF
Ruby Best Practices Increase Your Productivity Write Better Code 1st Edition ...
Programming Embedded Systems With C And Gnu Development Tools 2nd Edition 2nd...
Programming iOS 4 Fundamentals of iPhone iPad and iPod Touch Development 1st ...
Programming iOS 4 Fundamentals of iPhone iPad and iPod Touch Development 1st ...
LearningPython.pdf
Linux System Programming 1st Edition Robert Love
Ios 12 Programming Fundamentals With Swift Swift Xcode And Cocoa Basics 5th E...
Php In A Nutshell A Desktop Quick Reference 1st Edition Paul Hudson
Ruby Best Practices Increase Your Productivity Write Better Code 1st Edition ...

Similar to Programming Interactivity 2nd Edition 2nd Edition Joshua Noble (20)

PDF
Node Up and Running Scalable Server Side Code with JavaScript 1st Edition Tom...
PDF
Download full ebook of Learning Node Shelley Powers instant download pdf
PDF
Programming Ios 4 Fundamentals Of Iphone Ipad And Ipod Touch Development 1st ...
PDF
High Performance Python Practical Performant Programming for Humans 2nd Editi...
PDF
Learning the iOS 4 SDK for JavaScript Programmers Create Native Apps with Obj...
PDF
Ios 9 Programming Fundamentals With Swift Swift Xcode And Cocoa Basics 2nd Ed...
PDF
Learning the iPhone SDK for JavaScript Programmers Create Native Apps with Ob...
PDF
iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Ed...
PDF
Introducing Erlang Getting Started In Functional Programming 2nd Edition St L...
PDF
Blake Nakamura Masumi Programming Android 2nd Edition Mednieks Zigurd
PDF
Learning Android 1st Edition Marko Gargenta
PDF
Programming Ios 5 2nd Edition 2nd Early Release Draft Matt Neuburg
PDF
Architecture Patterns with Python 1st Edition Harry Percival
PDF
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
PDF
Programming iOS 5 2nd Edition Matt Neuburg
PDF
Nodejs For Php Developers Porting Php To Nodejs 1st Edition Daniel Howard
PDF
Learning Java 4th Edition Patrick Niemeyer Daniel Leuck
PDF
Cybersecurity Ops With Bash Attack Defend And Analyze From The Command Line 1...
PDF
Programming iOS 5 2nd Edition Matt Neuburg
PDF
Practical Mlops Operationalizing Machine Learning Models 1st Edition Noah Gift
Node Up and Running Scalable Server Side Code with JavaScript 1st Edition Tom...
Download full ebook of Learning Node Shelley Powers instant download pdf
Programming Ios 4 Fundamentals Of Iphone Ipad And Ipod Touch Development 1st ...
High Performance Python Practical Performant Programming for Humans 2nd Editi...
Learning the iOS 4 SDK for JavaScript Programmers Create Native Apps with Obj...
Ios 9 Programming Fundamentals With Swift Swift Xcode And Cocoa Basics 2nd Ed...
Learning the iPhone SDK for JavaScript Programmers Create Native Apps with Ob...
iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Ed...
Introducing Erlang Getting Started In Functional Programming 2nd Edition St L...
Blake Nakamura Masumi Programming Android 2nd Edition Mednieks Zigurd
Learning Android 1st Edition Marko Gargenta
Programming Ios 5 2nd Edition 2nd Early Release Draft Matt Neuburg
Architecture Patterns with Python 1st Edition Harry Percival
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
Programming iOS 5 2nd Edition Matt Neuburg
Nodejs For Php Developers Porting Php To Nodejs 1st Edition Daniel Howard
Learning Java 4th Edition Patrick Niemeyer Daniel Leuck
Cybersecurity Ops With Bash Attack Defend And Analyze From The Command Line 1...
Programming iOS 5 2nd Edition Matt Neuburg
Practical Mlops Operationalizing Machine Learning Models 1st Edition Noah Gift
Ad

Recently uploaded (20)

PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
master seminar digital applications in india
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Insiders guide to clinical Medicine.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
01-Introduction-to-Information-Management.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
RMMM.pdf make it easy to upload and study
PDF
Classroom Observation Tools for Teachers
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Complications of Minimal Access Surgery at WLH
PPTX
PPH.pptx obstetrics and gynecology in nursing
Microbial disease of the cardiovascular and lymphatic systems
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
master seminar digital applications in india
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Insiders guide to clinical Medicine.pdf
TR - Agricultural Crops Production NC III.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
01-Introduction-to-Information-Management.pdf
Anesthesia in Laparoscopic Surgery in India
RMMM.pdf make it easy to upload and study
Classroom Observation Tools for Teachers
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Module 4: Burden of Disease Tutorial Slides S2 2025
human mycosis Human fungal infections are called human mycosis..pptx
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Complications of Minimal Access Surgery at WLH
PPH.pptx obstetrics and gynecology in nursing
Ad

Programming Interactivity 2nd Edition 2nd Edition Joshua Noble

  • 1. Programming Interactivity 2nd Edition 2nd Edition Joshua Noble download https://ebookbell.com/product/programming-interactivity-2nd- edition-2nd-edition-joshua-noble-2509586 Explore and download more ebooks at ebookbell.com
  • 2. Here are some recommended products that we believe you will be interested in. You can click the link to download. Programming Interactivity A Designers Guide To Processing Arduino And Openframeworks 1st Edition Noble https://ebookbell.com/product/programming-interactivity-a-designers- guide-to-processing-arduino-and-openframeworks-1st-edition- noble-55308452 Programming Languages And Systems 31st European Symposium On Programming Esop 2022 Held As Part Of The European Joint Conferences On Theory And Practice Of Software Etaps 2022 Munich Germany April 27 2022 Proceedings Ilya Sergey https://ebookbell.com/product/programming-languages-and-systems-31st- european-symposium-on-programming-esop-2022-held-as-part-of-the- european-joint-conferences-on-theory-and-practice-of-software- etaps-2022-munich-germany-april-27-2022-proceedings-ilya- sergey-44887738 Programming 101 Learn To Code Using The Processing Programming Language 2nd Edition 2nd Jeanine Meyer https://ebookbell.com/product/programming-101-learn-to-code-using-the- processing-programming-language-2nd-edition-2nd-jeanine-meyer-46238180 Programming 101 The How And Why Of Programming Revealed Using The Processing Programming Language Jeanine Meyer https://ebookbell.com/product/programming-101-the-how-and-why-of- programming-revealed-using-the-processing-programming-language- jeanine-meyer-46318424
  • 3. Programming And Gui Fundamentals Tcltk For Electronic Design Automation Suman Lata Tripathi https://ebookbell.com/product/programming-and-gui-fundamentals-tcltk- for-electronic-design-automation-suman-lata-tripathi-46318712 Programming With Openscad A Beginners Guide To Coding 3dprintable Objects 1st Edition Justin Gohde https://ebookbell.com/product/programming-with-openscad-a-beginners- guide-to-coding-3dprintable-objects-1st-edition-justin-gohde-46410140 Programming In Two Semesters Using Python And Java Quentin Charatan https://ebookbell.com/product/programming-in-two-semesters-using- python-and-java-quentin-charatan-46494972 Programming The Future Politics Resistance And Utopia In Contemporary Speculative Tv Sherryl Vint Jonathan Alexander https://ebookbell.com/product/programming-the-future-politics- resistance-and-utopia-in-contemporary-speculative-tv-sherryl-vint- jonathan-alexander-46771488 Programming For Health And Wellbeing In Architecture Keely Menezes Pamela De Oliveirasmith A Vernon Woodworth https://ebookbell.com/product/programming-for-health-and-wellbeing-in- architecture-keely-menezes-pamela-de-oliveirasmith-a-vernon- woodworth-46780126
  • 7. SECOND EDITION Programming Interactivity Joshua Noble Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo
  • 8. Programming Interactivity, Second Edition by Joshua Noble Copyright © 2012 Joshua Noble. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com. Editors: Shawn Wallace and Brian Jepson Production Editor: Melanie Yarbrough Proofreader: Kiel Van Horn Indexer: Ellen Troutman Zaig Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrator: Robert Romano July 2009: First Edition. January 2012: Second Edition. Revision History for the Second Edition: 2012-01-10 First release See http://oreilly.com/catalog/errata.csp?isbn=9781449311445 for release details. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Programming Interactivity, Second Edition, the cover image of guinea fowl, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein. ISBN: 978-1-449-31144-5 [LSI] 1326301522
  • 9. Table of Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii 1. Introducing Interaction Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 What This Book Is For 1 Programming for Interactivity 2 The Nature of Interaction 3 Messages and Interaction 5 Interfaces and Interaction 6 Languages of Interaction 7 Design and Interaction 15 Art and Interaction 16 Data Exchange and Exploration 17 Working Process 21 2. Programming Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Why You’ll Read This Chapter More Than Once 24 The Nature of Code 24 Variables 25 Simple Types 26 Arrays 31 Casting 35 Operators 35 Control Statements 39 if/then 39 for Loop 40 while Loop 41 continue 42 break 42 Functions 43 Defining a Function 43 Passing Parameters to a Function 44 iii
  • 10. Some Suggestions on Writing Functions 45 Overloading Functions 46 Objects and Properties 48 Scope 51 Review 52 3. Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Downloading and Installing Processing 56 Exploring the Processing IDE 56 The Basics of a Processing Application 58 The setup() Method 58 The draw() Method 60 The Basics of Drawing with Processing 63 The rect(), ellipse(), and line() Methods 63 RGB Versus Hexadecimal 64 The fill() Method 66 The background() Method 67 The line() Method 67 The stroke() and strokeWeight() Methods 68 The curve() Method 68 The vertex() and curveVertex() Methods 69 Capturing Simple User Interaction 70 The mouseX and mouseY Variables 71 The mousePressed() Method 71 The mouseReleased() and mouseDragged() Methods 72 The keyPressed and key Variables 75 Importing Libraries 80 Downloading Libraries 80 Loading External Data into Processing 81 Loading and Displaying Images 81 Displaying Videos in the Processing Environment 83 Using the Movie Class 83 Reading and Writing Files 85 Running and Debugging Applications 87 Exporting Processing Applications 88 Conclusion 91 Review 91 4. Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Starting with Arduino 94 Installing the IDE 95 Configuring the IDE 97 Touring an Arduino Board 99 iv | Table of Contents
  • 11. The Controller 99 Uno Versus Mini Versus Mega 99 Touring the Arduino IDE 105 The Basics of an Arduino Application 108 The setup Statement 108 The loop Method 108 Features of the Arduino Language 110 Constants 112 Methods 112 Arrays 114 Strings 114 How to Connect Things to Your Board 118 Resistors 120 Hello World 121 Debugging Your Application 124 Importing Libraries 127 Running Your Code 130 Running Your Board Without a USB Connection 130 Review 130 5. Programming Revisited . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 Object-Oriented Programming 133 Classes 134 The Basics of a Class 135 Class Rules 136 Public and Private Properties 137 Inheritance 139 Processing: Classes and Files 141 C++: Classes and Files 143 .cpp and .h 144 A Simple C++ Application 146 Pointers and References 148 Pointer 150 Reference 151 When to Use Pointers 153 When to Use References 154 Some Rules for Pointers 154 Some Rules for References 155 Pointers and Arrays 156 When Are You Going to Use This? 157 Review 158 Table of Contents | v
  • 12. 6. openFrameworks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Your IDE and Computer 160 Windows 160 Mac OS X 161 Linux 161 Taking Another Quick Tour of C++ 162 Basic Variable Types 163 Arrays 163 Methods 164 Classes and Objects in C++ 165 Getting Started with oF 166 Touring an oF Application 172 Methods 172 Variables 174 Creating “Hello, World” 174 Drawing in 2-D 176 Setting Drawing Modes 179 Drawing Polygons 179 Displaying Video Files and Images 182 Images 182 Video 184 Compiling an oF Program 186 Compiling in Xcode 186 Compiling in Code::Blocks 188 Debugging an oF Application 188 Using the cout Statement 189 Using the GNU Debugger 190 Using the Debugger in Xcode 190 Using the Debugger in Code::Blocks 192 Importing Libraries 193 ofxOpenCv 195 ofxVectorGraphics 195 ofxAssimpModelLoader 195 ofxNetwork 195 ofxOsc 196 Review 196 7. Physical Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 Interacting with Physical Controls 199 Thinking About Kinetics 200 Getting Gear for This Chapter 201 Controlling Controls 202 The Button As an Electrical Object 202 vi | Table of Contents
  • 13. The Button As an Interactive Object 202 Reading the Value of a Button 202 Turning Knobs 203 The Dial As an Interactive Object 203 Potentiometers 203 Using Lights 206 Wiring an LED 206 Detecting Touch and Vibration 208 Reading a Piezo Sensor 209 Getting Piezo Sensors 210 Detecting Proximity 210 Proximity Through Capacitance 210 Detecting Motion 216 PIR Motion Sensor 216 Reading Distance 218 Reading Input from an Infrared Sensor 220 Understanding Binary Numbers 222 Binary Numbers 222 Bits and Bit Operations 222 Why Do You Need to Know Any of This? 225 Communicating with Other Applications 225 Sending Messages from the Arduino 228 openFrameworks 229 Detecting Forces and Tilt 232 Introducing I2C 237 Gyroscopes 240 What’s Next 243 Review 244 8. Programming Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 The Screen and Graphics 248 Seeing Is Thinking, Looking Is Reading 250 Math, Graphics, and Coordinate Systems 251 Drawing Strategies 254 Use Loops to Draw 254 Use Vectors to Draw 256 Draw Only What You Need 262 Use Sprites 263 Transformation Matrices 263 Creating Motion 267 Shaping the Gaze 268 Setting the Mood 268 Creating Tweens 270 Table of Contents | vii
  • 14. Using Vectors 276 Using Graphical Controls 285 ControlP5 Library 286 Event Handling 286 Importing and Exporting Graphics 288 Using PostScript in Processing 289 Using PostScript Files in oF 290 What’s Next 294 Review 294 9. Bitmaps and Pixels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 Using Pixels As Data 298 Using Pixels and Bitmaps As Input 300 Providing Feedback with Bitmaps 301 Looping Through Pixels 302 ofPixels 303 Manipulating Bitmaps 306 Manipulating Color Bytes 309 Using Convolution in Full Color 310 Analyzing Bitmaps in oF 311 Analyzing Color 312 Analyzing Brightness 314 Detecting Motion 315 Using Edge Detection 321 Using Pixel Data 328 Using Textures 331 Textures in oF 332 Textures in Processing 335 Saving a Bitmap 338 What’s Next 339 Review 339 10. Sound and Audio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 Sound As Feedback 342 Sound and Interaction 345 How Sound Works on a Computer 347 Audio in Processing 350 Instantiating the Minim Library 350 Generating Sounds with Minim 352 Filtering Sounds with Minim 356 Sound in openFrameworks 362 openFrameworks and the FMOD Ex Library 364 Maximilian 371 viii | Table of Contents
  • 15. Physical Manipulation of Sound with Arduino 381 A Quick Note on PWM 382 Creating Interactions with Sound 385 Further Resources 385 Review 386 11. Arduino and Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 Using Motors 390 DC Motors 391 Stepper Motors 394 Motor Shields 396 Smart Feedback 397 Using Servos 399 Connecting a Servo 400 Communicating with the Servo 400 Wiring a Servo 401 Using Household Currents 405 Working with Appliances 408 Introducing the LilyPad Board 414 Using Vibration 416 Nano, Fio, and Mini 419 Using an LED Matrix 419 Using the LEDControl Library 419 Using the SPI Protocol 422 Serial LED Matrix 423 Using LCDs 425 Using Solenoids for Movement 429 What’s Next 432 Review 432 12. Protocols and Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435 Communicating over Networks 436 Using XML 438 Understanding Networks and the Internet 441 Network Organization 441 Network Identification 442 Network Data Flow 443 Handling Network Communication in Processing 443 Client Class 444 Server Class 445 Sharing Data Across Applications 448 Understanding Protocols in Networking 453 Using the ofxNetwork Add-on 454 Table of Contents | ix
  • 16. Creating Networks with the Arduino 469 Initializing the Ethernet Library 470 Creating a Client Connection 470 Creating a Server Connection 472 Wireless Internet on the Arduino 475 Communicating with Bluetooth 479 Using Bluetooth in Processing 479 Using the bluetoothDesktop Library 480 Communicating Using MIDI 482 Review 486 13. Graphics and OpenGL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 What Does 3-D Have to Do with Interaction? 489 Understanding 3-D 490 What Is OpenGL? 491 Working with 3-D in Processing 492 OpenGL in Processing 493 Lighting in Processing 494 Controlling the Viewer’s Perspective 496 Making Custom Shapes in Processing 501 Using Coordinates and Transforms in Processing 503 Transformations 506 3-D in openFrameworks 506 Drawing in 3-D 508 Transformations in openFrameworks 509 Lighting in OpenGL 509 Blending Modes in OpenGL 511 Creating 3-D Objects in oF 515 Using Textures and Shading in Processing 519 Using Another Way of Shading 520 What Does GLSL Look Like? 520 Vertex Shaders 521 Geometry Shader 522 Fragment Shader 522 Variables Inside Shaders 523 Using ofShader 524 Using Shaders in Processing 530 What to Do Next 531 Review 532 14. Motion and Gestures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535 Computer Vision 536 Interfaces Without Controls 537 x | Table of Contents
  • 17. Example CV Projects 538 OpenCV 539 Using Blobs and Tracking 539 Starting with ofxOpenCV 540 Detecting Features with oF 545 Using OpenCV in Processing 549 Feature Tracking in Processing 554 Using Blob Tracking with Physics 559 Exploring Further in OpenCV 565 Detecting Gestures 566 Using ezGestures in Processing 567 Using Gestures in oF 570 Capturing iOS gestures with oF 574 Touch with oF 577 Tuio 577 reacTIVision 578 CCV 578 What’s Next 578 Using the Microsoft Kinect 579 Processing 579 openFrameworks 580 Review 580 15. Movement and Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583 Using Movement As and In Interaction 583 Using Software-Based Serial Ports 585 Understanding and Using GPS 587 Storing Data 599 Logging GPS Data to an Arduino 602 Using the breadcrumbs Library 602 Implementing Hardware-Based Logging 603 Sending GPS Data 606 Getting Location on a Mobile Device 608 On the iPhone 608 On an Android Phone 609 What to Do Next 610 Review 610 16. Spaces and Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613 Using Architecture and Space 613 Sensing Environmental Data 614 Using an XBee with Arduino 615 Creating a Simple Test 619 Table of Contents | xi
  • 18. Configuring the XBee Module 621 Addressing in the XBee 622 XBee Library for Processing 624 Placing Objects in 2-D 628 Using the X10 Protocol 634 Setting Up an RFID Sensor 638 Reading Heat and Humidity 644 Determine Position of an Object 649 What’s Next 656 Review 656 17. Further Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659 What’s Next? 659 Software Tools 659 Construction Processes 662 Artificial Intelligence 663 Physics 664 Hardware Platforms 670 Bibliography 672 Interaction Design 672 Programming 673 Hardware 674 Art 674 Conclusion 675 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677 xii | Table of Contents
  • 19. Preface This book is broken into three parts. The first introduces the three projects that will be used throughout this book, the second introduces some of the most common themes in creating interaction in designs and applications, and the third introduces some of the more advanced topics that you may want to explore further. Also included with some of the chapters are interviews with programmers, artists, designers, and authors who work with the tools covered in this book. Covering such a massive range of topics means that this book doesn’t go into great depth about most of them, but it is filled withreferencestootherbooks,websites,designers,andartiststhatyoumayfindhelpful or inspiring. What Is—and Isn’t—in This Book My excitement about the ideas and rapid growth of the field of interaction design is hard to contain. However, as exciting and far-reaching as interaction design is, the limitations of time and physical book size dictate that I be selective about what is and isn’t covered in this book. What’s In This book covers Processing, Arduino, and openFrameworks. To help novice pro- grammers, it covers some of the core elements of programming in C and C++ for Ar- duino and openFrameworks and also covers the Processing language. We introduce dozens of libraries for openFrameworks and Processing—too many to list here. Some of these are official libraries or add-ons for the two frameworks, and some are simply extensions that have been created for this book or provided by altruistic coders. We also introduce some of the basics of electronics and how computer hardware functions, as well as many tools and components that you can use with an Arduino. The Arduino and Processing IDEs are covered, as are two different IDEs for openFrameworks, namely, Code::Blocks, and Xcode. The Arduino Uno and Mini are covered in depth, and we discuss other boards only briefly. We cover many electronic xiii
  • 20. components that have designed expressly for the Arduino, called shields, in depth as well. What’s Not In While this book shows how to create some circuits, it doesn’t cover a great deal of the fundamentals of electronics or hardware, how to create circuits, or electronics theory. Chapter 17 lists some excellent tutorials and references. While the book does cover the Processing subset of the Java programming language, to conserve space and maintain focus, it doesn’t cover Java. The book doesn’t cover many aspects of C++, such as templates, inline functions, operator overloading, and abstract classes. Again, though, listed in Chapter 17 are several excellent resources that you can use to learn about these deeper topics in C++. There are so many Arduino-compatible boards now that it’s almost impossible to cover them all in depth; the book mentions the Mega, the Nano, Fio, and several other boards only in passing and leaves out many of the Arduino-compatible boards that are not created by the Arduino team. Quite a few components and other tools that we would havelikedtodiscussindepthcouldnotbeincludedtomaintainscopeandtosavespace. Many topics that we would have liked to include have been left out because of space considerations: artificial intelligence, data visualization, and algorithmic music, among others. Though these are all potentially interesting areas for artists and designers, the focus of the book is on teaching some of the theory and techniques for interaction design as well as the basics of hardware and programming. The resources listed at the end of the book can provide the names of some materials that might help you explore these topics. Conventions Used in This Book The following typographical conventions are used in this book: Italic Indicates new terms, URLs, email addresses, filenames, and file extensions. Constant width Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords. Constant width bold Shows commands or other text that should be typed literally by the user. Constant width italic Shows text that should be replaced with user-supplied values or by values deter- mined by context. xiv | Preface
  • 21. This icon signifies a tip, suggestion, or general note. This icon indicates a warning or caution. Companion Website All the code included in this book is available for download from the book’s companion website, http://www.oreilly.com/catalog/9781449311445. Using Code Examples This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission. We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Programming Interactivity, Second Edi- tion by Joshua Noble (O’Reilly). Copyright 2012 Joshua Noble, 978-1-449-31144-5.” If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at permissions@oreilly.com. Safari® Books Online Safari Books Online is an on-demand digital library that lets you easily search over 7,500 technology and creative reference books and videos to find the answers you need quickly. Withasubscription,youcanreadanypageandwatchanyvideofromourlibraryonline. Read books on your cell phone and mobile devices. Access new titles before they are available for print, and get exclusive access to manuscripts in development and post feedback for the authors. Copy and paste code samples, organize your favorites, down- load chapters, bookmark key sections, create notes, print out pages, and benefit from tons of other time-saving features. Preface | xv
  • 22. O’Reilly Media has uploaded this book to the Safari Books Online service. To have full digital access to this book and others on similar topics from O’Reilly and other pub- lishers, sign up for free at http://my.safaribooksonline.com. How to Contact Us Please address comments and questions concerning this book to the publisher: O’Reilly Media, Inc. 1005 Gravenstein Highway North Sebastopol, CA 95472 800-998-9938 (in the United States or Canada) 707-829-0515 (international or local) 707-829-0104 (fax) We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at: http://shop.oreilly.com/product/0636920021735.do To comment or ask technical questions about this book, send email to: bookquestions@oreilly.com For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com. Find us on Facebook: http://facebook.com/oreilly Follow us on Twitter: http://twitter.com/oreillymedia Watch us on YouTube: http://www.youtube.com/oreillymedia Acknowledgments I need, first and foremost, to thank the wonderful engineers, artists, programmers, and dreamers who created the platforms that I’ve covered in this book. It is to all of them that I would like to dedicate this book. A woefully short list has to include Massimo Banzi, Tom Igoe, David Cuartielles, Gianluca Martino, David A. Mellis, Ben Fry, Casey Reas, Zach Lieberman, Theo Watson, Arturo Castro, and Chris O’Shea, the creators of the frameworks covered in this book. There are dozens, if not hundreds, of other names that should be on this list, but space is too limited to list them all. All I can say is thank to you to all the creators of these frameworks and to everyone who uses them to inspire, invent, amaze, and enrich the dialogue about design, technology, and art. This book is a humble attempt to thank you all for everything you’ve given to me— and to every other programmer, artist, or designer interested—for working with com- puting in novel and interesting ways and bringing more people into the conversation. I would also like to extend my deepest thanks to all my interviewees for taking the time xvi | Preface
  • 23. to respond to my questions and enrich this book and for so enriching the world of interaction design and art. To everyone who provided code for this book as well, created open source code, or answered questions on any of the forums for beginners: thank you for your efforts to create a community. This book is as much my effort as it is the sum of the efforts of the editorial team that worked on it. My technical editors, Michael Margolis, Adam Parrish, Matt Obert, Jeff Crouse, and Jeremy Rotzstain, have been absolutely fantastic. Their expertise, sugges- tions, and fresh look at what I was working on shaped not only this book but enlight- ened me, showed me new ways of solving problems, introduced me to new tools and techniques, sharpened my thinking, and broadened my horizons for the better. This book is a collaboration among all four of us in every sense of the word. I cannot pay them enough thanks for their excellent work. I would also like to thank Justin Hunyh and Mike Gionfriddo from LiquidWare as well as Nathan Seidle from Sparkfun for all of their help. My editors—Shawn Wallace, Robyn Thomas, and Kim Wimpsett—have been incredible, helping me with my sometime torturous grammar and patiently work- ing with my propensity for sending in extremely rough drafts to bounce ideas off of them. They have made this book better than it ever could have been without their watchful eyes and guidance. Finally, I need to thank Steve Weiss for listening to my idea when I first proposed it and helping guide it through to completion. I need to thank all of my friends in New York, Portland, Amsterdam, Geneva, London, Zurich, Boston, Paris, Copenhagen, and Toulouse for their support, their ideas, their Internet, and their encouragement. I would like to thank my family as well, and par- ticularly my mother, for their support and humor. Preface | xvii
  • 25. CHAPTER 1 Introducing Interaction Design The scientist and philosopher Alfred Korzybski once remarked, “The map is not the territory,” and it’s in that spirit that this book was written. The map may not be the territory, but it is helpful for getting around the territory and for finding where you are and where you want to go. This book covers a vast range of topics from programming to electronics to interaction design to art, but it doesn’t cover any one of them in great depth. It covers all of these topics because they are part of an emerging territory that is often called interaction design, and that territory encompasses art, design, psychology, engineering, and programming. It’s also a territory that is becoming more and more accessiblethankstoexcellentprojectsliketheonesthatwe’llbeexploringinthebook— tools that have been created to make code and coding easier to do. You should use this book like a map to see what technologies exist and the areas in interaction design that you might want to explore. This isn’t a cookbook or an in-depth technical manual, but it will point you in the direction of other books, researchers, designers,projects,andartistsasyougoalong.Thisbookwillalsogiveyouthetechnical understanding to know how to find information on almost any kind of project that you want to explore and what to do with that information once you find it. What This Book Is For This book was created under the premise that technology and code are not tools solely for computer scientists or engineers to create applications and that no one be intimi- dated by or shy away from working with and exploring electronics, hardware, and code. Artists and designers can be interested in enabling interaction between users and be- tween applications in ways that can be accentuated by the addition of custom computer applications or that can be realized only through the use of custom computer applica- tions. You can focus on creating applications that emphasize their technological nature or on creating applications that feel very high-tech or use familiar metaphors like a keyboard and mouse or touchscreen. You can also choose to accentuate other aspects of the interaction or hide the technology behind a more organic interface. This book is specifically about the interactions that users or viewers can have with computers, 1
  • 26. electronics, tools, and the platforms that artists and designers can use to create appli- cations and electronics that users can interact with. You’ll be learning about three tools: Processing, openFrameworks, and Arduino. These frameworks are designed specifically for artists and designers and as such are perfect for discussing how we can begin to create interactive designs and artworks. Each of them has a different background and uses different kinds of technology, but all of them are created with the goal of helping you explore and create applications more painlessly and quickly. In addition to showing you specifics of those three tools, this book focuses on three slightly more abstract concepts: code, interaction design, and ideas. Creating code is a similar activity whether you’re writing something in C++ for openFrameworks or you’re creating some logic in a circuit with Arduino. In both cases, you’re creating a process that will run many times, perhaps even thousands of times, and that will generate the outcome you want. This book also makes a few assumptions about you, the reader. I assume that you don’t have a deep, or even any, programming or technical background. I also assume that you’re a designer, artist, or other creative thinker interested in learning about code to create interactive applications in some way or shape. You might be a designer wanting to begin playing with interactive elements in your designs, wanting to create physically reactive applications to explore some interaction design concept, or wanting to proto- type an idea for a product. You might be an artist wanting to begin working with interactive installations or with interactive computer graphics. You might be an archi- tect wanting to get a basic understanding of programming and hardware to explore reactive architecture. You might be none of these at all, which is fine, too, as long as you’re interested in exploring these themes while you learn about the three frameworks this book describes. You’ll explore the nature of interaction through common tools and techniques as well as through some discussions with designers, engineers, and artists working with inter- action. In all likelihood, this book will not radically alter your perception of what in- teraction is, nor will it introduce you to radically new modes of interaction. This book will introduce to you to methods of creating common interactive elements that you can then use to explore further techniques of facilitating interactions between users or cre- ating interactive elements that a user or viewer can experience. Programming for Interactivity This book is called Programming Interactivity because it’s focused primarily on pro- gramming for interaction design, that is, programming to create an application with which users interact directly. There are many styles of programming, and some tech- niques and ways of thinking about code are better suited to programming servers or databases than interaction. In this book, we’re going to concentrate explicitly on things you can use to tell users something or to have users tell your application something. 2 | Chapter 1: Introducing Interaction Design
  • 27. One of the great challenges in interaction design is actually creating real interactions between what you’re designing and the user who will be using it. The Nature of Interaction So then, what exactly is interaction? Interaction could be defined as the exchange of information between two or more active participants. The writer and video game de- signer Chris Crawford describes interaction as “an iterative process of listening, think- ing, and speaking between two or more actors.” Generally, when we’re talking about interaction and programming it’s because one element in the interaction is a computer system of some sort or some control element that a person is trying to get to do some- thing. The person for whom the computer or mechanical system is being designed is called the user, and what the user is using is called the system. There are many different terms floating around today, such as human computer interaction, computer human interaction, or experience design. All mean more or less the same thing: designing a system of some sort that a person can interact with in a way that is meaningful to them. As an interaction designer, you’re trying to understand what the user wants to do and how the system that you’re creating should respond. That system can be almost any- thing: a game, a menu, a series of connected sensors and lights, a complicated physically interactive application, or even a group of other people. There is another key concept in interaction design that you should understand: the feedback loop. The feedback loop is a process of an entity communicating with itself while checking with either an internal or external regulatory system. That sounds a little more complex than it actually is. You’re actually already quite familiar with bio- logical regulatory systems; sweating keeps your body cool, breathing keeps oxygen flowing through your body, and blinking keeps your eyes from drying out. When you need more oxygen, your body breathes harder. This isn’t something you have to tell your body to do; it simply does it. To maintain a constant level of oxygen, it sends out signals to breathe more and more deeply or frequently until it reaches the correct level. It feeds back on itself, sending signals to itself to breathe more again and again until it doesn’t need to send those signals anymore. You can also think of the feedback that you give yourself while staying upright on a bicycle. You’re constantly adjusting your balance minutely, with your brain feeding data to your body and your body feeding data back in a constant loop that helps you stay balanced. These loops are important in the notion of a system that does something constantly. Without feedback, systems can’t regulate themselves because they won’t know what they’re doing. Let’s start at messaging and work our way up to interaction. While one participant certainly may be more active than the other, the “interaction” doesn’t really apply when we use it to describe a transmission, that is, a message sent to someone with no way of handling a response. Think of a television commercial or a radio broadcast: it’s simply a signal that you can listen to if you’re in the right place at the right time and you have the right equipment. These broadcasts flow on regardless of whether you or anyone else is listening, and they occur on their own time, in their own tempo. Programming for Interactivity | 3
  • 28. When you give a user a way of rewinding or controlling the tempo of information, an extra layer of user control is added. You can’t really interact with a book or a static web page, or even the vast majority of dynamic web pages, but you can control the speed at which you read them, and you can rewind information that you’re not sure about. These are really guided transmissions in that they give you a chunk of information that is more or less established and ask you which part of it you want to view. Scrolling, linking, fast-forwarding, and rewinding are all the techniques of guided transmissions. When you give a user a way to accomplish a task or input data into the system that changes it in a substantial way and you create a means for that system to respond to what the user is doing, then you’re creating interaction. Reactive interaction is really the beginning of interaction because it gets you started thinking about what the user will do and how your system or object will react. For everything that user does, the system or object needs to have a response, even if that response is “I didn’t understand” or another kind of error message. This can also be built into a single system. Many kinds of applications monitor their own performance, checking the state of a property in the system or the number of boxes available in a warehouse, for instance. If you imagine this as being an interaction between two people, then you might imagine a parent giving a child an order. A somewhat more complex model of interaction is one where the system is constantly doing a task and the users’ input regulates that task. Many industrial monitoring sys- tems function this way, as do the underlying parts of game engines, and many inter- active installations. The difficulty of creating this kind of interaction is ensuring that users always know what the system is doing at any given time, understand how they can modify it, and understand exactly how their modifications to one aspect of the system might affect another. If you imagine this between two people, then you might imagine a parent helping a child walk, ensuring that she doesn’t fall over as she goes. You can also imagine how a regulatory system might function, where the system reg- ulates the user as they’re executing a task. This isn’t really two entities fully commu- nicating because the regulated system doesn’t respond—it simply changes its behavior—but it does involve continuous systems. Systems can perform this task on their own as well, monitoring a process and providing regulation of an ongoing process. This last mode of interaction blends into another. It is a very similar but slightly more complex model of creating interaction that might be described as the didactic, or learn- ing, mode of interaction. Here, the system is still running continuously, and the user can see into the system, but instead of regulating the behavior, the user is learning from the output data. A lot of monitoring applications function this way, providing a view into relevant data and data points that the user can use to learn about a process. Again, the system isn’t actively conversing with a user; it’s just running and reporting infor- mation to the user. The user also has his process driven by the reporting from the system but not really modified by it, which is why it’s a learning model. Both systems and people are more than capable of learning from themselves, albeit in quite different ways. 4 | Chapter 1: Introducing Interaction Design
  • 29. A more complex mode of interaction is a management type model where the user com- municates something to a system and the system communicates something back that allows the user to carry on with a secondary task. This is where you begin to see the real complexities of communication between users and systems. The user is commu- nicating with a system and asks the system to perform some task. The system responds in a way that allows a user to continue with a secondary task. The system continues to run, and the user continues to run even while she has her own internal feedback loop occurring. One can find this in many real-time monitoring applications in fields from finance to medicine. Finally, we have the most complex mode of interaction: a full-fledged conversation. This is something that humans have mastered doing amongst one another, but it’s another matter altogether to create this between a human and a machine because of how complex the notion of a conversation really is. When you think about how much data is communicated in a conversation through words, tone of voice, facial expres- sions, body posture, subtext, and context, you realize it’s a substantial amount of in- formation being exchanged and processed at extremely high rates. Most user-system conversations are a great deal less complex. A simple but good example of this is navigating using a mobile device: the device is constantly updating its position and displaying that back to the user and providing directions, while the user is actively traveling and querying the device for information. Enabling this conversational mode of interaction between users and systems is one of the most pressing challenges in interaction design and engineering. These modes of interaction all present different challenges and help users do different kinds of things. You’ll find that the appropriate mode depends on the users, the task, and the context in which the interaction is taking place. Messages and Interaction Interaction happens via messages sent from systems to users, and vice versa. These messages can be text, speech, colors, visual feedback, or mechanical and physical input or feedback. Depending on the kind of application, winking can be just as clear and important a message as pushing a button. One thing that interaction designers talk about a great deal is how to construct and receive messages in a way that is simple and unambiguous for users and for the system. One of the most difficult tasks in creating interactive applications is to understand how the system sees messages from users and how the user sees messages from the system. With applications that have a great degree of interactivity, allow more tasks for the user and the system, and allow for more sophisticated messages, it is easy for a conversation to become unclear to one party. When a message isn’t understood, it’s quite important to help the other party understand not just what wasn’t understood but also how it can be fixed. If I don’t understand something that someone says to me, I ask that person to repeat it. If I ask for a web page that doesn’t exist, the server responds with an error Programming for Interactivity | 5
  • 30. page that tells me the page doesn’t exist. The more freedom each party has, the greater the possibility of erroneous, unintended messages, and the greater the need for edu- cating one party about what the other party understands and how that understanding is being constructed. Think for a moment about a conversation between two adults. Communicating like this requires years of what could be described as user training: learning a language, learning appropriate and inappropriate behavior, learning a value system, and so on. It is because of this that the interaction between two humans can be as rich as it is. This idea of training the user to understand what messages the system understands and what a message from the system means is a tricky process. Creating a program with a datagrid where a user can select items is quite simple for the user to begin to understand because most computer literate users are familiar with the notion of a datagrid. We see datagrids quite frequently, and we generally have an understanding of what they can do, what they can’t do, a rough understanding of what error messages coming from datagrids might mean, and how to use them. If you’re using a new kind of control or interface, you’ll have to make sure that you provide ways for users to learn what your system is, how it works, and what they can do with it. There is a correlation between the richness of interactive systems and the difficulty of creating it: the richer the interaction, the more that can go wrong. This is part of why designers spend so much time and energy attempting to create anticipatable experien- ces: interactive experiences where a user or viewer can leverage other realms of knowl- edge or other experiences interacting. Popular slogans in design, like “principle of least surprise,” express the notion that the familiar interaction is the preferable interaction because the learning curve for the user is much more shallow than a truly novel inter- action. Users must learn how feedback is returned to them and how to modify their behavior based on the feedback, both of which can be a lengthy process. Interfaces and Interaction One part of the feedback from a system is actual messages sent back and forth—text prompts, for example—but the interface is another important part of the communi- cation of an interaction. An interface sits between two actors and facilitates their com- munication. This can be a screen, a control panel, an interactive wall, or simply a microphone and a pair of speakers. The interface is whatever shared materials the user and the system use to send and receive messages. Interface design is a very large topic unto itself, but it gets a little more manageable if you consider it in terms of what it means for designing an interaction. The interface is the medium of the communication between the user and the system. It drives a lot of what is possible and what is not possible, what is efficient and what isn’t, and what the tone of the interaction is. If you think about how you talk to someone on the phone versus how you talk to them in person, you’re probably using more hand gestures, facial expressions, and other forms of nonverbal communication in person 6 | Chapter 1: Introducing Interaction Design
  • 31. and being more direct and using your tone of voice more when you are on the phone. What we use to do something affects a lot of how we do that thing. Having a functional, expressive, and attractive interface is very important in creating the means for an in- teraction to occur. The attractiveness of an interface is an important part of making an interaction pleasant to a user; the colors, text, symmetry, sounds, and graphics are important and are communicative elements that shape a great deal about what a user thinks about your system. This shouldn’t come as a great surprise to anyone, but users prefer good-looking interfaces. What makes those interfaces attractive is largely a mat- ter of context, both for your users and for the task that they’re trying to accomplish with your system. While users prefer attractive interfaces, they need functional inter- faces. The functionality of an interface is part of what makes a system good for a task and what makes a user able to use your system. Even if what that system does is rather opaque, the user still needs a functional interface that shows him what his input does and gives him feedback. It’s important to remember that interaction is more than the use of an interface. When we consider the most common interactions between a user and a machine—for exam- ple, a cell phone call—they’re quite simple in terms of the interaction between the user and the object. For a cell phone, you simply dial numbers to find someone else in a system; it alerts you if you’re being sought, and it sends and receives sound. This rel- atively simple interaction is important for reasons other than the interaction between the person and the object; it’s important because of the context of that interaction: you can make a cell phone call from almost anywhere. Before cell phones, you needed a phone line available to you, but now, with a cell phone, you simply need a phone and an account. You can reach people while both of you are away from home, and you can be reached when you are away from your home or office. When the cell phone first emerged, cell phone users already understood how to make and receive telephone calls, and the general pattern of the user interface was already established. True innovations in user interfaces are very difficult to realize because they often require very substantial engineering efforts and serious thinking by the interaction designer to ensure that the interface will function properly. Also, they require a lot of user training and retraining. There aren’t a great deal of true revolutions in user interfaces: the creation of the key- board, Doug Engelbart’s mouse (the prototype of the mouse we know today), Ivan Sutherland’s sketchpad, the desktop GUI, and now the capacitive touchscreen. These were technological changes and impressive feats of engineering, and they were also shifts in the way people used computers. Revolutionary interfaces shape more than just the way that a tool appears; they redefine the possibilities of how a tool can be used. Languages of Interaction All interactions have a certain vocabulary that they use. If you think of how you delete something from the desktop with a mouse, you might say, “I select the file and drag it to the trash.” The actual actions that you’re performing when you do this are a little different from what the system understands you to be doing, but that’s not really what’s Programming for Interactivity | 7
  • 32. important. What’s important is that you understand what the actions you can perform are and you know that the system understands those actions in the same way and will perform them in the same way that you expect. Having a meaningful, efficient, and productive interaction, just like creating a language or a code, requires that both parties agree on the meaning of the symbol and the meaning of the order in which actions occur. Those particular understandings are going to be quite different depending on the interface and type of interaction that the user undertakes. In this book, we’ll examine some of the many different kinds of interactions, but don’t take this next section as a list of categories. Considering the pervasiveness of computing and interactions that exist with computing, there are so very many kinds of interaction between humans and computers that it is difficult to even reference some of the most common modes of interaction without some overlap among categories. Physical manipulation These are the first interfaces that were created for electronics and some of the first designed multifunction man/machine interactions. Typically, before the advent of the car and radio, which were the first two common machines with multiple in- terface elements, a machine had a single switch or use. The user’s attention was focused on a single task at a time. Radios and automobiles presented novel chal- lenges because both required multiple actions by nonspecialists; in the case of the automobile, this included speed and direction at all times and other tasks at irreg- ular times. The interface might be a control that represents either a state that can be activated by flipping a switch or pushing a button or a range that can be set by turning a knob or pushing a slider. The interface lets users not only control the values that they are setting but also check values via labeling of sliders, knobs, dials, and switches. Dials, oscilloscopes, and other feedback interface elements let users verify information more quickly without referring to the actual interface element that they were manipulating. This requires that the user monitor multiple sources of information at a given time while manipulating controls. Physical manipulation ofacontrolisoneofthemostimportantandinterestingwaysofcreatinginteraction with a system. Input using code At the dawn of the age of computing, the classic user interaction model was a terminal where a user input code commands that were then run and the results were reported to the screen in the form of text. The driving interactive concept was to command the machine via a system of commands that the computer had been preprogrammed to recognize. The user had to be knowledgeable or at the very least comfortable with requesting help from a very bare interface. This is certainly not the end of keyboard-based interactive behaviors, though. Consider the notion of the hot key, for instance Ctrl+Z for undo, beloved by so many programmers and ubiquitous in all applications from word-and image-processing applications to browsers. The hot key is no different from the command line but accentuates the 8 | Chapter 1: Introducing Interaction Design
  • 33. user interface by allowing the user to automate repetitive tasks or perform a task quickly without diverting their attention from another task. Mouse manipulation This is the most common method of interacting with a computer at this moment and the interface for which almost all commonly used applications have been de- signed. Consider the language of working with the mouse, the techniques that have been implemented by designers and learned by users: drag-and-drop, double-click, and click-and-hold. These movements and the meanings behind them in different applications are not completely standard, nor are they entirely fixed. One appli- cation may use a given gesture in many different ways in a single application and rely on the user understanding the feedback given to them by the application to know which meaning of the gesture will be used in the current context. Presence, location, and image Theuseofthepresenceandabsenceoftheparticipantoruserisanextremelysimple but profoundly intuitive way of interacting. This can be detected by weight, mo- tion, light, heat, or, in certain cases, sound. The reaction to simple presence or absence acts as a switch, begins a process, or ends a process. The presence of the body, though simple, is a powerful basis of interaction; it engages users and asks users to engage with their presence, their position, and their image. This can be as simple as an automatic door sliding open as we approach, or as complex as Theo Watson’s Audio Space, where visitors don a headset equipped with earphones and a microphone and record messages that are then placed in the spot where they were recorded. As another user enters the location where a message was left, the message is played back along with any recorded by previous visitors. Each message sounds as if it is coming from the spot where it was recorded. We can imagine the body as a switch, or we can imagine the body as the image of the body and analyze this using photos or videos in any great number of ways. This theme of embodiment drives a great deal of fascinating interactions using what is called computer vision, that is, the analysis of images input using a camera, turned into pixels, and then analyzed. Later in this book, we’ll examine using computer vision to detect move- ment in an image and even to detect the location of a human face within an image. Haptic interfaces and multitouch At the time of the writing of this book, Apple iPhone, Microsoft Surface, and a great number of new tools for multiple touch-based interfaces have already been introduced. Given the excitement around these technologies, the speed of change and innovation will likely outstrip any attempts by myself or my editors to keep this text abreast of the most cutting edge products or technologies. Nevertheless, the fundamentals of designing and structuring interactions using these gesture- based interfaces will likely not change. These essentials are based on what will be familiar gestures to anyone who has used any of these products: using two fingers to expand or contract, turning two fingers to rotate, tapping to select. These are not used simply for software applications, either. Consider how often the waving gesture is used in an airport bathroom with sinks to turn on the water, paper towel Programming for Interactivity | 9
  • 34. dispensers, and hand driers. The language of these gestures becomes a language that we can use to enable interaction much as a common natural language, an icon, or a pattern of buttons pressed on a video game controller. Gesture The gesture is a fascinating interactive model because it so readily associates itself with signs, writing, and physicality. This notion of the interaction that is not driven by a keyboard or a mouse is particularly powerful because mouse and key inter- action is often nonintuitive for certain kinds of tasks. Gestures are often imple- mented with touchscreen interfaces or mouse movements or pens and are very often used for drawing applications, simple navigation elements, adaptive tech- nologies, or applications for children. There are many different cutting edge inter- active approaches that are being explored, from writing recognition systems and novel key input strategies like Swype to hand motion recognition systems via video. Voice and speech recognition Voice recognition is the programming of a computer to recognize certain words or phrases and perform certain tasks based on those commands. Commands can be as simple as voice activation, that is, having the voice act as a switch to turn some- thing on, and as complex as recognizing different words as commands. For a com- puter, words or commands are recognized as patterns of sounds that are then strung together and compared with a dictionary of patterns to determine what the command could be. Speech recognition is a much more advanced topic, using roughly the same approach as a simple command recognition engine, but with a far larger dictionary and more powerful tools to determine the input. Beyond speech, the voice itself can be used to provide input, volume, tone, and duration, and can be used to drive the interaction between users and applications. This is just a short list of some of the most prevalent themes in interaction design. In this book, there won’t be space to cover all of these approaches to interactivity, but you will learn some of the basics behind each of them and get information about further resources that you can use for your own design work. Interview: Matt Cottam Matt is the CEO and cofounder of Tellart and provides both inspiration and direction for the company through involvement in conferences, lectures, academia, and design culture worldwide. He has been teaching studio courses at RISD on topics ranging from design for extreme environments to physical computing since 1999. Matt holds the position of Adjunct Professor at Umeå Institute of Design (UID Sweden). He is also a Visiting Teacher each year at Copenhagen Institute for Interaction Design (CIID, Den- mark), Oslo School of Architecture and Design (AHO, Norway), and The Central Academy of Fine Arts, Beijing (CAFA, China). What does it mean to sketch in hardware? Matt Cottam: When I was a freshman at Rhode Island School of Design (RISD) in the early nineties, only doctors had car phones (the size of shoe boxes) and the web felt 10 | Chapter 1: Introducing Interaction Design
  • 35. like a clickable fax machine with a screen. By the time I graduated just five years later, all of my student peers had mobile phones and we all had multiple email addresses and were using browsers with color pictures, animation, and sound. It was overwhelmingly clear that digital and networked technology was going to change the way we use, per- ceive, and design products. We had spent the past five years shaping blocks of wood and foam to look like digital products, representing onscreen content by gluing printouts under acetate to the mod- els, role playing with fellow students to explore and communicate the behavior of in- teractive systems. This was good and we were after all at a very traditional, hands-on, craft-based school, but something critical was missing. When you design a chair, you cangotoa workshopandplayaround,cutting,shaping,andconnectinglotsofdifferent materials: steel, aluminum, leather, plywood, plastic, cork, foam; pipe, rod, sheet, resin. You can explore the capabilities of particular tools like a spot-welder or thermal former, see when they burn, melt, stretch, scratch, and when they seem to work without friction-when creating nice things seems effortless. You can work directly at the inter- section of a particular tool and particular material to find the size and shape of an object that shows off their unique strengths; you can create a form that feels to be in harmony—because it was born directly from the intrinsic qualities of the medium and method. When I was a student it was impossible for a designer to sketch directly and fluidly with the materials and tools of software and electronics. This led to an inability for the designer to create physical product forms and software interfaces that felt synthesized. There was no way to feel the real behavior, unlike the chair that you could just sit in. When we started Tellart in 1999, we set out to create a studio of industrial and graphic designers as well as electrical and software engineers that could work closely together and quickly sketch a model of interactive with the real stuff products. We have been active in the “sketching in hardware” or “physical computing” community since the early days and have developed many hardware and software tools during our work with students and clients. Now there are hundreds if not thousands of tools designed specif- ically to close the gap between design and engineering—some of the most important of which are taught in this book. Now the things Tellart makes not only have physical form, including graphical and tangible user interfaces, but we are designing the content and service layers holistically. Do you see a relationship in being able to prototype and research? Or, I suppose, assuming that you do see at least some relationship there, how do they fit together optimally? How have you handled that in your design practice? Matt: Just the other day I received a letter saying that I had been on the faculty at RISD for 12 years, and I’ve been teaching at Umeå Institute of Design (UID) for 6 years and Copenhagen Institute of Design for 3. Almost everyone at Tellart teaches at least a little each year and we have lead courses in as far away places as China and Taiwan. People often ask me how I make time for both teaching and Tellart, and the answer is simple: they are a symbiotic relationship. We work with students who are always looking over the horizon, always aiming to invent. We work closely, shoulder to shoulder in the workshops with them, at table saws and APIs trying to constantly understand what the Programming for Interactivity | 11
  • 36. modern designer needs to do their work in optimal conditions. We create new hardware and software toolkits—a constantly evolving suite we call Sketchtools—and test them out with students. They get a new, experimental way of working and we get to see what is possible when some of the brightest minds create with Sketchtools. We then take documentation of our work together with the students and show it at international conferences and to our clients. Almost our entire team is composed of former students. I hesitate to call the work we do at schools “research” since it is not really academic or even conceptual—it is really very tactical. What tools do you find most influential and useful to you and your design practice on a day-to-day basis? Matt: The beautiful thing about working at Tellart and with students is that we switch hardware and software tools like colors of paint. You can rarely work successfully with just one, and learning how to mix them is where real talent comes in. What does open source mean to you? What does sharing and communicating mean for your practice? Matt: We have always open sourced all of our Sketchtools and plan to keep doing so. We have a handshake contract with our students to the effect of: the only way I can share 100 percent openly with you is if you do the same with me—any ideas exchanged in our class, including our toolkits, are up for grabs in for anyone involved any form and at any time. I find that people who are possessive and competitive about their knowledge tend to be insecure and fall behind quickly—the people who share effec- tively know this. I’m not really interested in a magnum opus, I encourage students to be prepared to come up with new ideas every day, not once in a lifetime. Of course there is a role for client confidentiality but that is another mode of practice and the two can live in parallel and even share a symbiotic relationship. How do you move from a drawing or a video to a physical prototype? Also, if I can stay on that line of thinking for a moment: how do you move from a physical prototype to an electronic one (i.e, one that has at least some active element in it)? Matt: This may be a bit of an oversimplification, but I like to think that we are getting closer to having hardware and software tools that are no harder for a designer to become competent with than a milling machine or thermal-former. I see tables covered in Ar- duino, sensors, motors, pencil sketches, bits of plastic, fake fur, and clay. I guess it depends whether you define prototype as an exact model for manufacture or as a working sketch model. I find the term prototype problematic when used this way in courses and with clients; we prefer to talk about working sketch models at varying degrees of fidelity. If you mean developing a concept through making working sketches, then I think pencil, electronics, software, physical model sketches can all be used used simultaneously—they can be a sounding board for the designer while she gets an idea out into the world (often making discoveries along the way) and not just a process for building something predetermined. What tools do you find most helpful for beginners? Matt: Drawing and filmmaking. Call me old-fashioned but I believe that any profes- sional designer worth their salt should be able to draw. I don’t mean portraits; I mean 12 | Chapter 1: Introducing Interaction Design
  • 37. being able to make their ideas visible and understandable by others. To go further, I find that being able to facilitate group work involving people from various disciplines (often marketing, business leadership, manufacturing, technology) through improvi- sational drawing is an essential skill—maybe more today than ever before, as things like software and services are so intangible and things like data so formless, networks so complex. Interaction designers have to concern themselves with product and service ecosystems that are experienced by users over time and often over a variety of touch- points, so developing a visual vocabulary for expressing changes and transactions (like storyboards) is an invaluable skill. An interaction designer who can draw, build low- to-medium fidelity working sketch models involving electronics and software and also make short persuasive films that communicate how their product/service is culturally and economically relevant, has it made. Can you explain a little about the NADA project? Matt: NADA was the first software toolkit Tellart made, back in 2001 (Brian Hinch was the project lead). It allowed designers to use predecessors to the Arduino like Teleo, Phidgets, and all kinds of MIDI devices to be connected to Flash. Design students in 2002 were connecting RFID readers to websites, and connecting the Web to lights and motors within just a few weeks. Today this seems normal, but at the time it solved a lot for us and our students. Flash was something we already knew from making web projects and there was a ton of books, online tutorials, and courses available on the topic aimed directly at designers. Flash, especially back in version 4 when NADA appeared, was largely a graphical au- thoring environment, which meant we could draw a blue square, select it, and tell it to turn on a lightbulb when clicked (even less abstract for designers than writing HTML referencing images in a folder). Schools already had Flash as part of their annual purchase and installation (any teacher knows that getting a new software package into that group can take years of begging). NADA was a server written in Java. In all of our early interactive documentation, tu- torials were always offered in both Java and Flash, encouraging collaboration between engineers and designers. Our documentation had code snippets, but more importantly it provided a very visual diagnostic interface that detected which hardware you had connected and gave the values for all analog inputs and PWM outputs. It seems simple enough to just trace all of these values but I can tell you most designers working with NADA left this window open most of the time. The interface even had an interactive resistor calculator that you could adjust and see the effects directly on the outputs of your sensors. We used NADA on countless client and classroom projects. Most of the time NADA was a way to sketch and prototype, but many times it ended up in end products. NADA then became NADA Mobile, which was an iApp and server combination that allowed designers to make iPhone/iPod apps using just JavaScript and CSS and our custom functions. Version 2 allowed for connecting Arduino to iDevices. We also added the ability for connecting analog sensors to the headphone/mic jack of iDevices to control apps, which made the hardware side of sketching dirt simple. Our most Programming for Interactivity | 13
  • 38. recent courses have involved iDevices and Android devices connected to Arduino, Zig- bee and relays, allowing us to sketch with controlling everyday appliances from our mobiles and tablets. We also made several hardware toolkits and they are all part of the lineage we call Sketchtools. NADA is now just one of dozens of options for doing the same stuff, many of which are in this book. Future versions of our Sketchtools will require less building from scratch and be more about building combinations of hardware and software tools and writing design briefs that push us, our clients, and our students to think beyond what is currently possible. We never intended to be in the toolmaking process; we were just at one of those awesome times in history when you have more ideas than ways to make them. Now, thanks to all of the amazing toolkit projects out there, many of them made by our good friends, we can focus more of our time on using the tools to make great experiences. I’m really intrigued by the “What Is a Switch?” course that you teach as an intro course in a few different Interaction Design programs. Matt: The “What Is a Switch?” design project brief was developed for our Designing Interactions course at RISD in 2001. We had no way to experiment with tangible user interfaces in a manner that made sense to teach in a one semester industrial design course—we wanted to explore the need, use, value of technology, not the technology itself. I asked students to go into the metal and wood and plastics shops and gather as much interesting scrap as they could. The brief was then to each create 20 examples of how a human gesture or an environmental influence (light, wind, or water flow, etc.) could close a circuit. The circuit could be two lines drawn in pen on paper and the paper then folded to connect them—there were no electronics at all; the circuits were purely symbolic of connecting two components. Even today when our students come in on the first day as Arduino experts, we still see the most inventiveness in this project. There is just no friction and students allow themselves to be influenced by the qualities of the materials they find—a pile of plastic circles or some wool strips or some perfo- rated sheet metal. The project encourages listening to materials and forms and thinking about scale and anatomy of components. This project is always done in under 24 hours, from brief to critique—speed is a key ingredient. The “advanced” version of “What Is a Switch?” came about when we found a pile of keyboards in the school trash. We hacked the keyboard microcontrollers into these kinds of sketch switches (now including just a bit of wire but still no batteries) and captured the keystrokes in Flash. In literally a day worth of teaching and with zero dollars in materials, the students could make something as complex as “open the door and the video on the web plays, close the door and it stops.” This is still my favorite project. The great thing about the low cost is that students treat the materials like pencils or clay—they are fearless, as the materials flexible and rugged. The most amaz- ing ideas come out. 14 | Chapter 1: Introducing Interaction Design
  • 39. Design and Interaction The great industrial designer Henry Dreyfuss called design “the measure of man.” By this, he meant that the design of things is an excellent way to understand and analyze the activities of human beings. Defining the word design is a task better left to others, so I’ll leave my contribution at this: interaction design is the creation of tools for how we do specific things. The more specific the thing, the more finely the tool can be honed for it, and the more specific the interaction design can be. Interaction is sometimes confused with “doing something with a tool,” and although that’s important, it’s a little less specific than “how we do things with a tool.” Thinking about tools in terms of how, rather than just what, when, or why, isolates those things about the interaction that define the experience of doing that task. A lot depends on the task as well. A singular task with a singular action does not foster much dissonance; therefore, it can bear a lot more dissonance before it becomes meaningless. A task of multiple actions creates much greater dissonance and can lose meaningfulness much more quickly. The design of an interaction is a complex process that involves a lot of modeling of how a system will work, how a user will approach the goal she’s trying to accomplish, and how the interface needs to be configured to allow for all of these different operations. All of these taken together create the context of the interaction that you’re making. The context is very important to what choices you should make for the design of an inter- action. You might want to make the interaction very cut and dry so that everything that the user expects is given to her as quickly as possible and in an unambiguous manner. Most business applications or very task-based applications function this way; users know what they can do in unambiguous terms, and the interaction doesn’t deviate much from that initial information. There is a real pleasure in knowing what to expect and getting it so that you can make the interaction—and by extension the application or object—attractive. Or, you might want to make something much more playful, where the reward is in discovering the interaction and seeing it change throughout the use of it. Either way, a good understanding of the context of the user will help you create a better system and a better experience. One of the tricks of interaction design is that, fundamentally, what users are trying to do when they’re interacting with a system is to correlate it to something else that they’re more familiar with. Anyone who has ever said or heard anyone else say “the computer is thinking” has seen a little bit of anthropomorphic thought applied to a computer. As human beings, we are very good at a few different things, and when it comes to inter- action design, one of the more important things is using our understanding of the inner processes of other people. Interaction with a system doesn’t really involve understand- ing what someone else is thinking, but it does use some of the same cognitive processes. To that end, as an interaction designer, you want to give good cues that will help users understand what’s going on. They may not need to know exactly what the process of your system is, and probably shouldn’t, but they do need to know more or less what your system is doing with the information that they give it. Design and Interaction | 15
  • 40. Art and Interaction Interactivity in art has been a hotly discussed and debated topic for at least 20 years now, and the kinds of interactivity that you see in art pieces are constantly changing to expand the definitions of art and interaction. There are many computer games that can be considered art, many art pieces that can be considered industrial design, and a vast and ever-increasing number of projects that can fit comfortably into art galleries and design shows. For the purposes of this book, there isn’t much point in differentiating between the fields of interactive art, industrial design, interaction design, and traditional software engineering. Although these different fields might seem quite different from one an- other, they actually all share common goals. They all attempt to create objects and experiences for users, they use similar tools and processes, and they all share a common workflow that goes from sketch to prototype to final product to showing. You can think of a continuum, where at one end there are predictable and well-defined things that may be more suited for completing a task, and at the other end are more unpredictable and dissonant works that challenge and provoke us but may not be useful in our ev- eryday lives. There is a curious dance between art and design in interactive art that plays on the relationship between simplicity and complexity, usefulness and uselessness, and goals and open interpretations. Deciding which end of that spectrum is more interesting to you has a lot of bearing on how you think about the interaction, but it doesn’t change the code that you write or the way that you design your hardware. Making interactive art is quite different from making noninteractive art because the real object of interactive art is the situation. In painting, the object is the painting itself; in sculpture, it is the object and the space around it; in a video piece, the object is the video projection. In an interactive artwork, the object of the art is really the interaction between the viewer and the system that the artist has created. That system can be very technologically complex, it can have a single simple technical element, or it can have none at all. This book discusses artists and artworks that make heavy use of technology, what are often called new media artists, because they are artists who use or develop the tools that you’ll be learning how to use. I distinguish new media art from interactive art because projects that use programming (but that aren’t interactive) don’t have that key characteristic of being created in the situation where the viewer encounters them. There are many technologically sophisticated projects that use the tools covered in this book but that are not actually interactive. For the most part, this book covers artists who work with interactivity and projects that generate feedback in response to the actions of a user. One of the interesting challenges of working with interactive art is that the art can be truly useful and functional in many ways while still being art. You also have a great deal of control over the context of what that art is; an artwork can be viewed or experienced in any location that the user chooses, altered to become something unrecognizable, or used in a way that it was not intended to be used when it was first created. Many 16 | Chapter 1: Introducing Interaction Design
  • 41. designers are exploring what they call critical design, designed objects that not only function but exist to be thought-provoking as well, making users think in critical ways that are usually associated with art rather than with design. This overlap between the design of an object and the creation of an art experience is part of what makes inter- activity such a rich topic for artists to explore because you can open the realm of what a user can experience and explore in deeply expressive ways. Data Exchange and Exploration The task or goal that an interaction facilitates is as important as the way in which an interaction is carried out between a user and a system. Again, the types listed here aren’t being included to make a list of types of interactive work, but to show some of the common themes that run through interactive art and design and to help you get an idea of what you’ll be exploring in this book: Supporting data visualization Data visualization is an increasingly relevant theme given the amount of data that we as members of an increasingly information-centric society must process. A well- formed data visualization is a powerful tool because it lets a user not only com- prehend individual data points but also understand the relationship between what are called data points, detect patterns in the data, and even reconfigure and re- contextualize information. Data visualization accelerates the ability of the user to process and synthesize new information by not simply learning a fact but by lo- cating the fact within a discourse quickly. As the designer and writer Frank van Ham notes, “They should be massively col- laborative...not focus on analysis but on communication...it should be visual and end user driven.” The goal of data visualization is to generate, for the user, a view into data. This can be a view that will help the user understand the data better, as in the work of Ben Fry, where he creates beautiful diagrams that let a viewer more quickly and more fully understand the relationships between the objects in the data. His approach is informed by aesthetic considerations and by careful cognitive and psychological research. I Want You to Want Me by Jonathan Harris and Sep Kamvar retrieves data from online data sites and uses that information to generate interactive visualizations. While still data visualization, this piece is a far more dynamic and whimsical approach than the usual graph-and-chart approach used in standard visualizations, and yet it performs deep and meaningful data parsing and analysis. The interaction of the user can be a process of refining, exploring juxtaposition, mining new data, or storytelling. When designing data and the interaction with it, we must consider not only what data is presented, but also how users will interpret that data, what they might want to do with it, and how they would want to interact with it. Interaction is far easier when the view into data and the visual representa- tion of that view are clearly related. For instance, the visual representation of the Data Exchange and Exploration | 17
  • 42. data and the visual representation of filtering should be clear so that the user easily understands what is being filtered and how to change it. Organizing tasks Some interactions are interesting because of what they allow us to accomplish. The organization of tasks or actions or of discrete and discontinuous objects is the driving force behind much of the thinking in interface design. When you look back at the history of interfaces for machines and computers, you can see an evolution of organizing tasks, applications, information, and acts. The now ubiquitous desk- top model allowed the user to organize tasks in a way that leveraged both natural cognitive abilities, like the ability to organize things spatially, and a familiar motif for any office worker, namely, the desktop. One challenge for interaction design is to conceive of ways to effectively put work- ing spaces and organizational tools in places other than the traditional desktop environment. Computing is everywhere, and users want access to programs and data at more places. How to enable interaction on very small screens or with no screen at all is an increasingly relevant challenge given the environments in which users are interacting with environments. Some of the themes of exploration are how to develop novel desktop environments using new tools like multitouch screens, how to create tools for users to create their own interfaces to fit their needs at a particular time, and how to create interfaces for data visualization and tasks around data visualization. These types of interactive applications tend much more to practical and functional concerns, enabling users to complete tasks, organize information, and save infor- mation. This certainly does not mean that they need to attempt to replicate an operating system in functionality, but rather that they draw on that vocabulary of interaction. This can be used in somewhat more subversive ways as well, as with Adrian Ward’s Auto-Illustrator. Creating experiences Not all interactive designs need to rely on the traditional application model. In fact, one of the most common and powerful modes of interaction is what might be called the experiential model of interaction. These are often computer games, reactive drawings, or eye-catching graphic displays that engage and entertain without a set purpose. They often use novel connections between audio and visual stimulation and create either spectacles that entertain users or have entertaining interactions. The experiential interaction is very evident in the design of many kinds of computer games, where the user can play a character in the game and see the world through that character’s eye. Many times the interaction in these kinds of games is goal oriented, whether that goal be moving to the next level, killing enemies, or scoring points in some way or another. Many interactive installations use a similar model ofinteraction,wheretheinteractionisplayfulbutoftenlacksthegoal-drivennature of gaming and instead focuses on enabling the viewing of a spectacle or playing 18 | Chapter 1: Introducing Interaction Design
  • 43. with some engine that creates sounds or graphics. The goal of this kind of inter- action is often simply to entertain or engage. Both games and interactive installations often allow for fast switching between multiple views, perspectives, or models within the flow of the applications. This can be useful not just in gaming but also in an architectural fly-through, to show what a building will be like to walk through, or in data visualization. Gaming-style interfaces are also quite common, with first person views onto a 3-D world or with a 2-D view onto a world with the user controlling the view onto that world. These also often involve creating an environment that is reactive to user actions and in- dependently active when the user is inactive to create the illusion of a world. In- teractive installations or more playful and less task-oriented pieces will sometimes alsoinvolveinvertedmediums,whereonedrawsasound,asoundcreatesanimage, a physical object becomes a virtual one, or vice versa. Enabling collaboration between users The interactiveness of an art piece most certainly does not need to be driven by data or a virtual world; it can be driven by multiple participants in concert with one another. We can conceive of this in a very straightforward way, such as in a whiteboard collaborative application, or in an unpredictable and experimental way, where the input of one user is added to the input of the others in a way that can’t easily be anticipated. As with many of these topics, a range exists of predict- able and consonant works to unpredictable and dissonant works. Locative gaming where the game play is driven by the users’ locations is another kind of interactive application that uses collaboration between users to drive the interaction. Many network-based applications also use the model of collaboration between users to drive the interaction. The system in these kinds of interactions tends to facilitate communication and ensure that messages from one user are received by another instead of generating messages and feedback for a user like a single-player game. These applications can use chat-based metaphors or presence-based metaphors like some of the large multiplayer games that have become popular lately, or they can create a physical manifestation of each user. As long as the user has some indication of how many other users are interacting and how their actions are af- fecting the environment or those other users, the interaction can be very compelling. Controlling mechanics One of my favorite teachers, writers, and engineers, Tom Igoe, wrote, “Computers should take whatever physical form suits our needs for computing.” It is very lim- iting to think of computing strictly in terms of the computer itself and the tradi- tional interface to the computer, that is, the screen. In fact, interactive designs and artworks can be far more. With the Arduino, we can easily create computers that control machines out in the physical world. These machines can perform tasks as simple as turning lights on and off or as complex as the control of robotics. The machine can be controlled manually by a user or by many users, or it can be Data Exchange and Exploration | 19
  • 44. reactive, controlled by a program that dictates its responses in reaction to stimulus from users or viewers or from a physical environment. The control of mechanics can be very task-oriented with rigidly defined effects for each user action, or it can be very playful as in a collaborative application. In the latter case, the controls that the user has can be very loosely defined; that is, the user may have to play with the installation to discover the action that the control performs. In the case of task-oriented controls, the labeling and structure of the controls should be very clearly delineated. Using tools for performance and as performance An application can be used as a way of creating an aspect of performance, aiding aperformance,oraccentuatingaperformance.Youcanthinkofexamplesassimple as the modification of an electric guitar to projects as complex as completely new interfaces for musical development. An interactive application or tool is a means to a performance or interaction, driven by a performer or driven by the audience. Some of the most interesting uses of this mode of interaction involve sharing a control between the performer and the audience, though this does require some user training to ensure that the audience understands what they are supposed to be doing. These tools don’t have to be as conceptually simple as creating a new tool for a performer to use on a stage. They can allow users to create new elements in a performance, control objects from remote locations, or create performers out of the audience. Creating environments Many architects are beginning to explore what is called reactive architecture, the marriage of architectural practices with computing to create houses and environ- ments that react to users, environmental factors, and external commands. The model of a feedback system is quite important to this model of interaction. The environment needs to monitor itself using sensors or timers to know when to change its state and when to maintain its state. At the simplest, a timer can be used to tell a house to turn the lights on and off, a temperature sensor can be used to maintain a certain temperature, a motion sensor can detect presence, or a humidity sensor can be used to control a dehumidifier. However, by using more complex sensors and systems, you can track movement in a space by using tags, cameras, microphones, or wireless radios, and have a system use that data to make changes in the environment to make it more comfortable, to make it louder, or to configure it correctly. Many architects and technologists are designing spaces and buildings that can be configured with a command by a user to change the way a space is used or to make the space itself more interactive. These sorts of spaces are often called smart rooms or enabled architecture, and they are an important area of research for both architects and engineers. Computing doesn’t have to be limited to indoor spaces, though; outdoor spaces like parks, walking trails, squares, or streets can also be sites for interesting technological interventions that can be playful, helpful, or thought-provoking. It is important, though, to always consider the appropri- ateness of an application for the space in which it exists and how the user engages 20 | Chapter 1: Introducing Interaction Design
  • 45. that interaction. In a public space, this becomes especially important since a user should have the decision of whether to interact with it. Telling a narrative or story One of the more interesting themes beginning to emerge in interactive design is the notion of using interaction to tell a story or narrative. These sorts of works typically rely on the interface to allow the user to control the flow or direction of the narrative using techniques cribbed from data visualization or gaming. Despite using con- cepts familiar from gaming and visualization, narratives offer a different set of challenges more familiar to filmmakers and authors than to engineering concerns. Working Process The actual process of creating interactive work generally follows a combination of any of the following processes: Conception Conceptioncanconsistofsketchesinanotebook,adaydream,aproductorprocess of research or something developed in consultation with a client who wants the application for commercial purposes, or any combination of the three. You should try to map out in as much detail as possible what you would like the application to do, how the interaction should feel to the user, and the goals of the application. All projects will require research and planning of some kind. You shouldn’t let this suffocate you or stifle your creativity, but you should include it. Starting to sketch without a clear plan of what you’re doing can often lead to great and new ideas. For most people, I dare say that starting to write code without a clear plan of what they’re doing usually doesn’t produce something usable. Research When you’ve decided what you would like your application to look like and how you would like it to function, you’ll need to do the research on what components you might need and what libraries or existing code might be available that can help you create your project. If you need hardware, you should determine your budget for your application and determine which components you’ll need and how they fit into your budget. It’s important to ask questions either on forums or of collea- gues to ensure that the components or approaches you’re considering will work. Most projects will require different technologies, but almost all the requisite pieces will be available, or you will be able to leverage existing projects that have been created by you or by another artist or developer. Twenty years ago, this may not have been true, but it is now. Design The design phase is one of the more amorphous because it blends so easily into the research, conception, and actual building of your project. Sometimes you may not have a design phase, and sometimes all you will have is a design phase, depending on the requirements and nature of what you are building. At the very least, you Working Process | 21
  • 46. should define all the parts of your application clearly, have a clear vision of how they will appear to a user and how they will respond to a user, and understand exactly how a user’s action should correlate to an action by the system. It may help to create diagrams that show the flow of actions and responses from the user to the system and back. It may also help to create diagrams of different parts of the system and show how those will appear to the user, what the user might want to do with them, and how they relate to the interaction overall. You might not want to plan everything in your application, but the more that you can plan, the easier the actual building of your application will be. Build This is the process of actually putting together hardware and writing code. This is where you’ll write, debug, probably research some more, and ultimately assemble your application. Test Once you’re finished building your application, it’s important to test it. Testing can be as complex as creating situations for users to use your application and ob- serving how they use it, or it can be as simple as using the application or hardware yourself and ensuring that everything works. After testing, you might be ready to present your project by installing it or making it available for download. If your project is a piece of hardware, then you may be ready to prepare it for manufacture, if that’s your aim, or to place it in the location and environment that you mean it to be used. You’ll want to make sure that ev- erything works as intended before sending a project off, so having a good testing phase is important. Now that you’ve learned a little bit about what this book is about and the different ideas that you’ll be exploring, you can start learning how to code. 22 | Chapter 1: Introducing Interaction Design
  • 47. CHAPTER 2 Programming Basics Writing code is never extremely easy; however, it is also not as difficult as you might imagine. The basis of all programming is simple logic, and programming languages use lots of simple math symbols and English words. So, if you’re comfortable with things like equals signs, some very basic algebra, and a smattering of English words, you’ll probably do just fine. This chapter is by necessity far shorter than it could be. Learning all of the intricacies of writing code in even a single programming language, much less multiple languages, takes years of study. However, you can easily learn some of the basics, read documents, ask questions on user forums, and use what other people have created, and then find yourself able to create projects and designs within a short amount of time. With that in mind, this chapter is a simple introduction to the fundamentals that the rest of this book relies on. There are a few types of readers using this book. The first says, “I just want it to work.” For you, this chapter will explain just enough that you’ll be able to follow along with the examples in this book and the ones that you find online, and be able modify them slightly to get them to do what you need them to do. You’ll definitely want to read this chapter, probably more than once, but know that I understand your predicament. I was there once myself. You should know, though, that simply copying and pasting code with no understanding of what it’s doing is a very easy way to become seriously frustrated. A general understanding of at least the basics of what your code is doing will go a long way. Another kind of reader says, “I want it to work, and I want to know why it works.” For you, this chapter will be an introduction. You’ll probably read it, read some examples, and come back to this chapter again later. That’s a good thing. You’ll probably also want other books soon. Some of the best are listed in Chap- ter 17. Another kind of reader may be familiar with some material covered in this book but not others. For you, this chapter will probably be a review and may not even be necessary, but you might want to flip through it just in case you’re not familiar with the Processing or Arduino languages or some of basics of C++. If you are familiar with the basics of these languages, you might want to skip ahead to the chapters on the tools themselves or to Chapter 5 for some more advanced material on programming. 23
  • 48. Whichever type you are, you should read enough to understand what the code listings in the rest of the book describe. Why You’ll Read This Chapter More Than Once In all likelihood, the first time you read this chapter, some of it will not make sense. That’s perfectly normal and to be expected. As you read through the rest of this book, when you have questions, return to this chapter. There’s no substitute for seeing how code functions within the context of something interesting to you. Some of the ideas might not make sense at first, but after seeing them put into practice, being patient, and hacking at them, you’ll find that none of this is wildly complicated. Don’t be afraid when you don’t understand something, don’t be afraid to look back at this chapter, and above all, don’t be afraid to copy code from this book and change it until it breaks. Hacking atcode,takingstuffthatworks,breakingit,andthen figuringoutwhyitbreaks is the best way to understand. Of course, the goal throughout this book is to try to provide code that will just work and thereby satisfy the first kind of reader, those of you who simply want it to work and be done with it. In either event, though, this is going to require some patience, because it simply won’t make sense the first time through. With a little bit of patience, though, and the willingness to experiment, fail, and try again, you’ll find that this isn’t all that difficult. The Nature of Code Throughout this chapter, you’ll be learning about programming—writing code, to be more exact—so it’s important to know not only what code is but how it fits into the process of creating a program. There are a few key terms that you should understand before starting to program: Code Code is a series of instructions that a computer will execute when the code is run. It is written in a programming language that, like natural languages, is essentially a contract between two parties. In the case of code, though, the two parties are the programmer and the compiler. You’ll learn more about a compiler shortly; for the moment, we’ll just think of it as the listener who understands our code. Code can be as simple as adding two numbers or as complex as rendering an animation. What matters is that you write correct instructions to the compiler using a pro- gramming language and a text editor of some sort and then tell the compiler what files contain the instructions. Writing code is typing code instructions into a text file that will later be passed to a compiler of some sort. To write a program can mean writing source code from scratch, or it can mean putting several programs together and creating a way for them to communicate. This can also mean config- uring prebuilt projects. Creating applications and code doesn’t always require 24 | Chapter 2: Programming Basics
  • 49. writing code, but if you have this book, then you’re probably interested in creating code. Files Code is stored in text files that usually any text editor can open. These files contain your code and nothing else. For larger and more complex projects, you can link multiple files together. Sometimes, larger projects will have many hundreds of code files that will all be linked together to create the sum of the code for the application. Arduino projects use .ino files and sometimes .c files. Processing projects use .pde files and sometimes .java files. openFrameworks projects use .cpp and .h files. In each case, the different file types do different things and have different purposes that you’ll learn more about later in this book. Compiler A compiler is a program that takes a code file (or many code files) and turns it (or them) into a series of instructions that a computer will run as a program. Most modern computers do not directly process any instructions that you write; instead, you ask a compiler to turn your code into machine instructions. The compiler optimizes machine instructions for the computer to run very quickly, but they would be very difficult for a person to write, so the better step is to write code in a more human-friendly way and convert it to machine-friendly instructions. This means that when you write code for an Arduino controller or write some Java code, you don’t simply run that code; you compile it and have the compiler create an executable file that your computer can run. You can imagine the process of writing code as a series of translations in which you tell the compiler what you want to do with the program that it will create in a high-level programming language like Processing or C++ and the compiler then creates a machine language file that will run that file. Executable An executable is a file that can be run as an application. It is the result of writing code and compiling it. Sometimes the terms application and executable are used interchangeably, but they’re not the same. An application may consist of many executable files, or it may consist of only one. In either case, for the kinds of projects you’ll be learning to build in this book, you’ll always have an executable. Now you’re ready to get started writing your own code. Variables Looking at variables is a good place to start. Everyone remembers variables from their first algebra classes. You might have seen something like this written on a blackboard or whiteboard: x = 5 Variables | 25
  • 50. That says, “There’s something called x, and it is equal to the number 5.” Variables in computing are very similar. They represent something, and in fact they always represent a certain kind of something. That’s a little different than the algebra example because that example didn’t need to say that x is going to be a number; it just says, “x is a number.” If you wanted to use code to make a number called x and use it as a variable, you would do it like this: int x; The int indicates (or sets) the type of the variable. You can’t just make any type of variable; you have to make specific kinds of variables. The kind of variable is called its type; types are dealt with a lot more in the next section, so for right now, let’s concen- trate on getting the basics of variables down: int x = 5; This code creates a variable named x that is an integer and has the value of 5. What this means is that somewhere in your computer’s memory there is something called x that is storing the value 5. You can set the value of x right away, as in int x = 5, or create it and leave it for later use, as in int x. Look at another example: int y = 10; int x = 5; int z = x + y; This snippet shows some code that creates variables, gives two of them values, and sets a third variable’s value to be the sum of the first two. Simple Types In the platforms covered in this book, all variables are typed. This means that they have a type that tells the computer what sorts of things are going to be stored in the variable. This is because numbers, letters (usually called characters), and true/false (called Boolean values) all require different amounts of space to store and move around. Here are some of the most common types that you’ll encounter in each of the pro- gramming languages in this book. int This is the datatype for integers, which are numbers without a decimal point, like 2 or 20,392. Now, we’re about to run into our first real problem in this chapter: there are three programming languages used in this book; they all have similar things, but they sometimes work just a little bit differently. In Processing, integers can be as large as 2,147,483,647 and as low as -2,147,483,648. In Arduino and C++, the languages that openFrameworks (oF) uses, things work a little differently, and understanding why requires a quick explanation of signed and unsigned variables. The next small section explaining signed and unsigned variables might be a bit heavy at first, so you may want 26 | Chapter 2: Programming Basics
  • 51. to skim over it the first time, particularly if you’re more interested in working with Processing. Signed versus unsigned As mentioned earlier, variables need to be declared with a type because the computer needs to know how much space they will take up. That means that sometimes an int is 4 bytes or 32 bits of information all the time and that it can store 4 bytes worth of information. So, what happens when you need a negative int? Well, you have to store whether it’s negative or positive, and the way you do that is by moving all the values of the int down into the negative values. For the moment, you’ll see how this works in C++, the language that oF uses, and then the rest of the languages will be addressed. In C++, where the int represents a value in between -2,147,483,647 to 2,147,483,647, if you have an int that is never going to use a negative number, you can use an unsigned int that stores anything from 0 to 4,294,967,295. This is what’s called having signed or unsigned variables. Unsigned variables don’t store negative numbers, whereas signed variables do. The way this works requires a little bit of thinking about binary numbers. An int is 32 binary values. Binary counting uses 1 and 0 to count instead of 0 through 9 like we’re used to doing. This means that when you want to set a variable to 1, you’ll actually be storing the value 1 in the place where the variable is stored. When you want to store the value 2, you’ll be storing 10, which means 1 in the 2’s place and nothing in the 1’s place. Additionally, 3 is represented as 11, which means 1 in the 2’s place and 1 in the 1’s place, for 2+1, which is 3. Further, 4 is represented as 100, which is 1 in the 4’s place and nothing in the 2’s or 1’s place. Therefore, 16 is 1,000, 17 is 1,001, 18is1,010,andsoon.Thisiscalledtwo’scomplementmathbecauseitcountseverything up by squaring for the next value. That’s a very quick introduction to binary math, but don’t worry, there’s a much more comprehensive discussion of this several chapters later in this book where you begin using bits and binary. Figure 2-1 shows the ways that signed and unsigned variables work. Remember that in C++ the int is 32 bits, so there will be 32 boxes to show what each bit stores. In unsigned numbers, the first bit is counted like any other bit. In signed numbers, the first bit is used to store whether the number is positive or not, and this is why unsigned variables can store larger values than signed variables. Arduino and C++ use unsigned variables, and all variables are signed unless you indi- cate otherwise by putting unsigned in front of the variable type: unsigned int = 5; Processing does not use unsigned variables; all numerical variables in Processing are signed. In C++, the language you’ll use with oF, signed ints are −2,147,483,647 to 2,147,483,647, and unsigned ints are between 0 and 4,294,967,295. In Arduino, the int can be between −32,768 to 32,767. Tricky? Not really. Lots of times you won’t have Variables | 27
  • 52. to think about what you’re storing in the int. When you do have to think about how large the value you’re going to be storing is, it’s time to use a bigger number type, like long or double. We’ll discuss these later in this section. When using Processing, you never have to think about how large the value will be at all, so it isn’t a problem. Simply figure out whether you’ll need a decimal point. If you do, then use a float; if you don’t, then use an int. float The float is the datatype for floating-point numbers, which are numbers that have a decimal point. Floating-point numbers are often used to approximate analog and con- tinuous values because they have a greater range of values than integers. Signed float variables can be as large as 2,147,483,647 and as low as −2,147,483,647. Float variables aren’t signed in C++ or Arduino. char This type can contain characters, that is, single letters or typographic symbols such as A, d, and $. Here are two char variable declarations: char firstLetter = 'a'; char secondLetter = 'b'; So,whatisdifferentaboutfloats,ints,andchars?charvariablescansometimesbeadded together like numbers, but it’s not going to work the way you think it will. When working with Processing or Arduino, it’s not going to work period, and with C++ in openFrameworks it will work, but not as you might expect: Figure 2-1. Setting the bits of signed and unsigned variables 28 | Chapter 2: Programming Basics
  • 53. char thirdLetter = 'a' + 'b'; // this won't become 'ab' or 'c' Like I mentioned earlier, Processing and Arduino aren’t going to like this at all. They’re just going to throw errors at you and complain. C++, however, will work, and the next section will explain why. ASCII Thereareafewwaysthatcharactersinacomputerarestored,andonewayisasnumbers in a system called American Standard Code for Information Interchange, or ASCII. In ASCII, a is 97, and b is 98. That’s why if you run the following snippet of code through a C++ compiler or through Processing or Arduino, it’ll happily say that c is 195: char a = 'a'; char b = 'b'; int c = a+b; // notice that a+b is being stored as an int You can store the result of two characters being added together if you store the value of the result as an int because adding the characters together is really adding the numbers that they are stored as together. All keyboard-related things can be stored as a char. That includes particular keys on the keyboard. These are called character escapes, and they have a particularly special place in programming because this is how you determine when the user has clicked a key that can’t be represented with a letter or number. There are other encoding systems that correlate numbers to letters, Unicode Transformation Format, or UTF, is a very popular one that you might hear mentioned. Encoding is a complex topic and the most important thing to understand is that the char is both a number and character. bool or boolean Boolean values store two possible values: true and false. In C++ and Arduino, the true is actually a 1, and the false is actually a 0. It’s usually clearer to use true and false, but you can use 1 and 0 if you like. They’re very handy for storing very simple results: you received a message from the server or you didn’t, the user clicked the F key or they didn’t. For Arduino and Processing, you do the following: boolean b = true; In C++, you do this: bool b = true; Note that the Processing and Arduino version uses the word boolean, while C++ uses the word bool. Both true and false are reserved words. That means that the compiler only recognizes them as being values that you can use to set Boolean variables. This means that you can’t, for example, do this: Variables | 29
  • 54. boolean true = false; It will cause errors, which is something that, although unavoidable, you generally want to restrict to more interesting things that will help you create your projects. string A string is a sequence of characters. This is both a helpful, metaphorical way to think about it and a matter of fact, and it is something that you’ll investigate more closely later. The string includes helpful methods for looking at individual characters, com- paring strings to see whether they’re the same or different, searching strings for parts of the string (for example, finding “toast” in “toaster”), and extracting parts of strings (getting “toast” out of “toaster”). The differences between a string and a char is that a string is always defined inside double quotes ("Abc") and can consist of multiple char- acters, while char variables are defined inside single quotes ('A') and can consist of only one character. Here are some strings in Processing: String f = "foo"; String b = "bar"; String fb = f+b;// this will be "foobar" Here are some strings in C++: string f = "foo"; string b = "bar"; string foobar = f+" "+b;// this will be "foo bar" note the space w/in quotes Note that Processing uses String, while C++ uses string. Why isn’t there any Arduino example? Arduino doesn’t have a String or a string, because it doesn’t need one. We’ll have to leave the explanation for this until the next section. Suffice to say, it’s not a huge problem. Since a String is defined within quotes: String super = "super"; including quotes in a String requires the backslash character to be used preceding the quote: String quoted = "He said "It's super"." This is known as an escape sequence. Other escape sequences include t for the tab character, which is written t with the escape character, and n for newline, which is written n. A single backslash is indicated by because without the in front, the compiler would think that you’re writing an escape sequence. If you wanted to write the characters that’s great!, you’d write this: String quoted = "that's great!"; Otherwise, without the double backslash, you’d end up with this: " hat's great!" 30 | Chapter 2: Programming Basics
  • 55. Other documents randomly have different content
  • 56. "It's beastly weather, that's true enough!" cried Chicotin; "and cold! why, my nose and fingers are frozen stiff. But it ain't very warm in your room either, bourgeois; bigre! it's just the same as being on the boulevard." "Well, stir up the fire, put on some wood." "I ask nothing better." Chicotin looked in all directions, then went into the outer room, and returned in a moment, saying: "There's one little difficulty, bourgeois, and that is that I don't find any wood; the wood pile seems to have gone up in smoke." "Already! the devil! the wood seems to go faster than the sugar!" "Oh! that's easy to understand—it's dearer, because—look you, bourgeois, here's a comparison: for fifteen sous, you get three or four sticks of wood; they're bigger than a pound of sugar, to be sure, but they're very soon burned up; in one day they're all gone; whereas, with a pound of sugar, you've got something to lap and sip for a long while!" "I'll do without fire," said Roncherolle. "Lying in bed, I don't need it, and my little neighbor is going away." "What a bungling fellow you are, Chicotin!" said Violette to the young messenger, in an undertone; "you shouldn't have said anything, but when you saw that there wasn't any wood in the other room, you should have gone up to my room; you would have found some there. You know that Monsieur de Roncherolle isn't willing that anybody should lend him anything, so we must help him without letting him suspect it; and I don't propose that he shall stay without a fire." "That is true, I am an idiot!" muttered Chicotin, shaking his head; "but bless my soul! I couldn't guess all that. Never mind, don't worry, I'll fix it all right; I'll find some way to make a fire." "Monsieur," said the girl, returning to the invalid, "if I remember right, the doctor who came to see you yesterday prescribed medicine for your gout." "Doctors don't know of any remedy for this disease, my neighbor; several of them have told me this themselves when talking with me." "Nonsense! I have been told of several people who were entirely cured; and I remember now—it was syrup of Boubée that he told you to take." "That is quite possible."
  • 57. "I beg you, monsieur, take some of it; even if it should do nothing but lessen the pain, would that not be a great gain?" "As you insist upon it, I will take some." "If you are willing, monsieur, I won't stay long in my booth to-day, and I will bring you some in a little while when I come home." "No, no, my little neighbor, I won't have it; for you never tell me the price of things; you manage so that they cost me almost nothing. But I don't propose to have that, and I shall be angry if you go on acting in that way; I shall be obliged to deprive myself of the pleasure of seeing you." "Oh! it wouldn't do any good for you to forbid me to come, monsieur; I should come all the same!" Violette said this with such heartfelt earnestness that Roncherolle felt the tears gather in his eyes. He pressed the girl's hand and replied in a cheerful tone: "I will obey you, neighbor; come, Chicotin, my groom, come here." "Here I am, bourgeois." "Go to the druggist's on the corner of the boulevard, and ask for some syrup of Boubée. Will you remember that name?" "I should say so; it isn't hard to remember. Syrup of Poupée." "Boubée, you idiot! not Poupée." "Oh! very good." "Wait; I prefer to write it for you." "On the whole, that will be better; my tongue might slip again." "Here you are; and take that two-franc piece there—upon my table; I am inclined to believe that that will be enough." "Let us hope so! a paltry syrup—that can't cost so much as that; for two francs you could get a lot of molasses.—I will go right away, bourgeois." "Aren't you going to your stand, my little neighbor?" Roncherolle asked Violette, who was stooping in front of the fire, trying to make the two sticks burn by putting under them all the old papers that were lying about the room. "In a minute, neighbor; I will wait until Chicotin comes back." "And your love-affairs, my child, how do they come on? You are fully reconciled with your young lover now, I hope?"
  • 58. "Yes, monsieur. Oh! Georget loves me dearly; he comes to see me every day at my booth, and I am very happy, except when he frightens me." "What's that? your lover frightens you?" "You will understand, monsieur; Georget has never forgotten the abominable remarks that that Monsieur Jéricourt made about me, and the trap he led me into; but, monsieur, you don't know—Georget says that he will kill Monsieur Jéricourt." "He is right; he is a fine fellow; in his place, I would do the same." "But I don't want him to fight; for, after all, monsieur, the man who is in the right doesn't always win; and if Georget were killed, I should be very unhappy." "You are right; that boy must not take the risk; he is so young—eighteen, did you tell me?" "Yes, monsieur." "Then he probably doesn't know anything about the sword or the pistol?" "Nothing at all; he would be killed instantly." "Patience, my little neighbor. Corbleu! if only I could get well!—But I hear Chicotin, I believe." The young messenger returned with a sheepish expression, holding the two-franc piece in his hand. "Well, where is the syrup, Chicotin?" asked Roncherolle. "The syrup is at the druggist's, monsieur." "What do you mean by that?" "I mean that it's an outrage! Just fancy that a little bottle no bigger than my wrist costs twelve francs!" "Twelve francs?" "Yes, monsieur, syrup of Poupée twelve francs, no less; it wasn't any use for me to say: 'Put me up forty sous' worth in a little pomade box'; he laughed in my face and told me they didn't sell it at retail; he showed me a bottle, all sealed, with the price on it. Then I said: 'If the gout can only be cured at that price, only rich people can be cured!'—'Only rich people have the gout,' said the clerk. I say, bourgeois, that's nonsense, ain't it? For it seems to me that you're none too well fixed." Violette nudged Chicotin, saying in an undertone:
  • 59. "You ought to have said that the syrup wasn't ready, and I would have gone out and bought it and paid for it without letting Monsieur de Roncherolle know the price." "He would have found it out all the same, mamzelle, for the price is pasted on the bottle; it wouldn't have been possible to deceive him, and how he would have sworn then!" Roncherolle had dropped his head on the pillow, and said nothing more. Chicotin handed him the two-franc piece, saying: "Shall I buy anything else with this, bourgeois?" "You may buy some wood, my boy, and make a fire; but not until evening; for my little neighbor comes to sit with me in the evening, and I don't want her to freeze in my room.—Now leave me, my children; I don't want anything more, and I am going to try to sleep." Violette pressed the invalid's hand and went out, with a feeling of oppression at her heart; Chicotin followed her, muttering: "Poor dear man, not to be able to buy what might cure him; it ain't very gay here; but never mind, I will come back soon and see if he wants something else that don't cost so much." "And you won't spend his two francs, will you, Chicotin? you must get some wood in my room." "Yes, mamzelle, but what shall I do with his money? I can't give it back to him." "Keep it; it will serve to buy something else which may be dearer still; and you mustn't tell him, as you did to-day. To think of his being without a fire, in such cold weather, and when he is suffering so! for to-day I could see on his face the efforts he made to conceal his suffering; why, it makes me want to cry!" "After all, Mamzelle Violette, you mustn't feel so bad for somebody who ain't anything to you." "Oh! he is so wretched, without relations, or friends, sick and poor; and then there are people for whom you feel affection right away; and Georget won't be jealous of him; I feel that I have a sincere affection for him." "I am going to see if Mirontaine is cured, and if Madame Lamort can go up."
  • 60. Violette had been at her stand for some time, when Monsieur de Brévanne came there and inquired about her neighbor. The girl gave him an exact description of his plight; she concealed nothing from him, neither his suffering, nor the privations which he was obliged to undergo, nor the pride which made him refuse any assistance in the form of money. "He has no fire now," said Violette, her eyes wet with tear; "and he isn't willing that we should make him one before evening, because I go to sit with him in the evening, poor man! and he did not have the money to buy something that might perhaps have cured him.—Ah! he is very unfortunate!" The count listened attentively to the girl's story; Roncherolle's position touched him more than he chose to show. He stood for some time buried in thought, then he said to Violette: "I would like to judge for myself of this gentleman's plight, of his situation, but I should not want him to see me." "That is very easy, monsieur; in the first place, Monsieur de Roncherolle never leaves his bed, and a person can stand in the outer room and look into the other without his seeing him; in the second place, he often sleeps, and I am always careful not to wake him." "Well, I will go this evening, I will go to see you, with Georget." "Oh! how kind it is of you, monsieur! I am very sure that you will have compassion on my poor neighbor." "On your account—it is possible.—But not a word concerning me, my child!" "Oh! I am dumb, monsieur; but I am very glad that you are coming to see my neighbor." About eight o'clock in the evening, Violette was installed in Roncherolle's room; he had been dozing for some time, and when he woke, his eyes met those of the young girl, who, as she mended her neighbor's linen, glanced at him often to see if he were asleep. "Really, my dear child," said Roncherolle, "your kindness to me fills me with gratitude, and reconciles me to your sex; for, if I must admit it, I had but a very slight esteem for women." "Why so, monsieur? have they injured you?"
  • 61. "Not exactly; but they are responsible for my having injured others, and that amounts to the same thing." "Why no, monsieur, if they didn't advise you to do it." "They do not need to advise us to make fools of ourselves; they lead us into it easily enough without that." "I don't understand, monsieur." "So much the better for you, my child.—But what are you doing there? God forgive me, I believe that you are patching my rags!" "Well! I had nothing to do, and I like to be busy; I thought that it wouldn't offend you if I should take a few stitches in your linen." "Offend me! ah! my dear girl, you are too kind to me; one does not take offence with those who are so kind to them. Ah me! when I think——" Here Roncherolle paused and heaved a profound sigh. Violette looked up at him and said: "What are you thinking about, monsieur, that makes you sigh so? You mustn't think of melancholy things when you are sick." "I am thinking, my dear child, that I might have with me—my own daughter,—who, however, I am sure, would take no better care of me than you do." "Your daughter! what, monsieur, you have a daughter, and she is not with you when you are ill and suffering!" "If she is not with me, it is not her fault,—it is mine." "Ah! then it is you who have sent her away, and she is not in Paris, of course?" "No, she is not in Paris." "Why don't you write for her to come, to join you?" "I don't want to disturb her." "How old is your daughter?" "Nineteen." "Why, that is just my age!" "Ah! you are nineteen? And what about your parents? I never see them with you. But I remember now, that you told me that you had lost them." "I never knew my parents, monsieur; I am an abandoned child!"
  • 62. "Abandoned! is it possible? what a strange coincidence!—Were you abandoned in Paris?" Violette, remembering the count's injunction, replied hesitatingly: "Why—I don't know, monsieur; I—I think so." "Poor child, what a pity! her parents do not realize what a treasure they cast away." Roncherolle buried his face in his pillow, murmuring: "But my child—I do not know her; perhaps she too is lovely and good! ah! if I could only find her! But no! why should I wish to? to force her to share my destitution?—No, it is better as it is." The invalid dropped asleep. Violette was anxiously awaiting that moment, for she had heard noises in the outer room for several moments, and she guessed who it might be. As soon as she was certain that Roncherolle was asleep, she arose and softly opened the door of the other room, where she found Monsieur de Brévanne and Georget. "My neighbor is asleep; you may come in, monsieur," said Violette to the count. "You are quite sure that he is asleep, my child?" "Yes, monsieur. You can tell by listening to him, his breathing is so difficult. Poor man! it seems that he has suffered terribly all day, and he is taking advantage of a little respite from pain, to rest." "But you were talking just now." "Yes, monsieur.—Oh! if you knew—he has a daughter, the poor man, and he said that he bitterly regretted not having her with him." "Oho! he spoke to you of his daughter, did he?" "Yes, monsieur; can you imagine that she does not come to take care of him, her father, when he is sick?" "Did he tell you why she was not with him?" "No, monsieur; he simply said that it was his fault.—But come in, monsieur; he is sound asleep." "Yes, I will come in. Stay here, my child, and talk with Georget; but don't talk too loud." "No, there's no danger of that, monsieur," said Georget; "we understand each other perfectly well simply by looking at each other."
  • 63. The count entered the room occupied by Roncherolle. A single tallow candle, which was badly in need of snuffing, lighted that room with a dim, uncertain light; it enabled the visitor, however, to distinguish a cheap wall paper, torn or lacking altogether in several places; a window with large cracks, and without curtains, in which one pane was broken, its place being ill supplied by paper; two or three pieces of cheap black walnut furniture; a painted cot, on which was a coarse flock bed and a very thin mattress; on the mantel, a small mirror in a wooden frame, and on the hearth two tiny bits of wood, which were hardly burning. Everything in that abode indicated poverty and privation; and the cold that one felt there, the wind that one could hear whistling in all directions, heightened the melancholy impression which one was certain to feel at finding an invalid in such a place. Monsieur de Brévanne noticed and scrutinized everything; then he walked to the bed and gazed at Roncherolle, whose features were more than ever changed by suffering and want, and who, even in his sleep, seemed to be struggling with pain. "The wretched man!" said the count to himself; "is this what the future seemed to promise him? Endowed with every advantage, possessor of a handsome fortune, this is what his passions have brought him to!—It is all over; I can think no more of the vengeance which I was determined to wreak upon him; heaven has undertaken that duty; and besides, I should not have the courage to deprive Violette of her father; I do not know whether men will blame me, but something tells me that the time has come to forgive." Roncherolle moved in his sleep, and the count instantly left the room and joined the two young sweet-hearts, who had not found the time long. "Well, monsieur, you have seen him," said Violette; "is he really the man whom you used to know?" "Yes, my child; but not a word about my visit!" "Oh! have no fear, monsieur." "Come, Georget, let us go." Georget considered that he had had very little time to talk to Violette; but he dared not make any remark, and took his leave with the count, after exchanging a loving pressure of the hand with his sweetheart.
  • 64. The next morning, about nine o'clock, Violette was in her neighbor's room once more; he was feeling a little better, and was telling her about a strange dream he had had, when Chicotin arrived, bringing with him a letter, which he handed to Roncherolle. "For you, bourgeois; it just came, so your concierge told me." "Who can have written me? I don't know this writing," said Roncherolle, as he broke the seal. But in an instant, he uttered a cry of surprise. "My children, you could never guess what this letter contains; listen. "'Monsieur: "'One of your debtors, Monsieur de Juvigny, has instructed me to send you a thousand francs on account of what he owes you.' "Signed—the devil take me if I can read it—Dubois or Dubosc.—But the thousand-franc note is inside all right; here it is!" "Ah! what good luck, monsieur! how happy it makes me for you!" said Violette. "Name of an—excuse me, bourgeois, but I am so glad that I brought that letter for you!" "Thanks, my friends, thanks, I am trying to remember—Yes, Juvigny did owe me money—I can't remember just how much; but when I inquired about him a few months ago, I was told that he was travelling." "He must have sent word to this person to send you this sum, monsieur." "Faith! I hardly expected this restitution. The money arrives most opportunely, but I can't get over my surprise!" "You see, monsieur, that I told you that your dream meant good luck." "You can buy all the syrup of Poupée that you want now, bourgeois." "Yes, my boy, and my little neighbor will be kind enough to do that for me, and change this note. Here, my dear, is the note, here's the thousand francs which seems to have fallen from heaven!" "Ah! I have a strong suspicion where it fell from, myself!" thought Violette as she left the room.
  • 65. XLII THE PIE Ten days after the receipt of the letter containing the thousand francs, Roncherolle was walking on the boulevard, alert and active, feeling not a trace of his gout, and wrapped in a warm, stylish overcoat, with a new hat on his head, patent leather shoes on his feet, in a word, dressed with a care and elegance which changed him completely and made him look almost like a young man. In front of the Gymnase Theatre, Roncherolle felt a hand on his arm, and he turned and recognized his former neighbor, young Alfred de Saint- Arthur. "Ah! good-morning, my dear monsieur, delighted to meet you!" "Good-morning, my dear Monsieur de Roncherolle. I can no longer say my neighbor, for you are not my neighbor now. You went off like a bomb without telling me, without leaving me your address; that was very unkind. That idiot of a Beauvinet,—you know, the young man at the hotel,— insisted upon it that you lived at Passage I-don't-know-where. Ah! that was a good one! that was very good!" "You didn't try to find me at that place?" "Oh, no! I wasn't taken in by that blockhead of a Beauvinet. I said to myself: 'My neighbor must have had reasons for moving and not leaving his address; such things happen every day, and indeed I think that it may happen to me very soon.'—But I regretted you all the same; on my word of honor I regretted you." "That is too kind of you." "But there was someone who regretted you much more than I did. Can't you guess?" "Faith, no." "It was Zizi—you know—Zizi Dutaillis." "Oh, yes! I remember perfectly—a very agreeable little woman."
  • 66. "Well, you made a conquest of her. Every day she said to me: 'Do find Monsieur de Roncherolle; invite me to dine again with Monsieur de Roncherolle; I want him to teach me other ways of—you know what.'—In fact, I never see her that she doesn't talk about you, and if you were younger and—and—and fresher, I should be jealous of you." "Thanks, thanks, a thousand times!" "By the way, allow me to congratulate you; you walk very well; have you got rid of your gout?" "For the time; it has held me pretty tight this fall." "And you have a bearing, a style—that coat you have on is very well- made, very well-cut, and of handsome cloth; is it wadded?" "As you say." "On my word of honor! I don't say it to flatter you, but in that overcoat you look ten years younger!" "In that case I am very sorry that I have only one." "By the way, let me tell you that I have profited by your lessons—you know, the way to drink champagne,—two glasses, one on top of the other, in a plate." "Yes; well?" "I have succeeded, I can do it; to be sure, I broke a dozen glasses, but I succeeded; your pupil does you credit." "I never doubted your ability—to drink champagne." "And that isn't all: you know my parrot, that I was teaching—the one that led to our becoming acquainted?" "Yes, I remember him; is he dead?" "No indeed; he is as well as you or I. But the delightful part of it is that I have succeeded again." "Really, you have made great progress since we last met." "My parrot says now what I wanted him to." "That was 'Good-morning, Monsieur Brillant,' I believe?" "No, deuce take it! he said that too much! He says—and only since yesterday, so you see that it isn't an old story—he says: 'Dutaillis is lovely! applaud, clap Zizi!'" "Ah! if he says all that, it's very fine; your friend must be enchanted."
  • 67. "I haven't given him to her yet, because it was only yesterday that he said the whole sentence; and you understand that, before giving him to Zizi, I wanted to be certain that he wouldn't make a mistake, that he wouldn't make a slip of the tongue." "That was decidedly prudent on your part." "By the way, an idea, a splendid idea has just occurred to me!" "The deuce! try to hold on to it." "You must be kind enough to dine with Zizi and me. In the first place, you owe us more lessons in champagne drinking." "Really, you are very tempting, but——" "Listen: during the dinner, I will have my parrot brought in, in—no matter what, I will find something—and he will deliver his compliment to my wife; you know we say 'my wife' now in speaking of a mistress, and she says 'my husband.'" "I didn't know that, and I confess that I should prefer anything else." "And what do you say to my idea about the bird? Fancy Zizi's surprise when she hears a compliment, and doesn't know where it comes from!" "Why yes, that may well be amusing." "Then it is agreed; we will dine together the day after to-morrow. Yes, two days more, and then I shall be very sure that my parrot won't make a mistake. Just we three will dine together, to laugh as loud as we please, and talk nonsense; and at Bonvalet's as before. You agree, do you not, my dear neighbor? I say 'my dear neighbor' from habit." "Excuse me, my dear Saint-Arthur, your invitation is certainly very kind, but——" "Oh! no buts! Zizi will be so pleased to dine with you again! you can't refuse." "I accept, but on one condition." "Well, what is it? Speak; I agree to it in advance." "Well, it is that your friend, Monsieur Jéricourt, shall also be of the party as before." "The deuce! you surprise me! you want Jéricourt to be one of us? Why, I thought that you didn't like him."
  • 68. "I say again, if you wish to have me, have that gentleman too; I have a special reason for wishing to meet him." "That makes a difference; in that case, I will invite him; he shall be one of us. I have not seen so much of him lately. He lives in the Chaussée d'Antin. He puts on a lot of airs because he has had a play accepted at the Odéon.—But no matter, he will come." "Don't mention me to him; I fancy that that would make him disinclined to come." "I will mention nothing but the bird to him." "What I ask you will not annoy mademoiselle, I hope?" "Annoy her? why, pray? She will worry Jéricourt, and we will laugh at him.—I may rely upon you now, may I not?" "Absolutely." "Until the day after to-morrow then, at half-past five, at Bonvalet's." "I shall not fail you." Saint-Arthur shook Roncherolle's hand and left him; Roncherolle continued his walk, but more slowly, like a person too much engrossed to notice what is going on about him. On the second day thereafter, about five o'clock in the afternoon, Roncherolle, who had taken much pains with his toilet, walked toward the booth of the pretty flower girl of the Château d'Eau. Violette greeted her neighbor with a pleasant smile, saying: "Ah! what a pleasure it is to see you like this, monsieur! how well you look! no one would ever suspect that you had been so sick." "If I have recovered my health, it is due to you, my dear child, due to your nursing, to your pleasant company." "Oh! monsieur, you forget that syrup which did you so much good, which cured you." "Perhaps the syrup may have had something to do with it, but you had much more." "Are you going to walk, monsieur? It is cold, but fine." "I am going to dine out, my little neighbor; a feast at Monsieur Bonvalet's, nothing less."
  • 69. "Oh! do be prudent then, monsieur; they say, you know, that with gout you mustn't drink champagne." "But I no longer have the gout." "True, but suppose that should bring it back again?" "We mustn't anticipate misfortunes so far ahead. However, I will be prudent, and in order that I may not forget your advice, I will ask you for a small bunch of violets." "With pleasure, monsieur.—See, is this one big enough?" "Quite big enough; be kind enough to fasten it tight into my buttonhole." "Gladly; there, now it is done, and I promise you that it won't come out. —That is very nice! you look as if you were my true knight now." "And so I am, my child," replied Roncherolle, emphasizing his words, "and I hope to perform the duties of the post." "Why, how solemnly you say that!" "Au revoir, my dear neighbor, au revoir!" The young flower girl looked after Roncherolle, overcome by an emotion which she could not understand, and still murmuring: "How he said that! I will bet that he has some purpose in wearing that bouquet in his buttonhole." Meanwhile, Roncherolle, who did not propose to keep the others waiting, soon arrived at Bonvalet's, where he found the young actress and Saint-Arthur. Mademoiselle Zizi expressed all the pleasure that she felt at renewing her acquaintance with the professor of champagne, and said to him, scrutinizing him from head to foot: "Why, how fine we are! how coquettish we are! we walk almost without limping, and we have such a chicarde air!—you look after yourself, you do, whereas Alfred takes no care of himself at all." "What's that? I take no care of myself?" "No, monsieur; your cravats have been wretchedly tied lately, and your trousers don't fit as tight as they used to." "They are not worn tight now." "If I want you to wear tight ones, why it seems to me that you ought to adopt my taste.—Ah! what a pretty bunch of violets you have there, old
  • 70. fellow! where did you get that, you old Cupid? From some charmer, I will wager!" "It is true that I got them from a charming young girl." "Aha! give us the story; tell us all about it." "I will tell you about it, but not now; at dessert, with your permission; it will have all the more charm." "All right, at dessert it is. By the way, so you wanted to dine with Jéricourt, did you? When Alfred told me that, I confess that I was mightily surprised, you agreed so badly the other time. I said to myself: 'There's something underneath this; Monsieur de Roncherolle has invented some practical joke, some farce that he proposes to play on him;' am I right?" "I don't say no; but don't ask any more questions; I am keeping that also in reserve for the dessert." "Well, well! it seems that we shall laugh at dessert." "Yes, yes," said Saint-Arthur with a meaning glance at Roncherolle. "Oh yes! our dinner will be most amusing, and we shall laugh, I trust, at dessert. We shall have some surprises, some unexpected incidents." "What on earth is that idiot talking about? He assumes a mysterious air. Frefred, I have an idea that you have some gallant attention in store for me —is it true, my adored one?" "I can't tell you anything; you will see!" This conversation was interrupted by Jéricourt's arrival. That gentleman seemed surprised at sight of Roncherolle; however, he manifested no annoyance, and saluted the party with a smile. "Aha! Jéricourt doesn't keep us waiting to-day; that is magnificent!" cried Zizi; "but something extraordinary must have happened to him." "Nothing has happened to me but the desire to be in your company as soon as possible, fair lady." "Well! what did I say? that is extraordinary enough!" While the literary man addressed a few words to the young actress, Saint-Arthur approached Roncherolle and whispered in his ear: "I have thought of a delightful way to have my bird come in and speak, without being seen." "Indeed! what is it?"
  • 71. "A pie—you know, like those they have on the stage; it will be brought in and put on the table, and the parrot will be inside." "That may be amusing, in truth; but on the stage pasteboard pies may create an illusion; here, on the contrary, seen at such close quarters, I am afraid that it will miss its effect." "Oh! I anticipated that, and so it will have a genuine pie crust. I gave my orders to Beauvinet, and he is to take the bird to an excellent pastry cook, who is to cover it with the crust; then Beauvinet will bring us the pie." "That makes a difference; in that case, the illusion will be perfect." "Isn't it an ingenious plan?" "But aren't you afraid that your parrot will stifle in the pie?" "Why so? They are shut up in cages." "True, but I should say that they have more air there." "Bah! just for a short time. Besides, I told Beauvinet to tell them to make some little holes on top, so that he may have light, and that we may hear him plainly." "In that case, everything will be all right." They took their places at the table. Jéricourt treated Roncherolle with the utmost ceremony; but from time to time, he cast his eyes upon the bunch of violets which the latter wore in his buttonhole, and then a mocking smile played about his lips; but Roncherolle apparently did not notice it. "The champagne lessons will come with the dessert," said Saint-Arthur, "because they always disarrange the table a bit. We spill the champagne over ourselves, so it is better to wait." "It is all one to me," said Zizi; "I am quite willing to wait now, for I have fallen violently in love with madeira." "And monsieur is arranging some lessons even more unique than the last, no doubt?" said Jéricourt, addressing Roncherolle. "Yes, monsieur; in fact, I am preparing a lesson for you, which, I fancy, you hardly expect." Meanwhile, after the first course, Saint-Arthur betrayed the liveliest impatience, and kept ringing for the waiter and asking him: "Has no one come to see me? Isn't there any messenger outside for me?" "No, monsieur, no one has come."
  • 72. "The deuce! he is very late!" "What! are you expecting other guests?" said Jéricourt. "Yes,—that is to say, I am expecting something for the dinner." "A surprise he has arranged for me," said Zizi; "I haven't any idea what it is, but I like to think that it will be superb!" At last the waiter announced: "Monsieur, there's a man here with a pie." "Ah! very good! bravo! show him in." "What! is your surprise a pie?" cried the young woman; "why, that is perfectly ridiculous. I don't like pie at dinner!" "This one, my dear love, is not like most pies.—Come, Beauvinet, come in!" The old young man from the lodging house appeared, bringing a very handsome pie, which he held as if it were the keys of a conquered town; he placed it on the table, looked about at everybody with a self-satisfied expression; then pulled his wig over his left ear. Everybody looked at the pie, which had an inviting aspect. Saint-Arthur seemed overjoyed; he jumped up and down on his chair, exclaiming: "Ah! I should say that that is the thing!" "It is a very handsome pie," said Jéricourt. "Where did it come from? Strasbourg?" "Oh, no! not from so far away." "Come, Frefred," said Zizi, "if the pie is so delicious, cut into it and let us taste it." "One moment, my dear love, one moment; it isn't to be cut into like that; I request silence for a moment, and attention." And the young host, putting his face down to the pie, said in an undertone: "Dutaillis is lovely.—Come, Coco, come, come!" "What's this? Alfred is talking to the pie now!" cried Zizi, opening her eyes to their fullest extent. "Hush, my dear love! hush I say!—Come, Coco—Dutaillis is—go on." But in vain did they listen and wait; the pie maintained the most profound silence.
  • 73. "Are you playing proverbs with the pie, my Bibi?" "Yes, I am playing—that is to say, the pie is going to speak." "The pie going to speak! ah! I would like right well to hear it, on my word!" "Just a little patience. I can't understand what the matter is with him; he must have gone to sleep in there.—Coco, Coco—Dutaillis is lovely.—Ah! you won't speak, won't you? I will wake you up." And Saint-Arthur, taking the huge pie in both hands, began to shake it with all his strength; then he replaced it on the table, saying: "Will you speak now, you beast?" While they waited again in silence, Monsieur Beauvinet ventured to blow his nose, which drew down upon his head a stern reprimand from his tenant. "But whom are you calling a beast, and what is it that's in the pie?" asked Mademoiselle Zizi, beginning to get tired of keeping still for nothing. "Well, my dear love, it is a parrot, a magnificent parrot, which I have taught to say: 'Dutaillis is lovely! applaud, clap Zizi!'" "Ah! the poor creature! is it possible? Why, he must be stifled in there; that's why he doesn't speak.—Monsieur de Roncherolle, take the crust off at once." "Are all the windows closed?" asked Saint-Arthur; "we must look out that he doesn't fly away.—See to it, Beauvinet." Beauvinet made a strange grimace, but did not stir. "I have a shrewd idea that he won't fly away;" said Roncherolle, as he ran his knife around the crust of the pie. "Look out, be careful, don't stick the knife in, or you will cut the bird." "There's no danger." At last the upper crust was taken off, and nothing came out of the pie. They all put their heads forward to look inside; but instead of a living bird, they saw only what is always found in a chicken pie: jelly, and the stuffing around the principal piece, on top of which there was a slice of pork. Saint-Arthur was stupefied; his guests with difficulty restrained their desire to laugh.
  • 74. "What does this mean, Beauvinet? where is my bird, my parrot? what have you done with him?" "Your bird is there, monsieur; I did what you told me to: I carried him to the pastry cook, and told him to put him into the pie." "Ah! you villain! you miserable wretch! how could you fail to understand me? I told you that I only wanted the crust put around him." "Well, there is nothing but crust around him." "And I added: 'You must have holes made in the top to give him air, so that we may hear him plainly.'" "I understood: 'So that we may smell him plainly;'[B] and the pastry cook said: 'I never make holes in my pies; your parrot will be a little tough, but I'll just lard him and stuff him, so that no one will ever know what it is.'" [B] I said: 'pour qu'on l'entende bien.' I understood: 'pour qu'on le sente bien.' At that point, roars of laughter from Zizi, Roncherolle and Jéricourt made it impossible to hear the groans and lamentations of Alfred, who, in a fit of desperation, attempted to throw the pie at Beauvinet's head; but he was prevented, and Roncherolle said to him: "As the harm is done, we must make the best of it; as I presume that no one here has ever eaten parrot pie, I suggest that we taste it." "Yes, let us taste it," said Zizi. "I will tell this story at the theatre, and my comrades will have a good laugh at it." "It doesn't make me laugh! the result of such long-continued toil; and just at the moment when I had finished his education, and when he began to talk so famously!" "Will you have a little piece, Saint-Arthur?" "I? never! but yes—just a taste.—That rascally pastry cook! he was quite right to say that no one would know what it was; but he will have to give me back the feathers, at least." "Pouah! how nasty it is," said Zizi, pushing her plate away. "So tough that you can't chew it." "And a certain flavor which is not exactly agreeable," said Jéricourt. "The pastry cook did not disguise it quite enough."
  • 75. "Here, take all this away," said Roncherolle, handing the plate with the pie to Beauvinet; "and for your punishment, eat it!" "Yes, clear out with it, you stupid beast!" cried Saint-Arthur. "Off with you, and if I wasn't holding myself back—What an ass he is! I am sure that if one should tell him to take a dog to the pastry-cook he would have it made into a pie." Beauvinet took the pie under his arm, and angrily pulled his wig over his right ear, grumbling: "They don't know what they want; I do what they tell me to, and they ain't satisfied! Let them make their pies themselves after this."
  • 76. XLIII A DUEL The adventure of the pie amused the guests mightily; Saint-Arthur alone did not share his friends' gayety; at every mouthful that he swallowed, he muttered: "My poor parrot! my poor Coco! how prettily he said: 'Dutaillis is lovely!'—What a misfortune!—'Applaud, clap Zizi!'—I shall never be consoled." "You are going to begin by being consoled right away," said the young actress; "and don't bore us any longer with your complaints. Don't you see that the story of your pie is a hundred times better and funnier than your bird would have been? But here comes the dessert. I want some champagne now, and I want my good friend Roncherolle to keep his promise to us." "Monsieur is going to begin his exercises!" said Jéricourt ironically. "Let us see if it is the same thing as at Nicolet's: worse and worse and more of it." "We will do our utmost to satisfy monsieur," replied Roncherolle, emptying a glass of champagne. "But first of all," said Zizi, "as I am rather inquisitive, I want to hear the story of that little bunch of violets that you promised me." "Ah! so he has stories too!" muttered the literary man; "sapristi! we are going to have a deal of entertainment!" "Perhaps you will have much more than you expect, monsieur," replied Roncherolle, with a meaning glance at Jéricourt. "But I begin—this little bunch of violets I got from a flower girl,—nothing more commonplace than that, eh? But what is less commonplace is that this young flower girl, who is remarkably pretty, is as virtuous and respectable as she is pretty. Now, this is what happened to her last summer: a young man of the world, a dandy, who, I believe, claims to be a literary man, saw the charming flower girl and found her to his liking; he made such speeches to her as all young
  • 77. men make to pretty girls—thus far there was nothing that was not perfectly natural." "I say!" cried Saint-Arthur; "why, that's like Jéricourt and——" "Pray let monsieur finish!" said Jéricourt, who had become very attentive within a few seconds. "But, as I was saying, the pretty flower girl, who is virtuous and who, moreover, is in love with a handsome young fellow, did not listen to our dandy's suggestions, but received them very coldly. What does he do to triumph over the girl? He sends a man to order and pay for a very handsome bouquet, with a request to the flower girl to carry it herself to a lady whose address he gives her, informing her that that lady will have other orders for her. The girl falls into the snare—for you will guess that she was sent to the gallant himself, who had told his concierge to allow the flower girl to go up to his room." "Why, this is strange, it resembles——" "Hold your tongue, Frefred! this story interests me immensely." Jéricourt did not utter a word, but he had become very pale. Roncherolle continued his narrative, with his eyes still fastened upon him. "Behold then our flower girl in the young man's room, which she had entered without suspicion, for a woman had opened the door. But soon he who has been persecuting her with his addresses appears; he is alone with her, he no longer conceals his purpose to triumph over her resistance; the girl sees her danger, summons all her courage, and resists so effectively that the enterprising gentleman receives upon his face the marks of that stout defence—indeed, they have not altogether disappeared yet; he is obliged to let a woman who defends herself so well go her way. You will assume that that was the end of it all; and indeed, it should have been; but no, because that girl was virtuous, because she did not choose to cease to be virtuous, because she had given her heart to another, the gentleman in question deemed it becoming to proclaim everywhere that the pretty flower girl had been his mistress, that she had come to his room of her own free will,—in short, that she was an abandoned girl; he dishonored her in the eyes of all those who loved her. I say that that is dastardly, infamous! and do not you think that so much lying and slander deserve to be punished?" Zizi said nothing because she had guessed the truth; Jéricourt bit his lips and also held his peace; but Frefred exclaimed:
  • 78. "This is strange—your story—one would say—where does your pretty flower girl stand?" "Near here, on Boulevard du Château d'Eau; you know her perfectly well." "What! is it Violette?" "It is Violette." "Why, in that case, the young man who pretends to have had her favors —is——" "Just so; it is monsieur." Thereupon Jéricourt felt called upon to draw himself up and assume an impertinent tone. "Monsieur," said he to Roncherolle, "I do not understand all the absurd stories and fairy-tales which you have been telling us, and which have neither head nor tail; but what seems even more inconceivable is that a man of your age should pose as the knight of flower girls!" "A man of my age, monsieur, knows the world well enough to distinguish the false from the true; and when one can avenge a woman who has been shamelessly defamed by a conceited coxcomb, age makes no difference, monsieur, as I hope to prove to your satisfaction." "Really, I am very condescending to answer you!" retorted Jéricourt, throwing himself back and swinging his legs. "Be off with you, monsieur; leave me in peace." "I will be off, monsieur, but with you, I hope." "Oh! that would be amusing! Faith, my dear monsieur, lose your temper if you choose, but I will not fight for a flower girl." "Well! will you fight for this, monsieur?" As he spoke, Roncherolle, who had left his seat and walked toward Jéricourt, struck him across the face with his glove. The young man leaped from his chair, his face became livid, and he seemed to contemplate rushing upon Roncherolle; but the latter maintained such a calm and impassive attitude, while holding the prongs of a fork toward his adversary to keep him at a respectful distance, that Jéricourt contented himself with saying in a voice choked with wrath: "That insult will cost you dear, monsieur!"
  • 79. "I shall be enchanted to find out whether that is so, monsieur; and I propose that we finish this matter not later than to-morrow morning." "Yes, monsieur; to-morrow, at nine o'clock in the morning, I will be in the woods, near Porte Saint-Mandé." "I will be there at that time." "Saint-Arthur, you witnessed the insult, you must be my second." "I, your second; why, I don't know if——" "Be kind enough to have two seconds," said Roncherolle, "for I shall bring two." "Until to-morrow, monsieur; Saint-Arthur, be at my rooms before eight o'clock." Jéricourt seized his hat and rushed from the room like a madman, without saluting anybody. The young actress did not think of laughing, she was deeply impressed by all that had happened. As for Alfred, he turned white, red and yellow by turns, and seemed to be inclined to weep. "My dear friends," said Roncherolle, resuming his seat at the table, "I am truly sorry to have disturbed the end of your dinner thus. But what would you have? I have been waiting for a long time for an opportunity to settle affairs with this fellow Jéricourt." "Then you are certain that the pretty flower girl has been slandered?" said Zizi. "Perfectly sure. However, this duel will be the judgment of God. Let us drink to the triumph of the truth." "I am not thirsty any more," faltered Saint-Arthur. "Here I am forced to be a second in a duel! I don't like that at all, for—are your seconds quick- tempered?" "Not the least in the world; I shall bring two mere boys; you have nothing to fear; your part will be absolutely passive; you will be there only to look on, for there is no possible adjustment of the affair with my adversary." "Ah! if it's only a matter of looking on, that's different; rely on me." "Oh! how I wish it were to-morrow noon," said Zizi. "But now good- night, let us separate; I am no longer in the mood for talking nonsense. I am
  • 80. only a good-for-nothing, Monsieur de Roncherolle, but all the same I will pray to God for you; and who knows? perhaps He will listen to me." On leaving the restaurant, Roncherolle walked back and forth in front of the theatres on Boulevard du Temple; he knew that Chicotin was particularly devoted to that place, where he often succeeded in obtaining an admission ticket, which he did not sell, but with which he went into the theatre. And in fact Roncherolle had not been walking there ten minutes when he spied the person for whom he was looking. "Hello! is that you, bourgeois?" cried the young messenger. "Have you been to the play? If you are not going back, make me a present of your check." "No, my boy, I haven't been to the play; but listen carefully to what I am going to say to you, for it is very serious, very important; I need you to- morrow, you must be at my room at eight o'clock at the latest." "That is easy enough, I will be there. Is that all?" "No, I also want your friend Georget, Violette's young sweetheart, to come with you; I need him too." "Is that so? What for, bourgeois?" "I will tell you both to-morrow, not before; meanwhile, let your friend understand that his future happiness and Violette's are concerned." "Oh! in that case, never fear; he won't fail to come!" "But don't mention this to anybody, not even to Violette; it is a secret." "We won't say a word." "Are you sure of seeing Georget this evening?" "Pardi! when he doesn't go to walk with Violette, he is at home; at any rate, he must go home, and I will wait for him." "Very well, is he still with Monsieur Malberg?" "Yes, but he sleeps in his own lodgings." "Don't let him say a word of this to—to Monsieur Malberg." "Never you fear; indeed, he probably won't see him until after he sees you." "Until to-morrow then, and both of you." "We will be there, monsieur." "By the way, bring a cab with you; don't forget."
  • 81. "A cab, all right, monsieur." The next morning at half-past seven, Roncherolle was up and dressed and was cleaning a pair of pistols, which, despite his destitution, he had always kept. At a few minutes before eight, the door was opened softly and Chicotin appeared, accompanied by Georget. The latter, instead of a blouse, wore a short coat buttoned to his chin, and on his head a blue cloth cap of stylish shape; he held himself very erect, and his new costume heightened the attractiveness of his face and the grace of his figure. Roncherolle could not help admiring the fine appearance of the young man, and he offered him his hand, which Georget took with an air of respect. "Here we are, bourgeois," said Chicotin; "I hope we haven't kept you waiting; I bring Georget, as you see, and the cab is downstairs." "That is very good, my boy. Monsieur Georget, I thank you for coming here at my invitation; when you know what is on foot, I am sure that you will not be sorry." "I am very happy, monsieur, if I can be of use to you in any way; I know you already through Violette, whom you were kind enough to visit when she was sick; and Chicotin told me——" "I told him that this morning's business had something to do with her; but monsieur will explain the whole thing to us, and tell us why——" "You are in a great hurry; the most important thing now is to start; and especially to avoid meeting my little neighbor on the stairs, for she would ask questions which we could not very well answer at this moment." "Oh! it's only eight o'clock; it's cold too, and Violette doesn't go out so early in such weather." "Very well, let us start, young men." Roncherolle took his box of pistols, which seemed to puzzle Chicotin greatly. Georget went out first, walked to the stairs cautiously, then motioned to them that they might go down. All three were soon at the door, which was kept by Mirontaine only; he barked when anybody came in, but never when they went out. Monsieur de Roncherolle entered the cab, told Georget and Chicotin to enter with him, although the latter declared that he would be quite as
  • 82. comfortable behind, and bade the coachman take them to the Porte Saint- Mandé, by the Vincennes road. "Oho! we are going to the country," cried Chicotin; "we shan't find much shade there!" "I can tell you now, messieurs, why I have brought you with me," said Roncherolle. "It is for the purpose of being my seconds; for I have a duel on hand, I am going to fight a duel with pistols this morning." "You are going to fight?" cried Georget, deeply moved. "Yes, my friend; if I had told you that beforehand, would you have refused to come with me?" "Oh, no! on the contrary, I would have begged you to take me." "I was sure of it beforehand, young man." "And I too, bourgeois; I like fights! they just suit me! But what are we two going to fight with? We haven't any weapons; are we to fight with fists? I like that too." "No, not with fists or anything else; you are my seconds, and you will not be called upon to fight at all." "So much the worse! of what use shall we be then?" "To affirm the innocence of a young girl whom I hope to avenge. I am going to fight with Monsieur Jéricourt." "With Monsieur Jéricourt?" cried Georget; "with that man who laid the trap for Violette and then slandered her so abominably?" "Just so; do you consider that I am doing wrong?" "Oh, monsieur! what good fortune! that Jéricourt! I have been looking for him everywhere, and haven't found him. But you are not the one who's going to fight with him, monsieur; I am; for I am the man whom he insulted most cruelly; I am the man whom he injured most; I am to be the husband of the woman whom he tried to dishonor. You must see, monsieur, that I am the one who must fight with him." "My dear Georget, I was very sure that you would say all that; I expected it; but be calm and listen to me. I was in this gentleman's company yesterday; I have long been looking for an opportunity. I told him what I thought of his conduct toward Violette. I demanded satisfaction for his slanders, but he refused; then I struck him in the face. The duel was instantly arranged for this morning. Now, this gentleman has the right to
  • 83. demand satisfaction for the outrage inflicted upon his face; if I did not fight, if I allowed you to fight in my place, I should act like a coward; and as I have never had that reputation, you will permit me not to earn it now. All that I can do, my dear Monsieur Georget, is, if I fall, to allow you to take my place and to renew the combat with this gentleman. Now it is all understood and arranged. Not a word more on that subject, for it would be useless.—But we have arrived." The carriage stopped on the outskirts of the wood; Roncherolle alighted with the two young men, Chicotin carrying the box of pistols. They looked about in all directions but saw nobody. "Is it possible that he will not come?" murmured Georget, stamping the ground impatiently. "Is he going to squeal?" said Chicotin. "There is no time wasted yet, messieurs, and his seconds may have kept him waiting.—But look, I see a carriage in the distance.—I'll wager that they're the people we expect." The carriage reached the wood and they saw Jéricourt, Saint-Arthur and little Astianax at once alight from it. "Saperlotte! the seconds are not big fellows," cried Chicotin; "I know 'em; both of 'em together wouldn't make one decent man. I could eat half a dozen of them without difficulty!" Roncherolle imposed silence upon Chicotin with a glance. Jéricourt came forward with his two friends; Saint-Arthur acted as if he had a pain in his stomach, and little Astianax looked in both directions at once. "What does this mean?" cried Jéricourt, as he scrutinized Chicotin, while Georget glared at him with flaming eyes; "what! Monsieur de Roncherolle chooses a messenger for his second? Really, I should have supposed that he could find some one better than that.—You see, messieurs, the honor that he does you, and with whom you are brought into relations!" "What's that? what's that?" cried Chicotin, turning up his sleeves; "do I hear anybody sneering at me? Ah! as I live! I'll smash the principal and his seconds in a second." "Be quiet," said Roncherolle sternly. Then, walking toward his adversary's two seconds, he said to them:
  • 84. "I have brought this young man, messieurs, Monsieur Georget, because he is the fiancé, the future husband of the young girl whom monsieur attempted to ruin. No one has a better right to be here than he, for the honor of the woman whom he is to marry is the motive of this duel. As for my other second, this honest fellow here, he is only a messenger, it is true, but it was he who saved the young flower girl when, driven to desperation by contemptuous treatment and humiliation, and by the thought of passing for what she was not, she was on the point of jumping into the canal and seeking an end to her suffering there. Do you not think, messieurs, that this honest fellow who brought back hope to Violette's heart, also has a right to be present at a battle which is to rehabilitate her honor? Come, messieurs, which of you will undertake to maintain the contrary, and will blush to have to deal with such seconds? Neither of you, I am sure!" Saint-Arthur and Astianax contented themselves with bowing low to Roncherolle, who continued: "Very good, everything is arranged; now, my adversary has the choice of weapons." "He chooses pistols," said Astianax. "Pistols it is; I have brought some." "So have we." "We will take yours, if you choose; it makes no difference to me. My adversary has the right to fire first also, I recognize that; you see that we shall have no difficulty. Let us go a little way into the woods, and have done with it." The whole party walked into the woods and stopped in a solitary place, where there was a clearing suitable for the duel. Astianax, having spoken to Jéricourt, returned to Roncherolle and said: "Is fifteen paces satisfactory to you, monsieur?" "Ordinarily, the seconds would decide such matters among themselves; but no matter, that is satisfactory to me; mark off the distance and I will take my place." Astianax counted the paces, while Saint-Arthur leaned against a tree at a distance; as for Georget and Chicotin, Roncherolle was obliged to hold them back by his glance.
  • 85. Young Astianax, having finished measuring the distance, handed to each combatant a pistol, which he took from the box he had brought; then he stood aside, saying: "They are loaded; I believe there is nothing more for me to do now." "It is for you to begin, monsieur," said Roncherolle, bowing to Jéricourt. Jéricourt took a long aim, then fired; the ball from his pistol grazed his adversary's right side and made him turn slightly; Georget started to run to him, but Roncherolle motioned to him not to stir and speedily resumed his position, saying: "That was not bad, but it was not quite the thing." He fired almost instantly, and Jéricourt, wounded in the breast, fell to the ground. The four seconds rushed at once to the assistance of the wounded man, who was already discharging blood through his mouth; and when he saw Georget, he said to him in a faint voice: "I lied—she is innocent—tell her that I confess, that——" The unhappy wretch closed his eyes and could say no more; Chicotin took him in his arms and carried him to the carriage which had brought him, which Astianax also entered. As for Saint-Arthur, he had disappeared and they were unable to find him. Georget ran back to Roncherolle, crying: "He confessed, monsieur; he confessed; he admitted that he had slandered Violette! all those gentlemen heard him as well as I!" "That is well, my young friend; that is what I wanted. Now you must give me your arm to help me to walk back to the carriage." "Oh! are you wounded too, monsieur?" "A scratch, a mere scratch, but it troubles me when walking. I will lean on you." "Oh! as hard as you please, monsieur. What a debt of gratitude I owe you! And Violette, when she knows it——" "I knew perfectly well that she deserved to be defended; but I am very glad to have spared you that trouble; and then, you see, I have done a lot of foolish things in my life, and I am not sorry to do some good now and then."
  • 86. Chicotin reached the carriage just as Monsieur de Roncherolle and Georget entered it. The young messenger's face was all awry, and he faltered: "All the same, it gives a man a shock—a young man, who was so well a minute ago——" "Well? Monsieur Jéricourt, how is he?" asked Roncherolle. "He is stone dead!"
  • 87. XLIV THE EMBROIDERED HANDKERCHIEF While the duel which concerned the pretty flower girl was in progress, the girl herself was greatly surprised to see Pongo appear at her door about nine o'clock. "Master," he said, "he want mamzelle to come and see him after her dress herself all fine; yes, dress herself all fine, and bring a big bouquet." Violette hastened to answer that she would obey Monsieur Malberg's orders; but as she donned her best dress and her prettiest cap, she said to herself: "Probably Monsieur Malberg wants to send me somewhere, for he would not tell me to dress in my best just to go to his house. Besides, the bouquet that he wants—no doubt I shall have to go to Madame de Grangeville's.— So much the better! I like that lady very much, and it's a long time since I carried her a bouquet." When he saw Violette enter his room, so fresh and pretty and graceful, and wearing a dress, which, although appropriate to her rank in life, gave an added charm to her person, none the less, the count could not help sighing, as he said to himself: "I should have been very happy if I could have called her my daughter." "Here I am, monsieur, I have obeyed your orders," said Violette; "I have done what your servant told me to do; do I look well, monsieur?" "Yes, my child, yes, very well; and I have no doubt that Madame de Grangeville will find you charming thus." "Am I going to that lady's house? I suspected it, monsieur." "So much the better!—Listen to me, Violette; I must tell you now that this lady to whom I am sending you knew your mother and the secret of your birth; if your mother is still alive, if she is disposed to recognize you as her daughter, this lady will tell you so." "Is it possible, monsieur?"
  • 88. "Yes, and for that purpose, you are going to-day to tell her all that you know about your birth, giving her to understand that you have known it only a short time; and then you will finish your story by showing her this handkerchief, which I give back to you to-day, so that it may help you to find your parents." "Ah! I am all of a tremble, monsieur; the thought that perhaps I am going to find my mother—why haven't you let me say all this to that lady before?" "Because, my child, before confiding such an important matter to her, I wanted her to have time to appreciate you, so that you might not be a stranger to her." "And suppose this lady, after listening to me, after seeing this handkerchief, should not mention my mother to me?" "In that case, my poor girl, it would mean that you no longer have a mother, that all hope of finding her is vanished. But such a supposition does not seem possible to me; no, she cannot spurn you again; and those who brought you into this world will be only too happy to lavish their caresses upon you." "Shall I tell this lady it's you who send me this time?" "Not by any means; let her still think that it is Monsieur de Merval.— Go, Violette; and if it is possible, come back here and tell me the result of your visit to—to Madame de Grangeville." "If it is possible! who could prevent me from coming back to you, monsieur?—I will go at once, and you will see me again soon." The young girl took her bouquet and started for the abode of the lady who, as she had been told, might restore her mother to her; a thousand confused thoughts, a thousand hopes surged through Violette's mind, and she reached the house intensely excited and trembling from head to foot, and asked Mademoiselle Lizida if she could see her mistress. "I think so," said the lady's maid; "madame was at a ball last night, but she did not return very late; it is twelve o'clock, and she has just risen; I will announce you and your bouquet." After a few moments, Violette was ushered into the presence of Madame de Grangeville, who was seated before her mirror, completing her morning toilet, and who smiled at the young girl, saying to her:
  • 89. "Ah! here is my pretty little flower girl. It is a long while since you came last, little one; I am neglected nowadays; Monsieur de Merval is less attentive to me." "I don't know, madame——" "Let me see your bouquet; it is very pretty, but I saw finer ones at the ball last night. Sit down, my girl, and let us talk a bit. Why! how you are dressed up to-day! where are you going this morning, pray?" "I am going nowhere but here, madame." "Oho! then it was for me that you made this toilet. You look very well; and I—this cap—do you think that it is becoming to me? I look a little tired, do I not? They absolutely insisted upon making me dance last night.—But what ails you, my child? One would say that you were not listening to me; you seem distraught." "Ah! madame, it is because——" "Because what? finish your sentence." "Since I had the honor to see you last, I have learned something about ——" "About what?" "About my birth, about my family." "Your family; you told me that you were an abandoned child." "True, madame; but someone who knew my nurse has told me several things which may help me, they say, to find my parents." "Really—I think I will put on a blue ribbon instead of a pink one, it will look better.—Were you not left at the Foundling Hospital in Paris?" "No, madame, I was born in Paris, but I was given in charge of a nurse, who came from Picardie, and who went back to her province at once." Madame de Grangeville ceased to toy with her cap and said to Mademoiselle Lizida, who was putting the room in order: "Leave us, go.—You were saying that your nurse lived in Picardie?" "Yes, madame." "What was her name?" "Marguerite Thomasseau." "Marguerite—are you sure that her name was Marguerite?" "Yes, madame."
  • 90. Welcome to our website – the perfect destination for book lovers and knowledge seekers. We believe that every book holds a new world, offering opportunities for learning, discovery, and personal growth. That’s why we are dedicated to bringing you a diverse collection of books, ranging from classic literature and specialized publications to self-development guides and children's books. More than just a book-buying platform, we strive to be a bridge connecting you with timeless cultural and intellectual values. With an elegant, user-friendly interface and a smart search system, you can quickly find the books that best suit your interests. Additionally, our special promotions and home delivery services help you save time and fully enjoy the joy of reading. Join us on a journey of knowledge exploration, passion nurturing, and personal growth every day! ebookbell.com