The Shepard Tone and Higher-Order Multi-rate Synchronous Data-Flow - - PowerPoint PPT Presentation

the shepard tone and higher order multi rate synchronous
SMART_READER_LITE
LIVE PREVIEW

The Shepard Tone and Higher-Order Multi-rate Synchronous Data-Flow - - PowerPoint PPT Presentation

Exposition Development Recapitulation The Shepard Tone and Higher-Order Multi-rate Synchronous Data-Flow Programming in S IG Baltasar Trancn y Widemann Markus Lepper Ilmenau University of Technology semantics GmbH FARM 2015-09-05


slide-1
SLIDE 1

Exposition Development Recapitulation

The Shepard Tone and Higher-Order Multi-rate Synchronous Data-Flow Programming in SIG

◮ Baltasar Trancón y Widemann Markus Lepper

Ilmenau University of Technology semantics GmbH

FARM 2015-09-05

Trancón y Widemann, Lepper Shepard @ SIG 0 / 15

slide-2
SLIDE 2

Exposition Development Recapitulation SIG Shepard

Agenda

1

Exposition Main Theme: SIG in a Nutshell Countertheme: The Shepard Tone

2

Development Higher-Order Stream Programming Multi-rate Stream Programming

3

Recapitulation Putting Things Together Conclusion

Trancón y Widemann, Lepper Shepard @ SIG 0 / 15

slide-3
SLIDE 3

Exposition Development Recapitulation SIG Shepard

Spoiler

Synchronous Functional Data-Flow Language

Similar but not quite FRP New features under development

Classical sound construction

Small but nontrivial synthesis problem Ideal application of new features

Trancón y Widemann, Lepper Shepard @ SIG 1 / 15

slide-4
SLIDE 4

Exposition Development Recapitulation SIG Shepard

Spoiler

Synchronous Functional Data-Flow Language

Similar but not quite FRP New features under development

Classical sound construction

Small but nontrivial synthesis problem Ideal application of new features

Trancón y Widemann, Lepper Shepard @ SIG 1 / 15

slide-5
SLIDE 5

Exposition Development Recapitulation SIG Shepard

Agenda

1

Exposition Main Theme: SIG in a Nutshell Countertheme: The Shepard Tone

2

Development Higher-Order Stream Programming Multi-rate Stream Programming

3

Recapitulation Putting Things Together Conclusion

Trancón y Widemann, Lepper Shepard @ SIG 1 / 15

slide-6
SLIDE 6

Exposition Development Recapitulation SIG Shepard

Context: The SIG Language

Total Functional no effects, events, recursion Clocked Synchronous variables are mutated regularly Data Flow control flow by data dependency Real-time execution model

pull-based, ultra-low latency

Applications: embedded control, simulation, audio, . . . Backends: JVM (C, DSP , FPGA, . . . ) Layered design

Core language with simple compositional semantics Functional frontend: ADTs, pattern matching, higher order Advanced features: physical units, multi-rate

Semantics of higher layers by transformation

Trancón y Widemann, Lepper Shepard @ SIG 2 / 15

slide-7
SLIDE 7

Exposition Development Recapitulation SIG Shepard

Context: The SIG Language

Total Functional no effects, events, recursion Clocked Synchronous variables are mutated regularly Data Flow control flow by data dependency Real-time execution model

pull-based, ultra-low latency

Applications: embedded control, simulation, audio, . . . Backends: JVM (C, DSP , FPGA, . . . ) Layered design

Core language with simple compositional semantics Functional frontend: ADTs, pattern matching, higher order Advanced features: physical units, multi-rate

Semantics of higher layers by transformation

Trancón y Widemann, Lepper Shepard @ SIG 2 / 15

slide-8
SLIDE 8

Exposition Development Recapitulation SIG Shepard

Context: The SIG Language

Total Functional no effects, events, recursion Clocked Synchronous variables are mutated regularly Data Flow control flow by data dependency Real-time execution model

pull-based, ultra-low latency

Applications: embedded control, simulation, audio, . . . Backends: JVM (C, DSP , FPGA, . . . ) Layered design

Core language with simple compositional semantics Functional frontend: ADTs, pattern matching, higher order Advanced features: physical units, multi-rate

Semantics of higher layers by transformation

Trancón y Widemann, Lepper Shepard @ SIG 2 / 15

slide-9
SLIDE 9

Exposition Development Recapitulation SIG Shepard

Context: The SIG Language

Total Functional no effects, events, recursion Clocked Synchronous variables are mutated regularly Data Flow control flow by data dependency Real-time execution model

pull-based, ultra-low latency

Applications: embedded control, simulation, audio, . . . Backends: JVM (C, DSP , FPGA, . . . ) Layered design

Core language with simple compositional semantics Functional frontend: ADTs, pattern matching, higher order Advanced features: physical units, multi-rate

Semantics of higher layers by transformation

Trancón y Widemann, Lepper Shepard @ SIG 2 / 15

slide-10
SLIDE 10

Exposition Development Recapitulation SIG Shepard

Basic Example: Cumulative Sum

  • x → s

s := 0 (s + x)

  • x → s

s := (0 s) + x

  • Trancón y Widemann, Lepper

Shepard @ SIG 3 / 15

slide-11
SLIDE 11

Exposition Development Recapitulation SIG Shepard

Basic Example: Cumulative Sum

  • x → s

s := 0 (s + x)

  • +

δ x s

  • x → s

s := (0 s) + x

  • +

δ x s

Trancón y Widemann, Lepper Shepard @ SIG 3 / 15

slide-12
SLIDE 12

Exposition Development Recapitulation SIG Shepard

Basic Example: Cumulative Sum

  • x → s

s := 0 (s + x)

  • +

x s

  • x → s

s := (0 s) + x

  • +

x s

Trancón y Widemann, Lepper Shepard @ SIG 3 / 15

slide-13
SLIDE 13

Exposition Development Recapitulation SIG Shepard

Basic Example: Cumulative Sum

  • x → s

s := 0 (s + x)

  • +

x0 s0 + x1 s1 . . .

  • x → s

s := (0 s) + x

  • +

x0 s0 + x1 s1 . . .

Trancón y Widemann, Lepper Shepard @ SIG 3 / 15

slide-14
SLIDE 14

Exposition Development Recapitulation SIG Shepard

Basic Example: Cumulative Sum

  • x → s

s := 0 (s + x)

  • +

x0 s0 + x1 s1 . . . s0 = 0 sn+1 = sn + xn sn =

  • i<n

xi

  • x → s

s := (0 s) + x

  • +

x0 s0 + x1 s1 . . . s0 = xn sn+1 = sn + xn+1 sn =

  • i n

xi

Trancón y Widemann, Lepper Shepard @ SIG 3 / 15

slide-15
SLIDE 15

Exposition Development Recapitulation SIG Shepard

Agenda

1

Exposition Main Theme: SIG in a Nutshell Countertheme: The Shepard Tone

2

Development Higher-Order Stream Programming Multi-rate Stream Programming

3

Recapitulation Putting Things Together Conclusion

Trancón y Widemann, Lepper Shepard @ SIG 3 / 15

slide-16
SLIDE 16

Exposition Development Recapitulation SIG Shepard

What is it?

Psychoacoustic illusion (Shepard 1964; Risset 1986)

Contradictory short/long-term pitch perception

Auditory strange loop, analog of this. . .

  • r that. . .

Small but nontrivial sound synthesis problem

Full SIG code in the paper!

Trancón y Widemann, Lepper Shepard @ SIG 4 / 15

slide-17
SLIDE 17

Exposition Development Recapitulation SIG Shepard

What is it?

Psychoacoustic illusion (Shepard 1964; Risset 1986)

Contradictory short/long-term pitch perception

Auditory strange loop, analog of this. . .

  • r that. . .

Small but nontrivial sound synthesis problem

Full SIG code in the paper!

Trancón y Widemann, Lepper Shepard @ SIG 4 / 15

slide-18
SLIDE 18

Exposition Development Recapitulation SIG Shepard

What is it?

Psychoacoustic illusion (Shepard 1964; Risset 1986)

Contradictory short/long-term pitch perception

Auditory strange loop, analog of this. . .

  • r that. . .

Small but nontrivial sound synthesis problem

Full SIG code in the paper!

Trancón y Widemann, Lepper Shepard @ SIG 4 / 15

slide-19
SLIDE 19

Exposition Development Recapitulation SIG Shepard

What is it?

Psychoacoustic illusion (Shepard 1964; Risset 1986)

Contradictory short/long-term pitch perception

Auditory strange loop, analog of this. . .

  • r that. . .

Small but nontrivial sound synthesis problem

Full SIG code in the paper!

Trancón y Widemann, Lepper Shepard @ SIG 4 / 15

slide-20
SLIDE 20

Exposition Development Recapitulation SIG Shepard

Specification

