OSC Databending

From

Jump to: navigation, search

For the databending event during GOGBOT 2011 Tkkrlab contributed several projects. Purpose of the Databending event was to connect many art / technology installations together. More examples on databending workshops page.


Contents

Protocol

The OSC protocol is just a way to build messages, although the network protocol is used most often. The contents of the messages and / or the relation between senders and receivers is not described. The communication structure was defined as follows:

  * Protocol on Google Docs

Projects

Oscilloscope Control

osci

OpenFrameworks

Sourcecode: File:OscilloscopeControl.tar.bz2 Requires: Oscilloscope with XY input, OpenFrameworks 0.07, PC with soundcard

This software was written (badly) for OpenFrameworks. It uses Henri's Spirograph functions to show spirograph figures on an oscilloscope. No parameters are written to the network (apart from identification / keepalive) Four parameters are read:

  * Wheel / ring ratio
  * Hole number
  * size X
  * size Y

The code ensures that something interesting is shown on the oscilloscope for all combinations of input parameters by limiting the scopes of the variables.

CSound

The .csd csound-file below is a databendable version. It contains two instruments, the first one uses only one wheel but you can vary the output by gat,fase,wiel,fase2, and figs

  • gat: hole in spirograph wheel
  • fase: rotate figure
  • wiel: spirograph wheel
  • fase2: rotation of subsequent figures
  • figs: number of figure to draw

The second instrument draws predefined spirograph figure where yoy can only vary 'gat' and 'fase'. qutecsound (available as a ubuntu package) is a nice IDE for playing with CSound.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac           -iadc    ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o gen10.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>
#define WIEL #"/csound-spiro/in/wiel"#
#define GAT #"/csound-spiro/in/gat"#
#define FASE #"/csound-spiro/in/fase"#
#define FASE2 #"/csound-spiro/in/fase2"#
#define FIGS #"/csound-spiro/in/figs"#

#ifndef OSCSERVER
;#define OSCSERVER #"127.0.0.1"#
#define OSCSERVER #"mansoft.nl"#
#end

; Initialize the global variables.
sr                  =             44100
kr                  =             441
ksmps               =             100
nchnls              =             2

gilisten            OSCinit       7000

                    turnon        11
                    
                    instr         11
                    OSCsend       1, $OSCSERVER, 8000, "/csound-spiro/out/inputs", "s", "gat,fase,wiel,fase2,figs"
                    endin

; Instrument 1
; figuren met hetzelfde wiel
; luistert naar alle OSC boodschappen
                    instr         1
kwiel               init          30
iamp                init          32000
irr                 init          3.05
ifactor             init          9
ifreq               init          kr / ifactor
iringidx            init          p4
iring               table         iringidx, 6

kcnt                init          0

kgat                init          0
next1:
kans1               OSClisten     gilisten, $GAT, "f", kgat
                    if (kans1 == 0) goto done1
;                    printks      "gat = %f\\n", 0, kgat
                    kgoto         next1  ;Process all events in queue
done1:

kfase               init          0
next2:
kans2               OSClisten     gilisten, $FASE, "f", kfase
                    if (kans2 == 0) goto done2
;                    printks      "fase = %f\\n", 0, kfase
                    kgoto         next2  ;Process all events in queue
done2:

kwiel1              init          0
next3:
kans3               OSClisten     gilisten, $WIEL, "f", kwiel1
                    if (kans3 == 0) goto done3
;                    printks      "kwiel1 = %f\\n", 0, 16 * kwiel1
                    kgoto         next3  ;Process all events in queue
done3:

kfase2              init          0.5
next4:
kans4               OSClisten     gilisten, $FASE2, "f", kfase2
                    if (kans4 == 0) goto done4
;                    printks      "fase2 = %f\\n", 0, kfase2
                    kgoto         next4  ;Process all events in queue
done4:

kfigs               init          0.3
next5:
kans5               OSClisten     gilisten, $FIGS, "f", kfigs
                    if (kans5 == 0) goto done5
;                    printks      "figs = %f\\n", 0, kfigs
                    kgoto         next5  ;Process all events in queue
done5:


kwiel               table         16 * kwiel1, 3
krondjes            table         16 * kwiel1, iringidx + 4

kfreq               =             ifreq * krondjes
kwr                 =             kwiel / iring
ka                  =             1 - kwr

ktblidx             =             kcnt / ifactor % floor(kfigs*10)
kcnt                =             kcnt + 1

apha1               phasor        kfreq
kfase2a             =             kfase2 * 4 - 2
afase1              =             apha1 + ktblidx * kfase2a / iring + kfase
apha2               phasor        kfreq * (kwr - 1) / kwr
afase2              =             apha2 + ktblidx * kfase2a / iring + kfase
kb                  =             kwr - (0.0647059 * (ktblidx + kgat * 10.0 - 1.0) + 0.31) / irr
a1                  table         afase1, 1, 1, 0, 1
a2                  table         afase2, 1, 1, 0, 1
a3                  table         afase1, 2, 1, 0, 1
a4                  table         afase2, 2, 1, 0, 1
                    outs          iamp * (a1 * ka + a2 * kb), iamp * (a3 * ka + a4 * kb)
                    endin

; Instrument 2
; vaste figuren gedefinieerd in tabellen
; luistert naar 'gat' en 'fase' OSC boodschappen
                    instr         2
ifreq               init          kr

kgat                init          0
next1:
kans1               OSClisten     gilisten, $GAT, "f", kgat
                    if (kans1 == 0) goto done1
;                    printks      "gat = %f\\n", 0, kgat
                    kgoto         next1  ;Process all events in queue
done1:

kfase                init          0
next2:
kans2               OSClisten     gilisten, $FASE, "f", kfase
                    if (kans2 == 0) goto done2
;                    printks      "fase = %f\\n", 0, kfase
                    kgoto         next2  ;Process all events in queue
done2:

done3:
iringidx            init          p4
iring               table         iringidx, 6
ifig                init          p5
iaantalwielen        init          p6
iamp                init          32000
irr                 init          3.05
kcnt                init          0

ktblidx             =             kcnt % iaantalwielen
kcnt                =             kcnt + 1
kwielidx            table         ktblidx, ifig
kgat1               table         ktblidx, ifig + 1
kfase1              table         ktblidx, ifig + 2
kwiel                table          kwielidx, 3
krondjes            table         kwielidx, iringidx + 4
kfreq               =             ifreq * krondjes
kwr                 =             kwiel / iring
ka                  =             1 - kwr
apha1               phasor        kfreq
afase1              =             apha1 + kfase + kfase1 / iring
apha2               phasor        kfreq * (kwr - 1) / kwr
afase2              =             apha2 + kfase + kfase1 / iring
kb                  =             kwr - (0.0647059 * (kgat1 + kgat * 10.0 - 1.0) + 0.31) / irr
a1                  table         afase1, 1, 1, 0, 1
a2                  table         afase2, 1, 1, 0, 1
a3                  table         afase1, 2, 1, 0, 1
a4                  table         afase2, 2, 1, 0, 1
                    outs          iamp * (a1 * ka + a2 * kb), iamp * (a3 * ka + a4 * kb)
                    endin
</CsInstruments>
<CsScore>
; cosinus tabel
f 1 0 16384 11 1
; sinus tabel
f 2 0 16384 10 1

; *** lookup-tables
; wielen
;            0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
f 3 0 16 -2 24 30 32 36 40 45 48 52 56 60 63 64 72 75 80 84
; aantal rondjes bij ring 96
f 4 0 16 -2  1  5  1  3  5 15  1 13  7  5 21  2  3 25  5  7
; aantal rondjes bij ring 105
f 5 0 16 -2  8  2 32 12  8  3 16 52  8  4  3 64 24  5 16  4
; ringen
f 6 0  2 -2 96 105

