SlideShare a Scribd company logo
1 of 31
Download to read offline
Emulating a combo organ
      using Faust
      Sampo Savolainen
         LAC 2010
          Utrecht
Yamaha YC-20
   Designed circa 1969
   One manual, 61 keys
   ”Levers” not actual drawbars
   3 sections
          Section I (5 + 2 drawbars)
          Section II (4 drawbars) + brightness
          Bass manual (2 drawbars, bottom 17 keys)
   Percussive drawbar, vibrato, touch vibrato
YC-20 block
 diagram
Faust
   Functional AUdio STream
   A functional programming language designed for 
     signal processing


    process(signal) = signal * input_gain : distortion;
    input_gain = vslider(”gain” ... );
    distortion(signal) = tanh(signal);
Faust
   The Faust compiler produces C++ code
          Jack client, LADSPA / VST plugin, etc.
   Faust can optimize the generated code using 
      different methods:
          Automatic vectorization (see LAC 2009)
          OpenMP parallelization (see LAC 2009)
          Work stealing scheduler (tomorrow at 12:15..)
Why use Faust?
   The divide­down architecture is 'always­on'
          Instead of routability and controllability, this requires 
             a large number of parallel fixed processes
   An organ synthesizer is DSP development, not CS
          Helps keep focus on the processing
   To try out Faust and test out the parallelization and 
     performance
The organ emulation
      Not a polysynth but a generator + matrix mixer!


   96 oscillators
   204 RC filters
   A matrix mixer (the keyboard)
   Percussion envelope
   Vibrato LFO
   Mixing section
Emulated
architecture
    No horizontal aftertouch in 
       MIDI keyboards
    Pre­amp is just a mixer
    Volume pedal can be done 
       externally
Oscillators
   Main oscillators produce sawtooth waves
   Dividers are flip­flops: they produce rectangles
   Oscillator anti­aliasing with PolyBLEPs
          Välimäki and Huovilainen 2007
          Not optimal quality but easy on the CPU
          True BLEP would require FFT functions (will 
             probably be fixed)
PolyBLEP and branching
   Only two samples per discontinuity are reshaped
   Faust does not branch: all branches of an 'if' statement 
      are always calculated
          Thus the amount of PolyBLEPs/sec is a function of the 
            used sample rate
          Required amount is a function of oscillator frequency
          For a 500Hz rectangle at Fs=44.1k, not branching would 
             mean 352x PolyBLEPs per second than necessary
   Had to be implemented in C++ instead of Faust
Single osc + dividers




   Common bias applies vibrato and pitch control
   Each oscillator produces both the voice and phase 
     information
   Dividers (marked RECT) contain a phase divisor and 
     a rectangle oscillator
Wave transformer
   Each generated voice is 
     filtered individually
   Main oscillator is high­
     passed
   Divider outputs are 
     both low and high­
     passed
The keyboard
   Each key is a seven contact switch (7PST)
   Switches connect voices to bus bars
   Enabling the bass switch separates the bass bus bars 
     from the main bus bars
   Unconnected voices are filtered to emulate bleed 
     exhibited in the real instrument
Voice sections
   Section I is trivial: there is no extra filtering
   Section II has a brightness control
           Bus bars are separated into high­passed and low­
             passed streams
           Brightness controls a mix of the two
   Bass manual drawbars are mixes of multiple bus bars
           Not emulated perfectly – a simple lowpass is pretty 
             good though
Comparison – Section I
   C2 played on 8' drawbar
   Line marks analysis of 
      the emulation output
   Crosses mark measured 
     harmonic peaks of the 
     real organ
   Section I voices are 
      emulated nearly 
      perfectly
Comparison – Section II
   C2 played on 8' drawbar, 
     full brightness
   Measured at the same 
     overall volume
   Harmonics are within 
     3dB
   However, other notes 
     (C3 for example) line 
     up perfectly
Performance
   This much processing is inherently slow
   But the design leaves much room for parallelization
          … which Faust should be good at
   Performance is sensitive to GCC flags
Performance numbers
                                    Core2 T7400*               Xeon**
                                     DSP usage                DSP usage

 Scalar                                  53%                     52%

 Vectorized                              35%                     41%

 Scheduler (2 cores)                     25%                     29%

 Scheduler (3 cores)                       -                     23%

 Scheduler (4 cores)                       -                     20%

Measured while running at 2.7ms latency, Fs=48kHz, buffer size 128
*    2.16GHz Core2 T7400 running 32­bit Ubuntu 9.10