Pitch Time pmin pbase pmax

  • ivl

t1

(2r+1 voices)

Amplitude Pitch pmin pbase pmax 1

ivl r·ivl

  • Trancón y Widemann, Lepper

Shepard @ SIG 5 / 15

slide-21
SLIDE 21

Exposition Development Recapitulation SIG Shepard

Specification

Pitch Time pmin pbase pmax

  • ivl

t1

(2r+1 voices)

Amplitude Pitch pmin pbase pmax 1

ivl r·ivl

  • Trancón y Widemann, Lepper

Shepard @ SIG 5 / 15

slide-22
SLIDE 22

Exposition Development Recapitulation SIG Shepard

Specification

Pitch Time pmin pbase pmax

  • ivl

t1

(2r+1 voices)

Amplitude Pitch pmin pbase pmax 1

ivl r·ivl

  • Trancón y Widemann, Lepper

Shepard @ SIG 5 / 15

slide-23
SLIDE 23

Exposition Development Recapitulation Higher-Order Multi-rate

Agenda

1

Exposition Main Theme: SIG in a Nutshell Countertheme: The Shepard Tone

2

Development Higher-Order Stream Programming Multi-rate Stream Programming

3

Recapitulation Putting Things Together Conclusion

Trancón y Widemann, Lepper Shepard @ SIG 5 / 15

slide-24
SLIDE 24

Exposition Development Recapitulation Higher-Order Multi-rate

Agenda

1

Exposition Main Theme: SIG in a Nutshell Countertheme: The Shepard Tone

2

Development Higher-Order Stream Programming Multi-rate Stream Programming

3

Recapitulation Putting Things Together Conclusion

Trancón y Widemann, Lepper Shepard @ SIG 5 / 15

slide-25
SLIDE 25

Exposition Development Recapitulation Higher-Order Multi-rate

Lambdas Got (Too Much) Rhythm

Higher-order functions increase expressivity Combination with time-varying values nontrivial (Uustalu and Vene 2005) At odds with SIG paradigms

Every variable is a stream Streams are synchronized

Counterexample: Currying

Trancón y Widemann, Lepper Shepard @ SIG 6 / 15

slide-26
SLIDE 26

Exposition Development Recapitulation Higher-Order Multi-rate

Lambdas Got (Too Much) Rhythm

Higher-order functions increase expressivity Combination with time-varying values nontrivial (Uustalu and Vene 2005) At odds with SIG paradigms

Every variable is a stream Streams are synchronized

Counterexample: Currying

Trancón y Widemann, Lepper Shepard @ SIG 6 / 15

slide-27
SLIDE 27

Exposition Development Recapitulation Higher-Order Multi-rate

Lambdas Got (Too Much) Rhythm

Higher-order functions increase expressivity Combination with time-varying values nontrivial (Uustalu and Vene 2005) At odds with SIG paradigms

Every variable is a stream Streams are synchronized

Counterexample: Currying

  • x, y → z

z := x + y

  • zi = xi + yi

    x → f f :=

  • y → z

z := x + y

   fi = {y → z | zj = xi + yj}

Trancón y Widemann, Lepper Shepard @ SIG 6 / 15

slide-28
SLIDE 28

Exposition Development Recapitulation Higher-Order Multi-rate

Lambdas Got (Too Much) Rhythm

Higher-order functions increase expressivity Combination with time-varying values nontrivial (Uustalu and Vene 2005) At odds with SIG paradigms

Every variable is a stream Streams are synchronized

Counterexample: Currying

  • x, y → z

z := x + y

  • zi = xi + yi

    x → f f :=

  • y → z

z := x + y

   fi = {y → z | zj = xi + yj}

Trancón y Widemann, Lepper Shepard @ SIG 6 / 15

slide-29
SLIDE 29

Exposition Development Recapitulation Higher-Order Multi-rate

Lambdas Got (Too Much) Rhythm

Higher-order functions increase expressivity Combination with time-varying values nontrivial (Uustalu and Vene 2005) At odds with SIG paradigms

Every variable is a stream Streams are synchronized

Counterexample: Currying

  • x, y → z

z := x + y

  • zi = xi + yi

    x → f f :=

  • y → z

z := x + y

   fi = {y → z | zj = xi + yj}

Trancón y Widemann, Lepper Shepard @ SIG 6 / 15

slide-30
SLIDE 30

Exposition Development Recapitulation Higher-Order Multi-rate

Lambdas Got (Too Much) Rhythm

