signal rate inference for
play

Signal Rate Inference for Dimensional Faust Multi-Dimensional - PowerPoint PPT Presentation

Signal Rate Inference for Multi- Signal Rate Inference for Dimensional Faust Multi-Dimensional Faust Y. Orlarey P. Jouvelot Signals Yann Orlarey 1 Pierre Jouvelot 2 Types/rates Inference 1 Grame, France Correctness Algorithm 2 MINES


  1. Signal Rate Inference for Multi- Signal Rate Inference for Dimensional Faust Multi-Dimensional Faust Y. Orlarey P. Jouvelot Signals Yann Orlarey 1 Pierre Jouvelot 2 Types/rates Inference 1 Grame, France Correctness Algorithm 2 MINES ParisTech, PSL Research University, France Related Work Conclusion IFL’16 – Leuven, August, 31, 2016 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 / 15

  2. Towards Multirate Faust Signal Rate Inference for Multi- Faust (Functional Audio Stream) key features: Dimensional Faust Real-time (audio) signal processing DSL Y. Orlarey P. Jouvelot Two layers: lambda-calculus macros and signal processors Signals High-level, functional paradigm for signals ( timed samples ) Types/rates Efficient, multiplatform implementations Inference ... but need for multiple rates: Correctness Algorithm Control vs. audio rates Related Work Efficient spectral processing (FFT, wavelets, Conclusion oversampling...) Multi-dimensional data structures (arrays) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 / 15

  3. Core Faust Signal Rate Inference for Multi- Dimensional process Faust Y. Orlarey + abs P. Jouvelot Signals Types/rates process = + : abs ; Inference Correctness process Algorithm Related Work + Conclusion process = + ~ _ ; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 / 15

  4. Example: Organ Signal Rate Inference for Multi- Dimensional 1 // organ.dsp Faust 2 // http :// faust.grame.fr 3 Y. Orlarey 4 voice(gate , gain , freq) = envelop(gate , gain) * timbre(freq ); P. Jouvelot 5 6 // Envelop Signals 7 envelop(gate , gain) = gate * gain : smooth (0.9995) 8 with { smooth(c) = * (1-c) : + ~ * (c); }; Types/rates 9 10 // Timbre Inference 11 phasor(f) = f/fconstant(int fSamplingFreq , <math.h>) : (+ ,1.0: fmod) ~ _; 12 osc(f) = phasor(f) * 6.28318530718 : sin; Correctness 13 14 timbre(freq) = osc(freq) + 0.5* osc (2.0* freq) + 0.25* osc (3.0* freq ); Algorithm 15 Related Work 16 // Organ 17 process = voice(midigate , midigain , midifreq) * Conclusion 18 hslider (" volume", 0, 0, 1, 0.01) 19 with { midigate = button (" gate "); 20 midifreq = hslider (" freq[unit:Hz]", 440, 20, 8000 , 1); 21 midigain = hslider (" gain", 0.5, 0, 10, 0.01); }; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 / 15

  5. Agenda Signal Rate Inference for Multi- Signals 1 Dimensional Faust Y. Orlarey Types/rates 2 P. Jouvelot Signals Inference 3 Types/rates Inference Correctness 4 Correctness Algorithm Algorithm 5 Related Work Conclusion Related Work 6 Conclusion 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 / 15

  6. Signal Examples Signal Rate Inference for Multi- process Dimensional Faust + abs Y. Orlarey P. Jouvelot Signals abs( I 0 + I 1 ) Types/rates Inference process Correctness Algorithm Related Work + Conclusion X 0 , with D ( X ) = ⟨ X 0 @ 1 + I 0 ⟩ X = ⟨ X 0 ⟩ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 / 15

  7. Signal Definition Signal Rate Inference for Multi- Dimensional Step-wise approximation of continuous functions... Faust ... from sampled times in T r ( r ∈ Q ∗ ) to values in Y. Orlarey P. Jouvelot V ∪ { 0 V } Signals T r = 1 r Z = { i r | i ∈ Z } Types/rates Examples : Inference Correctness T 1 = { . . . , − 2 , − 1 , 0 , 1 , 2 , . . . } ; Algorithm T 2 = { . . . , − 1 , − 0 . 5 , 0 , 0 . 5 , 1 , . . . } ; Related Work Conclusion T 1 / 3 = { . . . , − 6 , − 3 , 0 , 3 , 6 , . . . } . Negative times always yield 0 V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 / 15

  8. Syntax and Dynamic Semantics Signal Rate Signal expressions E ∈ S : Inference for Multi- Dimensional E ::= k | f | I n | X i | E 1 ⋆ E 2 Faust E ↑ n | E ↓ n | v ( E , n ) | s ( E ) | E 1 # E 2 | E 1 [ E 2 ] Y. Orlarey P. Jouvelot ... and D ( ⟨ X 0 , ..., X n − 1 ⟩ ) ∈ S ∗ Signals Types/rates Denotational semantics: Inference Correctness S a ( I n ) t = a ( I n ) t , Algorithm S a ( X i , D ) t = S a ( π i ( D ( X ))) t . Related Work Conclusion Multidimensional constructs (with s i ( t ) = S a ( E ( r i ) ) t ): i S a ( v ( E 1 , n )) t = [ s 1 ( t − ( n − 1 ) / r 1 ) , ..., s 1 ( t − 1 / r 1 ) , s 1 ( t )] , S a ( s ( E 1 )) t = s 1 ( ⌊ tr 1 ⌋ / r 1 )[ mod ( rt , n )] , if | s 1 ( t ) | = n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 / 15

  9. Static Semantics Signal Rate Inference for Multi- Dimensional Domain types as rates r in Q ∗ Faust Y. Orlarey Codomain types T ::= int [ l , h ] | float [ l , h ] | [ n ] T P. Jouvelot Signal types: T r Signals Typing rules, with Γ( I n ) = float [ −∞ , + ∞ ] r : Types/rates Inference Γ ⊢ ( E i , D ):Γ( X i ) D ( X )= ⟨ E 0 , E 1 ... E n − 1 ⟩ Correctness Γ ⊢ I n :Γ( I n ) Γ ⊢ ( X i , D ):Γ( X i ) Algorithm Γ ⊢ E :[ n ] T r Related Work Γ ⊢ E : T nr Γ ⊢ s ( E ): T nr Γ ⊢ v ( E , n ):[ n ] T r Conclusion Subject Reduction theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 / 15

  10. Rate Inference Algorithm Signal Rate Inference for Predefined typing environment Ω Multi- Dimensional Possibly-scalable ( v ∈ { 0 , 1 } ) rate environments ∆ v , with Faust ∆ v ( I n ) = r (idem for X i ) Y. Orlarey P. Jouvelot Set of confluent rewrite rules ( E , Ω) → (∆ v , r ) : Signals Types/rates k → ( ⊥ 0 , 1 ) X i → ( ⊥ [ X i → 1 ] 1 , 1 ) Inference Correctness E → (∆ v , r ) E → (∆ 1 , r ) Ω ⊢ E :[ n ] T m = lcm ( n , r ) v ( E , n ) → (( m s ( E ) → (∆ v , nr ) r ∆) 1 , m / n ) Algorithm Related Work Composition ∆ v 1 1 + ∆ v 2 Conclusion 2 of rate environments for E 1 ⋆ E 2 : r i = ∆ i ( x ) m = lcm ( r 1 , r 2 ) ( m r 1 ) v 1 ∆ 1 ≃ ( m r 2 ) v 2 ∆ 2 ∆ v 1 1 + ∆ v 2 2 → (( m r 1 ) v 1 ∆ 1 ∪ ( m r 2 ) v 2 ∆ 2 ) v 1 v 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 / 15

  11. Local Rate Inference Correctness Signal Rate Inference for Multi- Theorem (Soundness (simplified)) Dimensional Faust For all integers p, if we have Y. Orlarey P. Jouvelot ( E , Ω) → (∆ v , r ) and Signals (Ω , p v ∆) ⊏ Γ , Types/rates then, Γ ⊢ ( E , D ) : T p v r . Inference Correctness Theorem (Integer Completeness (simplified)) Algorithm Related Work If Γ ⊢ N E : T R , then there exist ∆ , v , r and k such that: Conclusion ( E , Ω(Γ)) → (∆ v , r ) and R = rk v . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 / 15

  12. Global Rate Inference Algorithm (1/2) Signal Rate Inference for Multi- Dimensional Faust rates( L , D ) : Y. Orlarey P. Jouvelot % Input: List L of n signal outputs E i Signals % Function D for recursive signal definitions % Output: Typing environment Γ ( Γ( o i ) = type/rate of E i ) Types/rates Inference % Infer types and local rates Correctness for each E i in L (Ω i , T i ) = sample_type ( ( E i , D ) ); Algorithm (∆ v i i , r i ) = local_rate ( ( E i , Ω i ) ); Related Work Conclusion % Compute the global sample type environment Ω = ∪ n − 1 i = 0 Ω i [ o i → T i ] ; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 / 15

  13. Global Rate Inference Algorithm (2/2) Signal Rate Inference for % Compute the global rate environment Multi- Rs = ∪ n − 1 i = 0 { ∆ i [ o i → r i ] v i } ; Dimensional Faust while ∃ intersecting R 1 and R 2 in Rs Rs = Rs ∪ { R 1 + R 2 } − { R 1 , R 2 } ; Y. Orlarey P. Jouvelot ∆ = ∪ R ∈ Rs R ; Signals % Build the global signal type environment Types/rates Γ = []; Inference for each x in Dom (∆) Γ = Γ[ x → Ω( x ) ∆( x ) ] ; Correctness Algorithm % Check recursive signals Related Work in Dom ( D ) for each X for each i from 0 to length ( D ( X )) − 1 Conclusion T i r i = type/rate( Γ , ( π i ( D ( X )) , D ) ); check ( T i r i == Γ( π i ( X )) ); return Γ ; end . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 / 15

  14. Related Work Signal Rate Inference for Multi- Functional languages Dimensional Faust Music languages (Csound) Y. Orlarey Synchronous languages: P. Jouvelot Synchronous Dataflow Model, SDF (Lee and Signals Messerschmitt, 87) Types/rates Inference Lustre (Caspi et al, 87), Signal (Benveniste et al, 91), Correctness Lucid synchrone (Caspi et al, 07) Algorithm “Clocks as abstract types” (Colaço and Pouzet, 03) Related Work Clock inference (Talpin and Shulka, 05) Conclusion Array primitives as clock mechanisms (Jouvelot and Orlarey, 11) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 / 15

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend