Creative Coding

Develop applications and games using programming and scripting languages such as Java, C++, C#, Swift and JavaScript for platforms including Processing, Node.js, OpenCV and Unity.

Useful learning resources

Books

HTML & CSS

  • HTML & CSS Book - A book aimed at designers introducing concepts within web development

JavaScript

p5.js

Processing

  • Learning Processing by Daniel Shiffman
  • Nature of Codeby Daniel Shiffman

Websites

JavaScript

P5.js

  • Daniel Shiffman has a vast collection of videos introducing programming using p5.js. Take a look through these videos if you are interested in getting a head start:
    https://vimeo.com/channels/learningp5js

  • Kadenze is an online platform for creative education. You can take structured courses with plenty of video based content and exercises. Here is an Introduction to Programming for the Visual Arts with P5:
    https://www.kadenze.com/courses/introduction-to-programming-for-the-visual-arts-with-p5-js/info

Programming Design Systems / Printing Code

  • A course that intersects graphic design and programming run by Rune Madesen at ITP in New York: http://printingcode.runemadsen.com/
  • [Video] Printing Code: Programming and the Visual Arts, Rune Madsen https://vimeo.com/61113159
  • Soon to be an online book with tutorials: https://programmingdesignsystems.com/

HTML & CSS

  • https://www.codecademy.com/learn/learn-html-css

Open CV

  • https://vimeo.com/69907695

Code

  1. https://github.com/atduskgreg/opencv-processing
  2. https://github.com/shiffman/Face-It

Topics

  • Face detection
  • Which Face
  • Edge detection
  • Pattern matching
  • Background Subtraction

Data Vis

Videos

Tutorials

Tutorials

"Hello, World!" in Node.js

Introduction

The first program most people write when learning a new programming language is one form or another of the infamous "Hello, World!".

Preparation

What you'll need to know

To follow this tutorial you should be familiar with the basics of the command-line (also known as Terminal on OS X or Command Prompt on Windows). Below are some resources that will help you get up to speed on this topic:

  • Code Academy short course - Code Academy provide a short course on command line. It has an interactive prompt in the browser so you can get to grips with the syntax before diving into the CLI.

  • An introduction to Unix and Shell - The Interactive Telecommunications Program at NYU has a very interesting introduction to Unix, which is the precursor and model for Android, Apple iOS, Raspbian (Raspberry Pi), Linux and OSx operating systems. It is also a good overview of the history, philosophy and the anatomy of the shell.

Install NodeJS

You will need to download and install NodeJS. Download the installer for your particular operating system (OSX, Windows or Linux) from the NodeJS website and follow the instructions.

To test if NodeJS has been installed successfully:

  1. Open a command line prompt (Terminal or Command Prompt)
  2. And type the following: $ node -v

Do not type the `$`. This just tells you that everything following the dollar is a single line in the command line prompt.

You should see the version of NodeJS that you installed. Something like: v4.4.7. If you see an error then you may need to downloading and installing again.

Install other software (optional)

We recommend installing and using Atom text editor, because it is free, cross-platform and good for beginners to advanced programmers.

You will be editing JavaScript files throughout this tutorial, which can be done with almost *any* simple text editor you happen to have on your computer. This excludes Microsoft's Word, Apple's Pages or other word processing software, which don't count as simple and will add other unseen characters to your file.

Tutorial

To create and execute our first NodeJS application we simply (1) create a text file with the .js suffix, (2) edit the file and add some JavaScript and (3) pass this file to NodeJS using the command-line prompt.

(1) Create a directory and file

Our goal is to create a directory called hello-world and within it a file called hello.js. You can create a directory and a file using many methods but below are the instructions and an animation of how this is done using the command line.

$ cd Desktop
$ mkdir hello-world
$ cd hello-world
$ touch hello.js

The commands above explained:

  • cd [directory-name] - Change the current directory you are in
  • mkdir [directory-name] - Make a new directory in your current location
  • touch [file-name] - Create an empty file

