Prototyping 2013-10-07 (Networked Media)

From XPUB & Lens-Based wiki

Construction.gif This page is currently being worked on.

<slidy theme="aa" />

What is a bit?

A little segue into the Binary...

Ultimately the thing about the digital is that it's a kind of "universal" writing system of recording things as on/off 1/0 bit patterns. These patterns then always need to be interpreted by the tools and algorithms of software to actually be presented (or mis-presented).

Formats that are more "raw" (like uncompressed formats) tend to produce more interesting results from mis-interpreation (ie the patterns of a raw audio square wave can still be legible when "mis-interpreted" as an image file in a program like the GIMP).

Bit shift

The simple act of opening an audio file in a text editor (or the reverse of opening a text as a digital audio) raises many questions. What exactly is a digital representation of a text, or a sound. The fact that once digital, bits can be as easily interpreted as text or as sound, or image, or other kind of data is at once fascinating, but also deceptively reinforces an idea of multimedia as inherantly bridging and mixing together media. Media formats, and their underlying digital representations, are highly specialized codes (algorithmic, legal) involved in the related processes of encoding and decoding.

A bit shift is the process by which the bits of some data value are shifted in position either "left" or "right" (that is away from or towards the "least significant" bit position). In a simple numerical representation of integers such a shift corresponds to multiplication and division by a power of two. This as a result of the design and working of the system of binary representation, with each column defined to represent powers of 2. The same operation performed on the characters of a text represented as ASCII code values would produce a much different result as the system of representation is structured very differently (with groupings of characters organized not so much by numeric relations, but by clusters of associated symbols and the conventions of the alphabet).

Raw media

We can use python to generate the "raw" bits of say an audio waveform or a bitmap image. Certain formats, such as audio WAV files or bitmap formats like TGA and BMP (when uncompressed) are easy to generate and manipulate with generic tools like python because the formats are often mostly "raw" sample or pixel data with a short preceding "header" that declares some key properties about the file (such as sampling rate, or image size).

Bit

Code

  • Notation and Representation
  • Zooming out: Formal Languages: Procedural vs. Descriptive

Generating "Raw" Audio

Raw audio

Generating "Raw" Images

#!/usr/bin/env python
#-*- coding:utf-8 -*-

import struct

f = open("image.data", 'w')

data = ''
for x in range(10000):
    if x % 2:
        data += struct.pack('B', 255)
        data += struct.pack('B', 0)
        data += struct.pack('B', 0)
    else:
        data += struct.pack('B', 0)
        data += struct.pack('B', 255)
        data += struct.pack('B', 0)

f.write(data)
f.close()

Image

File:Cartesian-coordinate-system.svg

A Cartesian coordinate system is a coordinate system that specifies each point uniquely in a plane by a pair of numerical coordinates, which are the signed distances from the point to two fixed perpendicular directed lines, measured in the same unit of length. Each reference line is called a coordinate axis or just axis of the system, and the point where they meet is its origin, usually at ordered pair (0, 0). The coordinates can also be defined as the positions of the perpendicular projections of the point onto the two axes, expressed as signed distances from the origin.

source: Cartesian coordinate system, on wikipedia Raw media

Some binary filters

Bit-flip

Bit-shift

In-class exercise

DSC00087.JPG

Select either to work with Image or Sound.

Use (nested) loops in Python to produce beautiful digital media exploring the bit-friendly nature of Rotterdam.

Resources

  • 10 print book on early BASIC home computer programming culture