Higher-order functions increase expressivity Combination with time-varying values nontrivial (Uustalu and Vene 2005) At odds with SIG paradigms

Every variable is a stream Streams are synchronized

Counterexample: Currying

  • x, y → z

z := x + y

  • zi = xi + yi

    x → f f :=

  • y → z

z := x + y

   fi = {y → z | zj = xi + yj}

Trancón y Widemann, Lepper Shepard @ SIG 6 / 15

slide-31
SLIDE 31

Exposition Development Recapitulation Higher-Order Multi-rate

To the Rescue: Staged Meta-Programming

Operators for explicit control over evaluation order

Suspend defers computation until next stage Splice escapes computation from next stage Run proceeds to next stage

Similar to LISP quasiquotation

Confer ❵ / ✱ / ❡✈❛❧ But strongly hygienic & typed

Similar to off-line partial evaluation

Binding-time analysis creates two stages Specialization runs first stage But arbitrary number of stages

Considered for adaptive high-performance computing (Kiselyov, Shan, and Kameyama 2012)

Trancón y Widemann, Lepper Shepard @ SIG 7 / 15

slide-32
SLIDE 32

Exposition Development Recapitulation Higher-Order Multi-rate

To the Rescue: Staged Meta-Programming

Operators for explicit control over evaluation order

Suspend defers computation until next stage Splice escapes computation from next stage Run proceeds to next stage

Similar to LISP quasiquotation

Confer ❵ / ✱ / ❡✈❛❧ But strongly hygienic & typed

Similar to off-line partial evaluation

Binding-time analysis creates two stages Specialization runs first stage But arbitrary number of stages

Considered for adaptive high-performance computing (Kiselyov, Shan, and Kameyama 2012)

Trancón y Widemann, Lepper Shepard @ SIG 7 / 15

slide-33
SLIDE 33

Exposition Development Recapitulation Higher-Order Multi-rate

To the Rescue: Staged Meta-Programming

Operators for explicit control over evaluation order

Suspend defers computation until next stage Splice escapes computation from next stage Run proceeds to next stage

Similar to LISP quasiquotation

Confer ❵ / ✱ / ❡✈❛❧ But strongly hygienic & typed

Similar to off-line partial evaluation

Binding-time analysis creates two stages Specialization runs first stage But arbitrary number of stages

Considered for adaptive high-performance computing (Kiselyov, Shan, and Kameyama 2012)

Trancón y Widemann, Lepper Shepard @ SIG 7 / 15

slide-34
SLIDE 34

Exposition Development Recapitulation Higher-Order Multi-rate

To the Rescue: Staged Meta-Programming

Operators for explicit control over evaluation order

Suspend defers computation until next stage Splice escapes computation from next stage Run proceeds to next stage

Similar to LISP quasiquotation

Confer ❵ / ✱ / ❡✈❛❧ But strongly hygienic & typed

Similar to off-line partial evaluation

Binding-time analysis creates two stages Specialization runs first stage But arbitrary number of stages

Considered for adaptive high-performance computing (Kiselyov, Shan, and Kameyama 2012)

Trancón y Widemann, Lepper Shepard @ SIG 7 / 15

slide-35
SLIDE 35

Exposition Development Recapitulation Higher-Order Multi-rate

No Stage Fright in SIG

Operators ★ / ⑦ / ✪ All anonymous functions must be suspended Suspension freezes time

Free variable refers to element at suspension time No implicit cross-stage synchronization

Counterexample Defused

  • x, y → z

z := x + y

  • zi = xi + yi

    x → f f := #

  • y → z

z := x + y

   fi = {y → z | zj = xi + yj}

Trancón y Widemann, Lepper Shepard @ SIG 8 / 15

slide-36
SLIDE 36

Exposition Development Recapitulation Higher-Order Multi-rate

No Stage Fright in SIG

Operators ★ / ⑦ / ✪ All anonymous functions must be suspended Suspension freezes time

Free variable refers to element at suspension time No implicit cross-stage synchronization

Counterexample Defused

  • x, y → z

z := x + y

  • zi = xi + yi

    x → f f := #

  • y → z

z := x + y

   fi = {y → z | zj = xi + yj}

Trancón y Widemann, Lepper Shepard @ SIG 8 / 15

slide-37
SLIDE 37

Exposition Development Recapitulation Higher-Order Multi-rate

No Stage Fright in SIG

Operators ★ / ⑦ / ✪ All anonymous functions must be suspended Suspension freezes time

