SE in RT Audio Applications Bert Schiettecatte Promotor: Prof. D. Vermeir Co-promotor: Prof. R. Lauwereins Advisors: S. Himpe & T.

Slides:



Advertisements
Similar presentations
© 2004, D. J. Foreman 1 Scheduling & Dispatching.
Advertisements

Multi-threaded applications SE SE-2811 Dr. Mark L. Hornick 2 What SE1011 students are told… When the main() method is called, the instructions.
Dynamic Ringtone Adjustment using On Demand Sampling on Android Smartphones Casey O’Leary – Washington State University CURENT REU Mentor: Yong Li Project.
1 Chapter Six Algorithms. 2 Algorithms An algorithm is an abstract strategy for solving a problem and is often expressed in English A function is the.
CHAPTER 16 Audio © 2008 Cengage Learning EMEA. LEARNING OBJECTIVES In this chapter you will learn about: – –The fundamentals of sound – –DirectX Audio.
EE2F2 - Music Technology 9. Additive Synthesis & Digital Techniques.
Improvement of Audio Capture in Handheld Devices through Digital Filtering Problem Microphones in handheld devices are of low quality to reduce cost. This.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
Chapter 13 Embedded Systems
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
Scheduling for Embedded Real-Time Systems Amit Mahajan and Haibo.
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
1 Soft Timers: Efficient Microsecond Software Timer Support For Network Processing Mohit Aron and Peter Druschel Rice University Presented By Jonathan.
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
CS 104 Introduction to Computer Science and Graphics Problems
Simulation.
CSE Fall Introduction - 1 What is an Embedded Systems  Its not a desktop system  Fixed or semi-fixed functionality (not user programmable)
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
Portability CPSC 315 – Programming Studio Spring 2008 Material from The Practice of Programming, by Pike and Kernighan.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
CprE 458/558: Real-Time Systems
A. Frank - P. Weisberg Operating Systems Introduction to Cooperating Processes.
Performance and Code Tuning Overview CPSC 315 – Programming Studio Fall 2009.
Kathy Grimes. Signals Electrical Mechanical Acoustic Most real-world signals are Analog – they vary continuously over time Many Limitations with Analog.
Windows audio architecture Win MM Application DirectSound Application SysAudio.SYS Kmixer.SYS WinMM.DLLDSound.DLL Device Drive Container USB Device Driver.
Digital Audio What do we mean by “digital”? How do we produce, process, and playback? Why is physics important? What are the limitations and possibilities?
Language Evaluation Criteria
- 1 - EE898-HW/SW co-design Hardware/Software Codesign “Finding right combination of HW/SW resulting in the most efficient product meeting the specification”
TM Efficient IP Design flow for Low-Power High-Level Synthesis Quick & Accurate Power Analysis and Optimization Flow JAN Asher Berkovitz Yaniv.
EECE **** Embedded System Design
German National Research Center for Information Technology Research Institute for Computer Architecture and Software Technology German National Research.
Introduction and Overview Questions answered in this lecture: What is an operating system? How have operating systems evolved? Why study operating systems?
Computer Programming Basics Assistant Professor Jeon, Seokhee Assistant Professor Department of Computer Engineering, Kyung Hee University, Korea.
1 Previous lecture review n Out of basic scheduling techniques none is a clear winner: u FCFS - simple but unfair u RR - more overhead than FCFS may not.
1 H ardware D escription L anguages Modeling Digital Systems.
Lecture 2 Foundations and Definitions Processes/Threads.
Scheduling policies for real- time embedded systems.
Real-Time Operating Systems for Embedded Computing 李姿宜 R ,06,10.
Reference: Ian Sommerville, Chap 15  Systems which monitor and control their environment.  Sometimes associated with hardware devices ◦ Sensors: Collect.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
CS 346 – Chapter 4 Threads –How they differ from processes –Definition, purpose Threads of the same process share: code, data, open files –Types –Support.
ICOM Noack Scheduling For Distributed Systems Classification – degree of coupling Classification – granularity Local vs centralized scheduling Methods.
Chapter 4 – Threads (Pgs 153 – 174). Threads  A "Basic Unit of CPU Utilization"  A technique that assists in performing parallel computation by setting.
CS536 Semantic Analysis Introduction with Emphasis on Name Analysis 1.
1 Soft Timers: Efficient Microsecond Software Timer Support For Network Processing Mohit Aron and Peter Druschel Rice University Presented By Oindrila.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Real-Time systems By Dr. Amin Danial Asham.
1 Real-Time Scheduling. 2Today Operating System task scheduling –Traditional (non-real-time) scheduling –Real-time scheduling.
Instruction Sets: Addressing modes and Formats Group #4  Eloy Reyes  Rafael Arevalo  Julio Hernandez  Humood Aljassar Computer Design EEL 4709c Prof:
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
Computer Organization Instruction Set Architecture (ISA) Instruction Set Architecture (ISA), or simply Architecture, of a computer is the.
© 2004, D. J. Foreman 1 Device Mgmt. © 2004, D. J. Foreman 2 Device Management Organization  Multiple layers ■ Application ■ Operating System ■ Driver.
ECE 750 Topic 8 Meta-programming languages, systems, and applications Automatic Program Specialization for J ava – U. P. Schultz, J. L. Lawall, C. Consel.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
RealTimeSystems Lab Jong-Koo, Lim
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Real-Time Operating Systems RTOS For Embedded systems.
REAL-TIME OPERATING SYSTEMS
Planning & System installation
MPEG-4 Binary Information for Scenes (BIFS)
Types for Programs and Proofs
The Mach System Sri Ramkrishna.
Embedded Systems Design
Real-time Software Design
Anne Pratoomtong ECE734, Spring2002
GEOMATIKA UNIVERSITY COLLEGE CHAPTER 2 OPERATING SYSTEM PRINCIPLES
Background and Motivation
Audio Compression Techniques
Foundations and Definitions
Presentation transcript:

SE in RT Audio Applications Bert Schiettecatte Promotor: Prof. D. Vermeir Co-promotor: Prof. R. Lauwereins Advisors: S. Himpe & T. Vander Aa

Introduction Sound: infinite discrete sequence of normalized numbers = ‘samples’ RT Audio Synthesis: real-time (RT) computation and playback of synthetic sound Synthetic Sound: sound generated using a mathematical model RT Deadlines: buffer scheduling, event handling

Goals & Limitations Not: –Detailed treatment of digital signal processing (DSP) arithmetic for audio processing –Experiments on the performance of OO in RT applications Instead: –Realistic exposure to application of some SE techniques in a RT application –Roadmap for building a RT audio synthesizer

Case Study Real-time audio synthesizer on handheld device: StrongARM running PocketPC To be used by musicians on the road Goals: –Feasibility –Exposure to realistic RT application –Exposure to DSP –SE principles realistic in RT applications

Implementation Trade-offs: –Floating-point VS fixed-point –Double buffering, tripple buffering or ring buffering of sound –Static VS dynamic networks –OO VS best-fit implementation

Implementation Strategy: bench & correctness of 1.Arithmetic 2.Synthesis Algorithm 3.Buffer Scheduling & OS Timing 4.Event Scheduling

Fixed VS float arithmetic Arithmetic: major impact on overall performance & sound quality (quantization noise) Benchmark for comparing floating-point / fixed-point performance: LINPACK Case study HW: factor 10 speedup (assembly-level analysis reveals float arithmetic implementation: library)

Fixed-point arithmetic and GP Floating-point arithmetic: sometimes regarded as ‘unlimited range’ by developers Fixed-point arithmetic: limited per definition, requires detailed range analysis in some algorithms, resulting in confusing code Solution: use generative programming to derive best precision for a variable Generalized: explicit type for a variable can be substituted for a set of constraints

Synthesis Algorithm Additive synthesis: sum (harmonically related) weighted sine waves Envelope: piecewise linear function changing weight over time Requirements: –Oscillator: efficient sine algorithm (e.g. CORDIC) –Envelopes: linear interpolation

Synthesis Algorithm Use fixed-point arithmetic to implement algorithm Dynamic network: runtime sequencing of DSP blocks, buffer granularity Static network: compile time sequencing of DSP blocks, sample granularity Here: static network because of fixed-point arithmetic & inlining

Buffer Scheduling: OS API In general: 1.Check device capabilities 2.Open device 3.Prepare buffer 4.Queue buffer in the OS for playback 5.Wait until playback done 6.Goto 3 7.Unprepare buffer 8.Close device

Buffer Scheduling Algorithms: –Naive –Double/Triple buffering –Ring buffering

Buffer Scheduling: Naive Algorithm: 1.Prepare buffer 2.Queue buffer in the OS for playback 3.Wait until OS signals playback done 4.Goto 1 Problems: –sound pauses (prepare + queue) –OS event is overhead

Buffer Scheduling: Double/Tripple Algorithm: 1.Prepare buffer 1 2.Queue buffer 1 in the OS for playback 3.Wait until OS signals buffer 2 done 4.Prepare buffer 2 5.Queue buffer 2 6.Wait until OS signals buffer 1 done 7.Goto 1 Problems: –OS event overhead

Buffer Scheduling: Ring Buffer Algorithm: 1.Fill ½ & queue buffer for looping playback 2.Get playing position of the OS in buffer 3.Fill buffer from the last known rendering position up to the OS position 4.Update rendering position 5.Wait ¼ buffer size 6.Goto 2 Problems: –Tricky: sleep accuracy (WinCE 3.0: 1 to 2 ms VS Win98: 20ms!) –Choosing wait time is hard

Buffer Scheduling: Reality Scheduling: very hard –Requires inspiration and experimenting (e.g. buffer size problems in WinCE 3.0) –Buffer underrun detection/avoidance (e.g. MP3)

Event Scheduling Possibilities: –Seperate event thread updating settings –Handle events in the synthesizer class: keep a song pointer & update when necessary Seperate thread: requires additional CPU time for scheduling, synchronization In the synth class: better, keep a song pointer (in samples) and update settings based on the song’s tempo (e.g. 120 BPM = update every 0.5s * Hz = samples)

Event Scheduling Latency: the delay on events caused by the buffer scheduler Latency: –In seperate event thread: because of synchronization, at least 1 sound buffer –In synthesis loop: almost none, since events can be handled almost every sample

Implementation: Best-fit In general: mix paradigms to write clear code OO not always the best choice: depends on levels of re-use (e.g. OS timer) Machine-level inspection of code: crucial when using OO in RT applications OO not per definition a bad thing

Implementation: Object-orientedness Here: OO is the right paradigm when –It doesn’t keep the compiler from optimizing –It entirely disappears after compilation (e.g. inlining): no run-time OO –It simplifies code In general: OO languages without real ‘compile-time’ tend to have performance problems Meta-programming: welcome addition

Contribution This dissertation: one of the few detailed available roadmaps for RT audio synthesis implementation Not much new here (but still large amount of research, everything proprietary) Application of generative programming to audio processing and fixed-point arithmetic

Conclusion Implementing a RT audio synthesizer is hard Series of benchmarks & tests crucial OO design has to be applied with common sense and is not always the best choice Generative programming can be a powerful mechanism to abstract at little or no cost A meta-programming level adds expressive power Compiler features (inlining, templates, …) essential

Synthesis engine demonstration Sets up the additive synthesis engine, starts the sound buffer scheduler, loads events from a text file and feeds them to the additive synthesizer