nodejs1-terminal.gif

The result of this should be a directory and file on your desktop in this structure:

Desktop/
   └── hello-world/
      └── hello.js

(2) Edit file and add JavaScript

  • Open the file hello.js in your preferred text editor
  • Add the following code to the top of the file and save:
console.log("Hello, world of NodeJS!");

(3) Execute our hello.js script using NodeJS

  • Open a command-line prompt
  • Change directory so that you are inside Desktop/hello-world/
$ cd ~/Desktop/hello-world

TIP: When changing directory with the `cd` command (or using any command for that matter) you can use the tilde (`~`) to navigate to your home directory. e.g. `cd ~/Desktop`

- Pass your `hello.js` script to the `node` command ``` $ node hello.js ``` You should see the "Hello, world of NodeJS!" message printed out into your CLI prompt.

Below is an animation of this step.

Execute node script

Tutorials

Command Line Tools & Utilities

A Command Line Interface is a way of interacting with a computer by issuing commands in the form of lines of text. These commands interface with your operating system and hardware to perform complex and intensive operations.

There is a large amount of useful Free and Open Source Software (FOSS) available online that does not need or use a Graphical User Interface (GUI). Often this software works more efficiently with the operating system or directly with the hardware and therefore can perform tasks such as image, video or sound manipulation with ease.

Also because the CLI has a scripting language you can write scripts that automates certain tasks. For example:

  1. Downloading/uploading files from servers or web pages
  2. Converting, cropping, trimming, splitting, combining video files
  3. Converting, cropping, combining image files
  4. Adding effects to, combining, trimming, splitting audio files
  5. Mixing video & audio
  6. Extracting video & audio
  7. Adding text to video or images

Installing CLI Tools

Homebrew - Package Manager for macOS

Homebrew is a package manager for the macOS CLI. Once you install it on the CLI you can with one line install a lot of software from it's repository.

  1. Open Terminal

  2. Copy and paste the following line:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. Hit enter and it will install it for you.
  2. To test if it was successful enter the following command:
brew -v

FFMPEG

FFMPEG is a powerful and flexible tool for performing any transformation tasks on video files.

Install

brew install ffmpeg \
    --with-tools \
    --with-fdk-aac \
    --with-freetype \
    --with-fontconfig \
    --with-libass \
    --with-libvorbis \
    --with-libvpx \
    --with-opus \
    --with-x265

Example use / Tutorial

SoX

The homepage for SoX calls it "the Swiss Army knife of sound processing programs" and gives the following description:

SoX is a cross-platform (Windows, Linux, MacOS X, etc.) command line utility that can convert various formats of computer audio files in to other formats. It can also apply various effects to these sound files, and, as an added bonus, SoX can play and record audio files on most platforms.

Install

brew install sox

Example use / Tutorials

ImageMagick

ImageMagick is a powerful image manipulation tool.

Install

brew install imagemagick

Example use

Tutorials

3D Geometry and Parametric Design

This is an informal workshop experimenting with a method of generating 3D meshes from 2D images based on the RGB colour space and making this content viewable in low-fi VR headsets.

I have been making a piece of software using openFrameworks to explore creating generative 3D meshes and also the challenge of quickly and easily getting 3D models into a lo-fi VR environment. During the workshop I will introduce you to the some basic concepts of 3D modelling and explain how this software can be used as a tool to explain generative design. Below is a screenshot of the software:

Screenshot-2017-06-15-09.29.44.pngCode available here.

Aims

  • Achieve a basic understanding of concepts in 3D geometry
  • Become familiar with the concept of parametric design
  • Generate 3D meshes from found and created 2D images
  • Import 3D meshes into SketchFab, an online platform for sharing and discovering 3D models.

Pre-requisites

  • Download Google Cardboard app for iPhone or Android
  • Access to a computer

Concepts in 3D geometry

We will examine some of the fundamental principles of 3D geometry that allow the computational representation of three dimensional shapes and allow us to understand how these can be created programatically.

