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
The existing: Polymorphic Temporal Media ◦ Atomic media m 1 m 2 ◦ m 1 :+: m 2 m 1 m 2 ◦ m 1 :=: m 2 m 2 m 1 3 / 23
Tiles for multiscale modeling As example, Bob Dylan’s song “Blowin in the wind” Music and lyrics have different structures 4 / 23
Tiles for multiscale modeling As example, Bob Dylan’s song “Blowin in the wind” Music and lyrics have different structures � | roads � �� � must a | man � walk | down � be | fore How many � �� � �� � �� � �� � you | call him � a | man � �� � �� � 4 / 23
Tiles for multiscale modeling As example, Bob Dylan’s song “Blowin in the wind” Music and lyrics have different structures � | roads � �� � must a | man � walk | down � be | fore How many � �� � �� � �� � �� � you | call him � a | man � �� � �� � How can we represent both structures? 4 / 23
Tiling by bars: How many roads must a man walk down 5 / 23
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
Tiled Polymorphic Temporal Media pre polymorphic temporal media post 6 / 23
Tiled Polymorphic Temporal Media pre polymorphic temporal media post t 1 synchronization t 2 merge t 1 % t 2 6 / 23
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
Construction primitives of TPTM delay :: Duration -> Tile a event :: a -> Tile a (%) :: Tile a -> Tile a -> Tile a 8 / 23
Construction primitives of TPTM delay :: Duration -> Tile a event :: a -> Tile a (%) :: Tile a -> Tile a -> Tile a event e delay( − 2) − 2 e 8 / 23
Syntactic representation of tiles This syntax describe “zigzag” tiles: 1 -2 a 2 b c 2 d -5 e 2 f 1 time 9 / 23
Syntactic representation of tiles This syntax describe “zigzag” tiles: 1 -2 a 2 b c 2 d -5 e 2 f 1 time In order to play it we have to order the events: -2 1 1 2 a , c e b f d 1 -2 9 / 23
On-the-fly normalization headT :: Tile a -> Tile a tailT :: Tile a -> Tile a -2 e headT t 3 a -2 b 2 c 2 d -3 tailT t f 1 t ≡ headT t % tailT t 10 / 23
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
μ 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
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 40000 35000 heatT execution time in μ s 30000 25000 20000 15000 10000 5000 0 0 500 1000 1500 2000 event rank 12 / 23
μ Problem 2: right parenthesized tiles The first event to be played can be the deepest leaf of an imbalanced syntactic tree. 13 / 23
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 120000 100000 headT execution time in μ s 80000 60000 40000 20000 0 0 500 1000 1500 2000 event rank 13 / 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) 14 / 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 500 400 headT execution time in μ s 300 200 100 0 0 500 1000 1500 2000 event rank 14 / 23
New implementation principle A tile is composed of: ◦ two markers ◦ a set of event positioned in time relatively to the pre marker duration 0 time line a c b d 15 / 23
New implementation code data Tile e = Tile Duration ( SHeap e) 16 / 23
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
Correspondence between the heaped implementation and syntactic implementation 1 b -3 a 2 c 2 2 -2 3 b a c 2 17 / 23
Tiled product implementation ( Tile d1 h1) % ( Tile d2 h2) = Tile (d1 + d2) (mergeSH h1 (shiftSH d1 h2)) 18 / 23
Tiled product implementation ( Tile d1 h1) % ( Tile d2 h2) = Tile (d1 + d2) (mergeSH h1 (shiftSH d1 h2)) 3 -1 c 1 a 1 2 2 b 1 d 1 2
Tiled product implementation ( Tile d1 h1) % ( Tile d2 h2) = Tile (d1 + d2) (mergeSH h1 (shiftSH d1 h2)) 3 1 -2 c 2 -1 a 2 3 2 b 2 d 2 1 c 1 a 1 2 2 b 1 d 1 2 18 / 23
Tiled product implementation ( Tile d1 h1) % ( Tile d2 h2) = Tile (d1 + d2) (mergeSH h1 (shiftSH d1 h2)) 4 -1 b 1 2 d 1 2 a 1 c 2 2 a 2 , c 1 3 b 2 2 d 2 1 19 / 23
Skew heaps merge merge d 1 d 2 ◦ here the case e 1 d 1 < d 2 e 2 r 1 ◦ All rightmost paths l 1 r 2 l 2 are short ⇒ d 1 e 1 ◦ merge following the merge rightmost path l 1 d 2 − d 1 ◦ swap childs so the e 2 r 1 tree grows from the inside r 2 l 2 20 / 23
Amortized complexity n e is the number of events in the tile % headT tailT O (log( n e )) O (1) O (log( n e )) Space complexity: O ( n e ) 21 / 23
A word on infinite tiles With syntactic encoding: d 1 d 2 d 3 d 4 a c a b � − d i = ⊥ 22 / 23
A word on infinite tiles With syntactic encoding: d 1 d 2 d 3 d 4 a c a b � − d i = ⊥ With our implementation: d 1 a d 2 b c a d 3 d 4 22 / 23
Summary Thank you � 23 / 23
Recommend
More recommend