**  2 x 2Ghz Xeon dual core running 64­bit OS X 10.6.3
Things to improve
   Section II filters are not perfect
   Bass manual circuit is not truly emulated
   The keyboard matrix should emulate passive mixing
           Voices connected to multiple bus bars
           Voices connected to a single bus bar through many key 
             switches (for example harmonics)
   Streamlining
           Some filters might be unnecessary
           Use lookup tables for oscillators
Challenges with Faust
   No true branches – PolyBLEP had to be implemented 
     in C++
   Has been solved by compiling select() into true if()'s
          Could be improved by identifying stateless functions
          And generalized to further optimize functions like:
           t1(x) = (x > 0)
           t2(x) = x^2 ­ fmod(x, 1.0)
            f(x) = t1(x) * t2(x)
A single bus bar
bus_1 =  (key_c0*c5 + key_C0*C5 + key_d0*d5 + key_D0*D5 + key_e0*e5 + key_f0*f5 +
          key_F0*F5 + key_g0*g5 + key_G0*G5 + key_a0*a5 + key_A0*A5 + key_b0*b5 +
          key_c1*c6 + key_C1*C6 + key_d1*d6 + key_D1*D6 + key_e1*e6) 
       * (1.0 ­ bass_engaged)
       + key_f1*f6 + key_F1*F6 + key_g1*g6 + key_G1*G6 + key_a1*a6 + key_A1*A6 +
         key_b1*b6 + key_c2*c7 + key_C2*C7 + key_d2*d7 + key_D2*D7 + key_e2*e7 +
         key_f2*f7 + key_F2*F7 + key_g2*g7 + key_G2*G7 + key_a2*a7 + key_A2*A7 +
         key_b2*b7 + key_c3*c8 + key_C3*C8 + key_d3*d8 + key_D3*D8 + key_e3*e8 +
         key_f3*f8 + key_F3*F8 + key_g3*g8 + key_G3*G8 + key_a3*a8 + key_A3*A8 +
         key_b3*b8 + key_c4*c8 + key_C4*C8 + key_d4*d8 + key_D4*D8 + key_e4*e8 +
         key_f4*f8 + key_F4*F8 + key_g4*g8 + key_G4*G8 + key_a4*a8 + key_A4*A8 +
         key_b4*b8 + key_c5*c8;

bus_1_all =  (c5 + C5 + d5 + D5 + e5 + f5 + F5 + g5 + G5 + a5 + A5 + b5
            + c6 + C6 + d6 + D6 + e6) * (1.0 ­ bass_engaged)
                                     + f6 + F6 + g6 + G6 + a6 + A6 + b6
            + c7 + C7 + d7 + D7 + e7 + f7 + F7 + g7 + G7 + a7 + A7 + b7
            + c8 + C8 + d8 + D8 + e8 + f8 + F8 + g8 + G8 + a8 + A8 + b8
            + c8 + C8 + d8 + D8 + e8 + f8 + F8 + g8 + G8 + a8 + A8 + b8
            + c8;

bus_1_bleed = bus_1_all ­ bus_1 : bus_bleed_filter : apply_realism;
.. Challenges with Faust
   We need arrays!
          Coding the keyboard mixer was a PITA
          Generated code can not be optimized
   Compiling a complex project is slow
          Scalar 11s, vector 5 min, scheduler 8 min
          process() into subroutines? Less register overload...
   Issues with vec and sch modes (solved partly)
.. Challenges with Faust
   Naming should be more strict, the following is 
     ambiguous but perfectly legal:
           f(a, b) = a + b
           with { a = b ∗ b; };
   Compiler error messages can be very unhelpful
          67kB error messages have been spotted
   Language documentation should be improved
Benefits of using Faust
   Functional programming is an excellent model for 
     signal processing
   Parallelization is the future!
   .. but realtime parallel programming requires a level 
       of expertise uncommon even for seasoned 
       programmers
           Let alone people whose career focus is in what these 
             programs actually do (the DSP)!
.. Benefits of using Faust
   Faust code is readable
   SVG output is a very helpful tool
   Code re­use is a reality
          Combining C/C++ modules from different sources 
            often requires refactoring or runtime data 
            conversion
… introducing
Foo YC-20



   Jack audio and MIDI
          MIDI for both notes and control
   Gtkmm/Cairo UI
   Realism switch
   1.0 released … now
Miscellaneous features
   Realism switch
          Off: nothing extra
          2/4: slight oscillator detune
          3/4: percussion manual bleed
          4/4: drawbar bleed
   Addition to the master output, there are separate 
     bass and treble section (sections I + II) outputs