Public Domain 3D Cow

Glossary of Terms

  • Vertex (singular) or Vertices (plural)
    One or more points in 3D space.

  • Cartesian Coordinates
    A vertex is commonly located in 3D space using the Cartesian coordinate system. When positioning a point on you use the the X, Y and Z coordinates as show below:

3D Cartesian Coordinate

  • Primitives
    When joined together vertices make the basic building blocks of a 3D structure. The shapes formed are called primitives. Primitives can be points and lines but they become more useful when they form more complex shapes such as triangles or rectangles that can form a surface area. also known as a face.

  • Face
    As you can see from the the cow model each of the individual triangles is covered by a flat surface. Each one of these is a face, which combined make up the surface of the solid object.

  • Triangles
    To create a face you must have 3 or more vertices. This is why the triangle is the commonly used shape in 3D modelling. It is the most simple (or primitive) shape and can be used to represent the surface of a model.

  • Tesselation
    Tesselation is the process of filing a flat surface with shapes (or tiles) so that there are no gaps in that surface.

1-uniform_n11.svg.png 1-uniform_n5.svg.png 1-uniform_n1.svg.png
tessellation_texture_by_quipitory-d38nksj.png 5728579339_97f7895e02_b.jpg

Graphics cards on computers work only work with triangles so any 3D shape you see on screen will have been converted in triangles at some point by the software or by the graphics card itself.

uT6do.jpg

Read more about tessellation

Parametric Design

The ground of parametric design is the generation of geometry from the definition of a family of initial parameters and the design of the formal relations they keep with each other.

What is a parameter?

In maths it is the part of an equation that can be variable, creating change in the output/result. It follows this simple model:

INPUT (PARAMETER) > EQUATION > OUTPUT

In programming and computation writing an algorithm follows this pattern. When an input parameter is changed the rules of the equation or algorithm produce a variety of possible outcomes. If there are multiple input parameters then those possible outcomes increase exponentially.

Algorithms as a design partner

The project below is a study of algorithms on baroque and renaissance paintings. The artist, David Quayola, leaves behind the iconographic meaning of the pictures and uses the raw information (for example colour, shape and the relationships within these) to create new pieces. The informational nature of the pictures can be used in combination with algorithms to modify outputs. No doubt within the creative process there are ways to manually delve into the code to tweak parameters and therefore manipulate the possible outcomes.

Quayola - Iconographies source Quayola - Iconographies outcome

Parametric design is also used within architecture to functionally and creatively explore the possibilities in 3D spatial design. Combining formal rules (i.e. algorithms or equations) and making small variations to the input can produce huge and sometimes unexpected shifts in outcome.

berlin.jpg

As you can see from this Google search for parametric design (June, 2017) there is a recognisable style that is reminiscent of organic shapes and patterns. Without speculating on the functional or aesthetic value of this trajectory it is without doubt a function of designing with the aid of powerful computers that can model physical systems in nature that has enabled this. The relationship between parametric design and this type of outcome is that each of these designs would be partially determined by systems of rules in computation and part by the agency of designers, architects or artists. Google Image Search - Parametric Design

Characteristics of Parametric Design

  1. Creating Composition Systems
    As a designer you often construct systems or 'grammars' that help to guide an outcome. This is the principle of parametric design however formalised into code and software.
  2. Variation
    Variation to a single parameter of a system (i.e. equation or algorithm) can create change in the output that is proportionally larger to the scale of the input. Increasing the number of parameters can again increase the variations of output exponentially! The challenge then becomes how to capture these outputs and make choices between them.
  3. Complexity
    Simple rules create complex outcomes. Also incorporating randomness into systems can increase the the variation of outcomes.
  4. Modelling physical systems
    The speed of calculations in modern computers means that simulation or modelling of physical systems is entirely possible and in doing so can become part of system of parametric design.

The Software

  1. Download software
  2. Download images

How does the software work? Let's use it and find out.

Screenshot-2017-06-15-09.29.44.png