Free variable refers to element at suspension time No implicit cross-stage synchronization

Counterexample Defused

  • x, y → z

z := x + y

  • zi = xi + yi

    x → f f := #

  • y → z

z := x + y

   fi = {y → z | zj = xi + yj}

Trancón y Widemann, Lepper Shepard @ SIG 8 / 15

slide-38
SLIDE 38

Exposition Development Recapitulation Higher-Order Multi-rate

Agenda

1

Exposition Main Theme: SIG in a Nutshell Countertheme: The Shepard Tone

2

Development Higher-Order Stream Programming Multi-rate Stream Programming

3

Recapitulation Putting Things Together Conclusion

Trancón y Widemann, Lepper Shepard @ SIG 8 / 15

slide-39
SLIDE 39

Exposition Development Recapitulation Higher-Order Multi-rate

Multi-rate Audio Signal Processing

One system, many rates:

Audio waveform @ 44 kHz (CD), 96 kHz (studio) Control parameters @ 1/64 audio, 1 kHz Event 24/quarter (MIDI), 120/minute (techno) Zero Initialization

Asynchronous data flows both ways Modulation parameters from slow to fast Aggregation statistics from fast to slow Configuration components from slow to fast

Trancón y Widemann, Lepper Shepard @ SIG 9 / 15

slide-40
SLIDE 40

Exposition Development Recapitulation Higher-Order Multi-rate

Multi-rate Audio Signal Processing

One system, many rates:

Audio waveform @ 44 kHz (CD), 96 kHz (studio) Control parameters @ 1/64 audio, 1 kHz Event 24/quarter (MIDI), 120/minute (techno) Zero Initialization

Asynchronous data flows both ways Modulation parameters from slow to fast Aggregation statistics from fast to slow Configuration components from slow to fast

Trancón y Widemann, Lepper Shepard @ SIG 9 / 15

slide-41
SLIDE 41

Exposition Development Recapitulation Higher-Order Multi-rate

Multi-rate Audio Signal Processing

One system, many rates:

Audio waveform @ 44 kHz (CD), 96 kHz (studio) Control parameters @ 1/64 audio, 1 kHz Event 24/quarter (MIDI), 120/minute (techno) Zero Initialization

Asynchronous data flows both ways Modulation parameters from slow to fast Aggregation statistics from fast to slow Configuration components from slow to fast

Trancón y Widemann, Lepper Shepard @ SIG 9 / 15

slide-42
SLIDE 42

Exposition Development Recapitulation Higher-Order Multi-rate

Multi-rate SIG

  • x → y

y := 0 y + x ∗ dt

  • SIG programs have implicit rate

Components reusable at different rates (polydromic) But possibly reflected as local constant Passive execution model, external driver

Data flow is synchronous by default

Rate equations Independent subsystems possibly at different rates

Exceptions by explicit resampling

Rate inequations Fixed conversion factors

Trancón y Widemann, Lepper Shepard @ SIG 10 / 15

slide-43
SLIDE 43

Exposition Development Recapitulation Higher-Order Multi-rate

Multi-rate SIG

  • x → y

y := 0 y + x ∗ dt

  • SIG programs have implicit rate

Components reusable at different rates (polydromic) But possibly reflected as local constant Passive execution model, external driver

Data flow is synchronous by default

Rate equations Independent subsystems possibly at different rates

Exceptions by explicit resampling

Rate inequations Fixed conversion factors

Trancón y Widemann, Lepper Shepard @ SIG 10 / 15

slide-44
SLIDE 44

Exposition Development Recapitulation Higher-Order Multi-rate

Multi-rate SIG

  • x → y

y := 0 y + x ∗ dt

  • SIG programs have implicit rate

Components reusable at different rates (polydromic) But possibly reflected as local constant Passive execution model, external driver

Data flow is synchronous by default

Rate equations Independent subsystems possibly at different rates

Exceptions by explicit resampling

Rate inequations Fixed conversion factors

Trancón y Widemann, Lepper Shepard @ SIG 10 / 15

slide-45
SLIDE 45

Exposition Development Recapitulation Higher-Order Multi-rate

Implementation Strategy

#    → out

  • ut := upsample amp ∗ sin phase

phase := 0 phase + freq ∗ dt    Amplitude modulated, frequency fixed Static rate analysis R(amp)

  • R1

R(phase) = R(out)

  • R2

Slicing into synchronous subcomponents Buffered asynchronous data flow behind the scenes

Well-defined scheduling rules