demo
Thanks for listening
   I would like to thank Petri Junno, Stéphane Letz, 
      Yann Orlarey, Thorsten Wilms, Torben Hohn, 
      Sakari Bergen, Edgar Aichinger


    http://code.google.com/p/foo­yc20

More Related Content

What's hot

An optimization in antnet routing algorithm
An optimization in antnet routing algorithmAn optimization in antnet routing algorithm
An optimization in antnet routing algorithmVinay Kumar
 
Keyboard interrupt
Keyboard interruptKeyboard interrupt
Keyboard interruptTech_MX
 
Ensemble rxtx, receptor SDR.
Ensemble rxtx, receptor SDR.Ensemble rxtx, receptor SDR.
Ensemble rxtx, receptor SDR.Ricardo Vergara
 
8051 Programming Instruction Set
 8051 Programming Instruction Set 8051 Programming Instruction Set
8051 Programming Instruction SetShreyans Pathak
 
5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron) 5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron) 艾鍗科技
 
Simulating communication systems with MATLAB: An introduction
Simulating communication systems with MATLAB: An introductionSimulating communication systems with MATLAB: An introduction
Simulating communication systems with MATLAB: An introductionAniruddha Chandra
 
Unit II arm 7 Instruction Set
Unit II arm 7 Instruction SetUnit II arm 7 Instruction Set
Unit II arm 7 Instruction SetDr. Pankaj Zope
 
Types of instructions
Types of instructionsTypes of instructions
Types of instructionsihsanjamil
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copymkazree
 

What's hot (17)

An optimization in antnet routing algorithm
An optimization in antnet routing algorithmAn optimization in antnet routing algorithm
An optimization in antnet routing algorithm
 
Keyboard interrupt
Keyboard interruptKeyboard interrupt
Keyboard interrupt
 
Ensemble rxtx, receptor SDR.
Ensemble rxtx, receptor SDR.Ensemble rxtx, receptor SDR.
Ensemble rxtx, receptor SDR.
 
Wireless communication
Wireless communicationWireless communication
Wireless communication
 
8051 Programming Instruction Set
 8051 Programming Instruction Set 8051 Programming Instruction Set
8051 Programming Instruction Set
 
Introduction to ARM
Introduction to ARMIntroduction to ARM
Introduction to ARM
 
Serial IO for 8051
Serial IO for 8051Serial IO for 8051
Serial IO for 8051
 
Lecture8
Lecture8Lecture8
Lecture8
 
5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron) 5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron)
 
Simulating communication systems with MATLAB: An introduction
Simulating communication systems with MATLAB: An introductionSimulating communication systems with MATLAB: An introduction
Simulating communication systems with MATLAB: An introduction
 
Intel Hex Format
Intel Hex FormatIntel Hex Format
Intel Hex Format
 
Lab5
Lab5Lab5
Lab5
 
Lecture9
Lecture9Lecture9
Lecture9
 
Unit II arm 7 Instruction Set
Unit II arm 7 Instruction SetUnit II arm 7 Instruction Set
Unit II arm 7 Instruction Set
 
Types of instructions
Types of instructionsTypes of instructions
Types of instructions
 
Digital Signal Processing Course Help
Digital Signal Processing Course HelpDigital Signal Processing Course Help
Digital Signal Processing Course Help
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copy
 

Viewers also liked

Ioc desembre 2011
Ioc desembre 2011Ioc desembre 2011
Ioc desembre 2011fpomes
 
IOC (jornada 2010)
IOC (jornada 2010)IOC (jornada 2010)
IOC (jornada 2010)fpomes
 
Ioc setembre 2012_d
Ioc setembre 2012_dIoc setembre 2012_d
Ioc setembre 2012_dfpomes
 
IOCidiomes 2011-12
IOCidiomes 2011-12IOCidiomes 2011-12
IOCidiomes 2011-12fpomes
 
Ioc novembre 2011
Ioc novembre 2011Ioc novembre 2011
Ioc novembre 2011fpomes
 
IOC_setembre 2013_def
IOC_setembre 2013_defIOC_setembre 2013_def
IOC_setembre 2013_deffpomes
 
Ioc abril 2015
Ioc abril 2015Ioc abril 2015
Ioc abril 2015fpomes
 
[150523] live2d 그녀들을 움직이게 하는 기술
[150523] live2d 그녀들을 움직이게 하는 기술[150523] live2d 그녀들을 움직이게 하는 기술
[150523] live2d 그녀들을 움직이게 하는 기술MinGeun Park
 
유니티의 툰셰이딩을 사용한 3D 애니메이션 표현
유니티의 툰셰이딩을 사용한 3D 애니메이션 표현유니티의 툰셰이딩을 사용한 3D 애니메이션 표현
유니티의 툰셰이딩을 사용한 3D 애니메이션 표현MinGeun Park
 

Viewers also liked (9)

Ioc desembre 2011
Ioc desembre 2011Ioc desembre 2011
Ioc desembre 2011
 
IOC (jornada 2010)
IOC (jornada 2010)IOC (jornada 2010)
IOC (jornada 2010)
 
Ioc setembre 2012_d
Ioc setembre 2012_dIoc setembre 2012_d
Ioc setembre 2012_d
 
IOCidiomes 2011-12
IOCidiomes 2011-12IOCidiomes 2011-12
IOCidiomes 2011-12
 
Ioc novembre 2011
Ioc novembre 2011Ioc novembre 2011
Ioc novembre 2011
 
IOC_setembre 2013_def
IOC_setembre 2013_defIOC_setembre 2013_def
IOC_setembre 2013_def
 
Ioc abril 2015
Ioc abril 2015Ioc abril 2015
Ioc abril 2015
 
[150523] live2d 그녀들을 움직이게 하는 기술
[150523] live2d 그녀들을 움직이게 하는 기술[150523] live2d 그녀들을 움직이게 하는 기술
[150523] live2d 그녀들을 움직이게 하는 기술
 
유니티의 툰셰이딩을 사용한 3D 애니메이션 표현
유니티의 툰셰이딩을 사용한 3D 애니메이션 표현유니티의 툰셰이딩을 사용한 3D 애니메이션 표현
유니티의 툰셰이딩을 사용한 3D 애니메이션 표현
 

Similar to Emulating a Combo Organ Using Faust

Similar to Emulating a Combo Organ Using Faust (20)

Usb Controlled Function Generator
Usb Controlled Function GeneratorUsb Controlled Function Generator
Usb Controlled Function Generator
 
Kernel Recipes 2019 - Metrics are money
Kernel Recipes 2019 - Metrics are moneyKernel Recipes 2019 - Metrics are money
Kernel Recipes 2019 - Metrics are money
 
Archi Modelling
Archi ModellingArchi Modelling
Archi Modelling
 
ISA.pptx
ISA.pptxISA.pptx
ISA.pptx
 
SDH and TDM telecom
SDH and TDM telecomSDH and TDM telecom
SDH and TDM telecom
 
TinyML - 4 speech recognition
TinyML - 4 speech recognition TinyML - 4 speech recognition
TinyML - 4 speech recognition
 
Polyanna manual
Polyanna manualPolyanna manual
Polyanna manual
 
dsp Lesson1
dsp Lesson1dsp Lesson1
dsp Lesson1
 
GPU - how can we use it?
GPU - how can we use it?GPU - how can we use it?
GPU - how can we use it?
 
chapter5-Filter Implementation-pp32.pptx
chapter5-Filter Implementation-pp32.pptxchapter5-Filter Implementation-pp32.pptx
chapter5-Filter Implementation-pp32.pptx
 
Spotlight on Python
Spotlight on PythonSpotlight on Python
Spotlight on Python
 
Multipliers in VLSI
Multipliers in VLSIMultipliers in VLSI
Multipliers in VLSI
 
Speaker Segmentation (2006)
Speaker Segmentation (2006)Speaker Segmentation (2006)
Speaker Segmentation (2006)
 
Computer ogranization lecture (chapter 1 introduction)
Computer ogranization lecture (chapter 1   introduction)Computer ogranization lecture (chapter 1   introduction)
Computer ogranization lecture (chapter 1 introduction)
 
Computer Hardware.ppt
Computer Hardware.pptComputer Hardware.ppt
Computer Hardware.ppt
 
[Best]Chromatic Tuner Project Final Report
[Best]Chromatic Tuner Project Final Report[Best]Chromatic Tuner Project Final Report
[Best]Chromatic Tuner Project Final Report
 
8051 Presentation
8051 Presentation8051 Presentation
8051 Presentation
 
MicroProcessors
MicroProcessors MicroProcessors
MicroProcessors
 
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
 
Xbox
XboxXbox
Xbox
 

Recently uploaded

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxNikitaBankoti2
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 

Recently uploaded (20)

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 

Emulating a Combo Organ Using Faust

  • 1. Emulating a combo organ using Faust Sampo Savolainen LAC 2010 Utrecht
  • 2.
  • 3. Yamaha YC-20  Designed circa 1969  One manual, 61 keys  ”Levers” not actual drawbars  3 sections  Section I (5 + 2 drawbars)  Section II (4 drawbars) + brightness  Bass manual (2 drawbars, bottom 17 keys)  Percussive drawbar, vibrato, touch vibrato
  • 5. Faust  Functional AUdio STream  A functional programming language designed for  signal processing process(signal) = signal * input_gain : distortion; input_gain = vslider(”gain” ... ); distortion(signal) = tanh(signal);
  • 6. Faust  The Faust compiler produces C++ code  Jack client, LADSPA / VST plugin, etc.  Faust can optimize the generated code using  different methods:  Automatic vectorization (see LAC 2009)  OpenMP parallelization (see LAC 2009)  Work stealing scheduler (tomorrow at 12:15..)
  • 7. Why use Faust?  The divide­down architecture is 'always­on'  Instead of routability and controllability, this requires  a large number of parallel fixed processes  An organ synthesizer is DSP development, not CS  Helps keep focus on the processing  To try out Faust and test out the parallelization and  performance
  • 8. The organ emulation Not a polysynth but a generator + matrix mixer!  96 oscillators  204 RC filters  A matrix mixer (the keyboard)  Percussion envelope  Vibrato LFO  Mixing section
  • 9. Emulated architecture  No horizontal aftertouch in  MIDI keyboards  Pre­amp is just a mixer  Volume pedal can be done  externally
  • 10. Oscillators  Main oscillators produce sawtooth waves  Dividers are flip­flops: they produce rectangles  Oscillator anti­aliasing with PolyBLEPs  Välimäki and Huovilainen 2007  Not optimal quality but easy on the CPU  True BLEP would require FFT functions (will  probably be fixed)
  • 11. PolyBLEP and branching  Only two samples per discontinuity are reshaped  Faust does not branch: all branches of an 'if' statement  are always calculated  Thus the amount of PolyBLEPs/sec is a function of the  used sample rate  Required amount is a function of oscillator frequency  For a 500Hz rectangle at Fs=44.1k, not branching would  mean 352x PolyBLEPs per second than necessary  Had to be implemented in C++ instead of Faust
  • 12. Single osc + dividers  Common bias applies vibrato and pitch control  Each oscillator produces both the voice and phase  information  Dividers (marked RECT) contain a phase divisor and  a rectangle oscillator
  • 13. Wave transformer  Each generated voice is  filtered individually  Main oscillator is high­ passed  Divider outputs are  both low and high­ passed
  • 14. The keyboard  Each key is a seven contact switch (7PST)  Switches connect voices to bus bars  Enabling the bass switch separates the bass bus bars  from the main bus bars  Unconnected voices are filtered to emulate bleed  exhibited in the real instrument
  • 15. Voice sections  Section I is trivial: there is no extra filtering  Section II has a brightness control  Bus bars are separated into high­passed and low­ passed streams  Brightness controls a mix of the two  Bass manual drawbars are mixes of multiple bus bars  Not emulated perfectly – a simple lowpass is pretty  good though
  • 16. Comparison – Section I  C2 played on 8' drawbar  Line marks analysis of  the emulation output  Crosses mark measured  harmonic peaks of the  real organ  Section I voices are  emulated nearly  perfectly
  • 17. Comparison – Section II  C2 played on 8' drawbar,  full brightness  Measured at the same  overall volume  Harmonics are within  3dB  However, other notes  (C3 for example) line  up perfectly
  • 18. Performance  This much processing is inherently slow  But the design leaves much room for parallelization  … which Faust should be good at  Performance is sensitive to GCC flags
  • 19. Performance numbers Core2 T7400* Xeon** DSP usage DSP usage Scalar 53% 52% Vectorized 35% 41% Scheduler (2 cores) 25% 29% Scheduler (3 cores) - 23% Scheduler (4 cores) - 20% Measured while running at 2.7ms latency, Fs=48kHz, buffer size 128 *    2.16GHz Core2 T7400 running 32­bit Ubuntu 9.10 **  2 x 2Ghz Xeon dual core running 64­bit OS X 10.6.3
  • 20. Things to improve  Section II filters are not perfect  Bass manual circuit is not truly emulated  The keyboard matrix should emulate passive mixing  Voices connected to multiple bus bars  Voices connected to a single bus bar through many key  switches (for example harmonics)  Streamlining  Some filters might be unnecessary  Use lookup tables for oscillators
  • 21. Challenges with Faust  No true branches – PolyBLEP had to be implemented  in C++  Has been solved by compiling select() into true if()'s  Could be improved by identifying stateless functions  And generalized to further optimize functions like: t1(x) = (x > 0) t2(x) = x^2 ­ fmod(x, 1.0)  f(x) = t1(x) * t2(x)
  • 22. A single bus bar bus_1 =  (key_c0*c5 + key_C0*C5 + key_d0*d5 + key_D0*D5 + key_e0*e5 + key_f0*f5 +           key_F0*F5 + key_g0*g5 + key_G0*G5 + key_a0*a5 + key_A0*A5 + key_b0*b5 +           key_c1*c6 + key_C1*C6 + key_d1*d6 + key_D1*D6 + key_e1*e6)         * (1.0 ­ bass_engaged)        + key_f1*f6 + key_F1*F6 + key_g1*g6 + key_G1*G6 + key_a1*a6 + key_A1*A6 +          key_b1*b6 + key_c2*c7 + key_C2*C7 + key_d2*d7 + key_D2*D7 + key_e2*e7 +          key_f2*f7 + key_F2*F7 + key_g2*g7 + key_G2*G7 + key_a2*a7 + key_A2*A7 +          key_b2*b7 + key_c3*c8 + key_C3*C8 + key_d3*d8 + key_D3*D8 + key_e3*e8 +          key_f3*f8 + key_F3*F8 + key_g3*g8 + key_G3*G8 + key_a3*a8 + key_A3*A8 +          key_b3*b8 + key_c4*c8 + key_C4*C8 + key_d4*d8 + key_D4*D8 + key_e4*e8 +          key_f4*f8 + key_F4*F8 + key_g4*g8 + key_G4*G8 + key_a4*a8 + key_A4*A8 +          key_b4*b8 + key_c5*c8; bus_1_all =  (c5 + C5 + d5 + D5 + e5 + f5 + F5 + g5 + G5 + a5 + A5 + b5             + c6 + C6 + d6 + D6 + e6) * (1.0 ­ bass_engaged)                                      + f6 + F6 + g6 + G6 + a6 + A6 + b6             + c7 + C7 + d7 + D7 + e7 + f7 + F7 + g7 + G7 + a7 + A7 + b7             + c8 + C8 + d8 + D8 + e8 + f8 + F8 + g8 + G8 + a8 + A8 + b8             + c8 + C8 + d8 + D8 + e8 + f8 + F8 + g8 + G8 + a8 + A8 + b8             + c8; bus_1_bleed = bus_1_all ­ bus_1 : bus_bleed_filter : apply_realism;
  • 23. .. Challenges with Faust  We need arrays!  Coding the keyboard mixer was a PITA  Generated code can not be optimized  Compiling a complex project is slow  Scalar 11s, vector 5 min, scheduler 8 min  process() into subroutines? Less register overload...  Issues with vec and sch modes (solved partly)
  • 24. .. Challenges with Faust  Naming should be more strict, the following is  ambiguous but perfectly legal: f(a, b) = a + b with { a = b ∗ b; };  Compiler error messages can be very unhelpful  67kB error messages have been spotted  Language documentation should be improved
  • 25. Benefits of using Faust  Functional programming is an excellent model for  signal processing  Parallelization is the future!  .. but realtime parallel programming requires a level  of expertise uncommon even for seasoned  programmers  Let alone people whose career focus is in what these  programs actually do (the DSP)!
  • 26. .. Benefits of using Faust  Faust code is readable  SVG output is a very helpful tool  Code re­use is a reality  Combining C/C++ modules from different sources  often requires refactoring or runtime data  conversion
  • 28. Foo YC-20  Jack audio and MIDI  MIDI for both notes and control  Gtkmm/Cairo UI  Realism switch  1.0 released … now
  • 29. Miscellaneous features  Realism switch  Off: nothing extra  2/4: slight oscillator detune  3/4: percussion manual bleed  4/4: drawbar bleed  Addition to the master output, there are separate  bass and treble section (sections I + II) outputs
  • 30. demo
  • 31. Thanks for listening  I would like to thank Petri Junno, Stéphane Letz,  Yann Orlarey, Thorsten Wilms, Torben Hohn,  Sakari Bergen, Edgar Aichinger http://code.google.com/p/foo­yc20