An Efficient Implementation of Tiled Polymorphic Temporal Media Simon - - PowerPoint PPT Presentation

an efficient implementation of tiled polymorphic temporal
SMART_READER_LITE
LIVE PREVIEW

An Efficient Implementation of Tiled Polymorphic Temporal Media Simon - - PowerPoint PPT Presentation

An Efficient Implementation of Tiled Polymorphic Temporal Media Simon Archipoff LaBRI FARM, 2015 1 / 23 Research Context Tools and method for conception and interpretation of musical performances We want them: Simple Reliable 2 / 23


slide-1
SLIDE 1

An Efficient Implementation of Tiled Polymorphic Temporal Media

Simon Archipoff

LaBRI FARM, 2015

1 / 23

slide-2
SLIDE 2

Research Context

Tools and method for conception and interpretation of musical performances We want them:

  • Simple
  • Reliable

2 / 23

slide-3
SLIDE 3

The existing: Polymorphic Temporal Media

  • Atomic media

m1 m2

  • m1 :+: m2

m1 m2

  • m1 :=: m2

m1 m2

3 / 23

slide-4
SLIDE 4

Tiles for multiscale modeling

As example, Bob Dylan’s song “Blowin in the wind” Music and lyrics have different structures

4 / 23

slide-5
SLIDE 5

Tiles for multiscale modeling

As example, Bob Dylan’s song “Blowin in the wind” Music and lyrics have different structures

How many

  • |roads

must a|man

  • walk|down
  • be|fore
  • you|call him
  • a|man
  • 4 / 23
slide-6
SLIDE 6

Tiles for multiscale modeling

As example, Bob Dylan’s song “Blowin in the wind” Music and lyrics have different structures

How many

  • |roads

must a|man

  • walk|down
  • be|fore
  • you|call him
  • a|man
  • How can we represent both structures?

4 / 23

slide-7
SLIDE 7

Tiling by bars: How many roads must a man walk down

5 / 23

slide-8
SLIDE 8

Tiling by bars: How many roads must a man walk down Tiling by 4 bars/verses: How many roads. . . down before you call him a man?

5 / 23

slide-9
SLIDE 9

Tiled Polymorphic Temporal Media

pre polymorphic temporal media post

6 / 23

slide-10
SLIDE 10

Tiled Polymorphic Temporal Media

pre polymorphic temporal media post synchronization merge t1 t2 t1 % t2

6 / 23

slide-11
SLIDE 11

Goal

Write a player for tiles that is:

  • real-time
  • polymorphic (Audio, MIDI, OSC, arbitrary IO,. . . )

We start from a syntactic implementation of TPTM

7 / 23

slide-12
SLIDE 12

Construction primitives of TPTM

delay :: Duration -> Tile a event :: a -> Tile a (%) :: Tile a -> Tile a -> Tile a

8 / 23

slide-13
SLIDE 13

Construction primitives of TPTM

delay :: Duration -> Tile a event :: a -> Tile a (%) :: Tile a -> Tile a -> Tile a delay(−2) −2 event e e

8 / 23

slide-14
SLIDE 14

Syntactic representation of tiles

This syntax describe “zigzag” tiles: a b c d e f 1 2

  • 5

2 2

  • 2

1 time

9 / 23

slide-15
SLIDE 15

Syntactic representation of tiles

This syntax describe “zigzag” tiles: a b c d e f 1 2

  • 5

2 2

  • 2

1 time In order to play it we have to order the events: e b f a, c d

  • 2

2 1 1 1

  • 2

9 / 23

slide-16
SLIDE 16

On-the-fly normalization

headT :: Tile a -> Tile a tailT :: Tile a -> Tile a e

  • 2

headT t a b c d f 1

  • 3

2 2

  • 2

3 tailT t t ≡ headT t % tailT t

10 / 23

slide-17
SLIDE 17

Normal form

norm t = headT t % headT(tailT t) % headT(tailT 2 t) % headT(tailT 3 t) . . . In order to compute a normal form in real time, we need good algorithmic properties for headT and tailT Syntactic implementations suffer from two problems

11 / 23

slide-18
SLIDE 18

Problem 1: Accumulation of delays

No bound to the number of delays in the syntactic representation delay a % delay b ≡ delay(a + b)