Trancón y Widemann, Lepper Shepard @ SIG 11 / 15

slide-46
SLIDE 46

Exposition Development Recapitulation Higher-Order Multi-rate

Implementation Strategy

#    amp → out

  • ut := upsample amp ∗ sin phase

phase := 0 phase + freq ∗ dt    Amplitude modulated, frequency fixed Static rate analysis R(amp)

  • R1

R(phase) = R(out)

  • R2

Slicing into synchronous subcomponents Buffered asynchronous data flow behind the scenes

Well-defined scheduling rules

Trancón y Widemann, Lepper Shepard @ SIG 11 / 15

slide-47
SLIDE 47

Exposition Development Recapitulation Higher-Order Multi-rate

Implementation Strategy

#    amp → out

  • ut := upsample amp ∗ sin phase

phase := 0 phase + freq ∗ dt    Amplitude modulated, frequency fixed Static rate analysis R(amp)

  • R1

R(phase) = R(out)

  • R2

Slicing into synchronous subcomponents Buffered asynchronous data flow behind the scenes

Well-defined scheduling rules

Trancón y Widemann, Lepper Shepard @ SIG 11 / 15

slide-48
SLIDE 48

Exposition Development Recapitulation Higher-Order Multi-rate

Implementation Strategy

#

  • amp →

amp− := amp

  • #

   → out

  • ut := amp+ ∗ sin phase

phase := 0 phase + freq ∗ dt    Amplitude modulated, frequency fixed Static rate analysis R(amp)

  • R1

R(phase) = R(out)

  • R2

Slicing into synchronous subcomponents Buffered asynchronous data flow behind the scenes

Well-defined scheduling rules

Trancón y Widemann, Lepper Shepard @ SIG 11 / 15

slide-49
SLIDE 49

Exposition Development Recapitulation Higher-Order Multi-rate

Implementation Strategy

#

  • amp → amp−

amp− := amp

  • #

   amp+ → out

  • ut := amp+ ∗ sin phase

phase := 0 phase + freq ∗ dt    Amplitude modulated, frequency fixed Static rate analysis R(amp)

  • R1

R(phase) = R(out)

  • R2

Slicing into synchronous subcomponents Buffered asynchronous data flow behind the scenes

Well-defined scheduling rules

Trancón y Widemann, Lepper Shepard @ SIG 11 / 15

slide-50
SLIDE 50

Exposition Development Recapitulation Application Conclusion

Agenda

1

Exposition Main Theme: SIG in a Nutshell Countertheme: The Shepard Tone

2

Development Higher-Order Stream Programming Multi-rate Stream Programming

3

Recapitulation Putting Things Together Conclusion

Trancón y Widemann, Lepper Shepard @ SIG 11 / 15

slide-51
SLIDE 51

Exposition Development Recapitulation Application Conclusion

Agenda

1

Exposition Main Theme: SIG in a Nutshell Countertheme: The Shepard Tone

2

Development Higher-Order Stream Programming Multi-rate Stream Programming

3

Recapitulation Putting Things Together Conclusion

Trancón y Widemann, Lepper Shepard @ SIG 11 / 15

slide-52
SLIDE 52

Exposition Development Recapitulation Application Conclusion

The Shepard Tone in SIG

Straightforward architecture

Three tiers, loosely corresponding to three rates Two-stage (curried) config/runtime separation each

Not quite trivial code

27 LoC, as detailed in the paper References to primitives not discussed here

Trancón y Widemann, Lepper Shepard @ SIG 12 / 15

slide-53
SLIDE 53

Exposition Development Recapitulation Application Conclusion

Top-Down Walkthrough

1

Ensemble maintains an array of live voices (functions)

shift at rate R1 driven by external clock

  • utputs mixed together

2

Voice modulates oscillator (amp+freq)

linear pitch increase quantized at rate R2 driven by subdivided clock

3

Oscillator maintains phase continuity

envelope, waveform global function-valued parameters sample at audio rate R3 driven by RT audio system

shepard_2 := #[ clk_1 : void −> s_out : real where make := #[ k : int −> m_out := $voice(k ∗ ivl, ivl / dt(clk_1)) ] ensemble @ clk_1 := %make(seq(−r, +r)) ; shiftr(%make(−r), ensemble) s_out := sum(ensemble(upsample(clk_1, res))) ]

Trancón y Widemann, Lepper Shepard @ SIG 13 / 15

slide-54
SLIDE 54

Exposition Development Recapitulation Application Conclusion

Top-Down Walkthrough

1

Ensemble maintains an array of live voices (functions)

shift at rate R1 driven by external clock

  • utputs mixed together

2

Voice modulates oscillator (amp+freq)

linear pitch increase quantized at rate R2 driven by subdivided clock

3

Oscillator maintains phase continuity

envelope, waveform global function-valued parameters sample at audio rate R3 driven by RT audio system

voice := #[ init_pitch , ascent : real −> voice_2 := #[ clk_2 : void −> v_out : real where pitch @ clk_2 := init_pitch ; pitch + ascent ∗ dt v_out := $($osci(0))( $envelope(pitch), base_freq ∗ exp(pitch)) ] }

Trancón y Widemann, Lepper Shepard @ SIG 13 / 15

slide-55
SLIDE 55

Exposition Development Recapitulation Application Conclusion

Top-Down Walkthrough

1

Ensemble maintains an array of live voices (functions)

shift at rate R1 driven by external clock

  • utputs mixed together

2

Voice modulates oscillator (amp+freq)

linear pitch increase quantized at rate R2 driven by subdivided clock

3

Oscillator maintains phase continuity

envelope, waveform global function-valued parameters sample at audio rate R3 driven by RT audio system

  • sci := #[ init_phase : real −>
  • sci_2 := #[ amp, freq : real −> o_out : real

where phase := init_phase ; phase + upsample(freq) ∗ dt

  • _out := upsample(amp) ∗ $wave(phase)

] ]

Trancón y Widemann, Lepper Shepard @ SIG 13 / 15

slide-56
SLIDE 56

Exposition Development Recapitulation Application Conclusion

Agenda

1

Exposition Main Theme: SIG in a Nutshell Countertheme: The Shepard Tone

2

Development Higher-Order Stream Programming Multi-rate Stream Programming

3

Recapitulation Putting Things Together Conclusion

Trancón y Widemann, Lepper Shepard @ SIG 13 / 15

slide-57
SLIDE 57

Exposition Development Recapitulation Application Conclusion

Implementation Status

Textual frontend language compiles to Java VM Various advances features implemented

ADTs & pattern matching Staged higher-order components

Runtime environment complete

Including multi-rate components

Rate analysis support incomplete

Multi-rate code generator out of order

Demo with manual Java coding

Simulated code generation Against actual API; binary compatible

Trancón y Widemann, Lepper Shepard @ SIG 14 / 15

slide-58
SLIDE 58

Exposition Development Recapitulation Application Conclusion

Implementation Status

Textual frontend language compiles to Java VM Various advances features implemented

ADTs & pattern matching Staged higher-order components

Runtime environment complete

Including multi-rate components

Rate analysis support incomplete

Multi-rate code generator out of order

Demo with manual Java coding

Simulated code generation Against actual API; binary compatible

Trancón y Widemann, Lepper Shepard @ SIG 14 / 15

slide-59
SLIDE 59

Exposition Development Recapitulation Application Conclusion

Implementation Status

Textual frontend language compiles to Java VM Various advances features implemented

ADTs & pattern matching Staged higher-order components

Runtime environment complete

Including multi-rate components

Rate analysis support incomplete

Multi-rate code generator out of order

Demo with manual Java coding

Simulated code generation Against actual API; binary compatible

Trancón y Widemann, Lepper Shepard @ SIG 14 / 15

slide-60
SLIDE 60

Exposition Development Recapitulation Application Conclusion

Implementation Status

Textual frontend language compiles to Java VM Various advances features implemented

ADTs & pattern matching Staged higher-order components

Runtime environment complete

Including multi-rate components

Rate analysis support incomplete

Multi-rate code generator out of order

Demo with manual Java coding

Simulated code generation Against actual API; binary compatible

Trancón y Widemann, Lepper Shepard @ SIG 14 / 15

slide-61
SLIDE 61

Exposition Development Recapitulation Application Conclusion

Implementation Status

Textual frontend language compiles to Java VM Various advances features implemented

ADTs & pattern matching Staged higher-order components

Runtime environment complete

Including multi-rate components

Rate analysis support incomplete

Multi-rate code generator out of order

Demo with manual Java coding

Simulated code generation Against actual API; binary compatible

Trancón y Widemann, Lepper Shepard @ SIG 14 / 15

slide-62
SLIDE 62

Exposition Development Recapitulation Application Conclusion

Concluding Stuff

Many things to do

Make rates work Whole-program analysis & optimization Hard real-time runtime environments