; *** figuren
; wielen
f 10 0 8 -2  0 14 14 14
; gaten
f 11 0 8 -2  5 13 14 15
; fases
f 12 0 8 -2  0  0  0  0

; wielen
f 13 0 16 -2  1  1  1  5  5  5  9  9  9 13 13 13
; gaten
f 14 0 16 -2  1  2  3  6  7  8 11 12 13 16 17 18
; fases
f 15 0 16 -2  0  0  0  0  0  0  0  0  0  0  0  0

; wielen
f 16 0 32 -2  4  8 14 12  0  2 11  6 14 12  0  2 11  6 12  0  2 11  6  2 11  6  6  6
; gaten
f 17 0 32 -2  5  9 15 13  1  3 11  7 15 13  1  3 11  7 13  1  3 11  7  3 11  7  7  7 
; fases
f 18 0 32 -2  0  0  0  0  0  0  0  0  8  8  8  8  8  8 16 16 16 16 16 24 24 24 32 40

; wielen
f 19 0 16 -2  1  1  1  1  1  5  5  5  5  5  9  9  9  9  9
; gaten
f 20 0 16 -2  1  2  3  4  5  1  2  3  4  5  1  2  3  4  5
; fases
f 21 0 16 -2  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0

; wielen
f 22 0 8 -2    9    9    9    9    9    9    9    9    9
; gaten
f 23 0 8 -2    1    2    3    2    3    4    5    4    5
; fases
f 24 0 8 -2    0  0.5    1 -0.5   -1  1.5    2 -1.5    2

; 10000 keer herhalen
r 100
; een wiel
;ins start dur ring
i1       0  30    0
i1       +   .    1
; vaste figuren
;ins start dur ring fig aant
i2       60  5    1  10    4
i2       +   .    1  13   12
i2       +   .    0  16   24
i2       +   .    1  19   15
i2       +   .    1  22    9
s
e
</CsScore>
</CsoundSynthesizer>

LasVegas

Tkkrlab arduino las vegas.jpg

LasVegas slot machine controlled by OSC


Floppy Jukebox

Floppy Jukebox Music from floppy drives with discolights controlled by OSC


Csound Drone

Csound is a language to describe waveforms (orchestras) and music scores. It supports OSC. Csound Drone based on a Csound program by Michael Gogins which is controllable via a Python script. The original program is part of his Csound Algorithmic Composition Tutorial. Two versions are available: Csound Drone for Android Fingerplay and Csound Drone for Databender

Csound Drone for Android Fingerplay

Csound Drone for Android Fingerplay is a OSC server which can be controlled the Android OSC client Fingerplay. The Fingerplay parameters are:

 /fingerplay/control/2
 /fingerplay/control/3
 /fingerplay/control/5
 /fingerplay/control/6

which corresponds to the XY-pads of Fingerplay. They are coupled to the following Csound Drone parameters:

 kdistortfactor
 kfeedback
 kharmonic
 kdisttable

Source

OSC to DMX

DMX control from linux

- If DMX is controlled by a http://rs485-rs422.com/ USB to DMX cable then you can control it with the libftdi to send DMX command's. - libftdi also be use on a OpenWRT linux based. - User:Hfmanson has dmxconsole.c modified to work with libftdi. Sources soon.

OSC to DMX programma

User:Hfmanson wrote udpserv100fat.c that also use libftdi to listen to a UDP poort for a OSC messages a la 100% FAT and send them to a DMX device.

OSC mix panel

During the databending event we used Heinze's tool for connecting the devices. User:Hfmanson has developed a web version of this tool. With this java webaplication databending devices can be controlled, a device has to register with this webapplication and the user can control all the devices via a realtime interactieve webpage. Used technologies are Ajax en HTML5 Server Sent Events.

Ajax is used for changing OSC devices or users (e.g. connecting in- and output devices). Server Sent Events for pushing of OSC output data (eg. jostick values). see http://mansoft.nl:8080/sse/osc.html.

OSC and Python

Also see OSC_Python page for more examples.