μ 12 / 23

slide-19
SLIDE 19

Problem 1: Accumulation of delays

No bound to the number of delays in the syntactic representation delay a % delay b ≡ delay(a + b) Example: normalization with a naive implementation of tailT

5000 10000 15000 20000 25000 30000 35000 40000 500 1000 1500 2000 heatT execution time in μs event rank 12 / 23

slide-20
SLIDE 20

Problem 2: right parenthesized tiles

The first event to be played can be the deepest leaf of an imbalanced syntactic tree.

μ 13 / 23

slide-21
SLIDE 21

Problem 2: right parenthesized tiles

The first event to be played can be the deepest leaf of an imbalanced syntactic tree. Example: normalization of a right parenthesized tile

20000 40000 60000 80000 100000 120000 500 1000 1500 2000 headT execution time in μs event rank 13 / 23

slide-22
SLIDE 22

With the proposed implementation

  • The number of delay is linear in the number of events (problem 1 solved)
  • The structure is balanced (problem 2 solved)

μ 14 / 23

slide-23
SLIDE 23

With the proposed implementation

  • The number of delay is linear in the number of events (problem 1 solved)
  • The structure is balanced (problem 2 solved)

Example: the same right parenthesized tile as before

100 200 300 400 500 500 1000 1500 2000 headT execution time in μs event rank 14 / 23

slide-24
SLIDE 24

New implementation principle

A tile is composed of:

  • two markers
  • a set of event positioned in time relatively to the pre marker

duration time line a b c d

15 / 23

slide-25
SLIDE 25

New implementation code

data Tile e = Tile Duration (SHeap e)

16 / 23

slide-26
SLIDE 26

New implementation code

data Tile e = Tile Duration (SHeap e) The set of event is implemented by Sleator and Tarjan’s skew heap: data SHeap a = Empty | SHeap Duration (MSet a) (SHeap a) (SHeap a)

16 / 23

slide-27
SLIDE 27

Correspondence between the heaped implementation and syntactic implementation

b a c 2 2

  • 3

1 2 a c 2 b 3

  • 2

17 / 23

slide-28
SLIDE 28

Tiled product implementation

(Tile d1 h1) % (Tile d2 h2) = Tile (d1 + d2) (mergeSH h1 (shiftSH d1 h2))

18 / 23

slide-29
SLIDE 29

Tiled product implementation

(Tile d1 h1) % (Tile d2 h2) = Tile (d1 + d2) (mergeSH h1 (shiftSH d1 h2)) 3 a1 b1 d1 2 2 c1 2

  • 1
slide-30
SLIDE 30

Tiled product implementation

(Tile d1 h1) % (Tile d2 h2) = Tile (d1 + d2) (mergeSH h1 (shiftSH d1 h2)) 3 a1 b1 d1 2 2 c1 2

  • 1

1 a2 b2 d2 c2 1 2 3

  • 2

18 / 23

slide-31
SLIDE 31

Tiled product implementation

(Tile d1 h1) % (Tile d2 h2) = Tile (d1 + d2) (mergeSH h1 (shiftSH d1 h2)) 4 a1 a2, c1 b2 d2 1 2 c2 3 2 b1 d1 2 2

  • 1

19 / 23

slide-32
SLIDE 32

Skew heaps merge

  • here the case

d1 < d2

  • All rightmost paths

are short

  • merge following the

rightmost path

  • swap childs so the

tree grows from the inside merge e1 l1 r1 d1 e2 l2 r2 d2

merge e1 l1 d1 e2 l2 r2 d2 − d1 r1

20 / 23

slide-33
SLIDE 33

Amortized complexity

ne is the number of events in the tile % headT tailT O(log(ne)) O(1) O(log(ne)) Space complexity: O(ne)

21 / 23

slide-34
SLIDE 34

A word on infinite tiles

With syntactic encoding: a b c a

  • −di = ⊥

d4 d3 d2 d1

22 / 23

slide-35
SLIDE 35

A word on infinite tiles

With syntactic encoding: a b c a

  • −di = ⊥

d4 d3 d2 d1 With our implementation: a b c a d4 d3 d2 d1

22 / 23

slide-36
SLIDE 36

Summary Thank you

23 / 23