Take-home message: Multi-rate higher-order programming rocks

Dynamic reconfiguration of signal processing networks Applications ranging from trivial to hugely complex Clean compositional semantics & reliability essential

Trancón y Widemann, Lepper Shepard @ SIG 15 / 15

slide-63
SLIDE 63

Exposition Development Recapitulation Application Conclusion

Concluding Stuff

Many things to do

Make rates work Whole-program analysis & optimization Hard real-time runtime environments

Take-home message: Multi-rate higher-order programming rocks

Dynamic reconfiguration of signal processing networks Applications ranging from trivial to hugely complex Clean compositional semantics & reliability essential

Trancón y Widemann, Lepper Shepard @ SIG 15 / 15

slide-64
SLIDE 64

SIG Bibliography I

Trancón y Widemann, B. and M. Lepper (2011). “tSig — Towards Semantics for a Functional Synchronous Signal Language”. In: 16. Kolloquium Programmiersprachen und Grundlagen der Programmierung (KPS 2011). Ed. by H. Kuchen and M. Müller-Olm. Arbeitsberichte des Instituts für Wirtschaftsinformatik 132. Universität Münster, pp. 163–168. — (2014a). “Foundations of Total Functional Data-Flow Programming”. In: Mathematically Structured Functional Programming (MSFP 2014). Vol. 153. Electronic Proceedings in Theoretical Computer Science, pp. 143–167. DOI: ✶✵✳✹✷✵✹✴❊P❚❈❙✳✶✺✸✳✶✵. — (2014b). “Sound and Soundness – Practical Total Functional Data-Flow Programming”. In: Functional Art, Music, Modeling and Design (FARM 2014). Demo abstract. ACM Digital Library, pp. 35–36.

DOI: ✶✵✳✶✶✹✺✴✷✻✸✸✻✸✽✳✷✻✸✸✻✹✹.

Trancón y Widemann, Lepper Shepard @ SIG 16 / 15

slide-65
SLIDE 65

SIG Bibliography II

Trancón y Widemann, B. and M. Lepper (2014c). “Towards Execution of the Synchronous Functional Data-Flow Language Sig”. In: Implementation and Application of Functional Languages (IFl 2014). Draft proceedings. — (2015a). “Laminar Data Flow: On the Role of Slicing in Functional Data-Flow Programming”. In: Trends in Functional Programming (TFP 2015). Draft proceedings. — (2015b). “On-Line Synchronous Total Purely Functional Data-Flow Programming on the Java Virtual Machine with Sig”. In:

  • Proc. International Conference Principles and Practice of Programming

in Java (PPPJ 2015). To appear. ACM.

Trancón y Widemann, Lepper Shepard @ SIG 17 / 15

slide-66
SLIDE 66

References I

Kiselyov, O., C.-C. Shan, and Y . Kameyama (2012). Bridging the theory

  • f staged programming languages and the practice of

high-performance computing. Tech. rep. 2012–4. National Institute of Informatics, Japan. URL: ❤tt♣✿✴✴✇✇✇✳♥✐✐✳❛❝✳❥♣✴s❤♦♥❛♥✴✇♣✲ ❝♦♥t❡♥t✴✉♣❧♦❛❞s✴✷✵✶✶✴✵✾✴◆♦✳✷✵✶✷✲✲✹✳♣❞❢. Risset, J.-C. (1986). “Pitch and rhythm paradoxes: Comments on “Auditory paradox based on fractal waveform” [J. Acoust. Soc. Am. 79, 186–189 (1986)]”. In: The Journal of the Acoustical Society of America 80.3, pp. 961–962. DOI: ✶✵✳✶✶✷✶✴✶✳✸✾✸✾✶✾. Shepard, R. N. (1964). “Circularity in Judgements of Relative Pitch”. In: Journal of the Acoustical Society of America 36.12, pp. 2346–2353.

DOI: ✶✵✳✶✶✷✶✴✶✳✶✾✶✾✸✻✷.

Trancón y Widemann, Lepper Shepard @ SIG 18 / 15

slide-67
SLIDE 67

References II

Uustalu, T. and V. Vene (2005). “The Essence of Dataflow Programming”. In: Programming Languages and Systems. Ed. by K. Yi.

  • Vol. 3780. Lecture Notes in Computer Science. Springer, pp. 2–18. DOI:

✶✵✳✶✵✵✼✴✶✶✺✼✺✹✻✼❴✷.

Trancón y Widemann, Lepper Shepard @ SIG 19 / 15