Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 6: Wrapped I/O Ken Greenebaum.

Slides:



Advertisements
Similar presentations
Summer Computing Workshop. Introduction to Variables Variables are used in every aspect of programming. They are used to store data the programmer needs.
Advertisements

I/O Management and Disk Scheduling
Using Audacity Audacity is an audio-editing application available from and can be used with most PC operating systems.
MindTunes Jonathan Chen, Po-Han Huang, Michael Kempf, Yen-Liang Tung, Christos Vezyrtzis FPGA mp3/wav memo recording.
SimPhonics, Inc. FXDirect Audio System for V+. SimPhonics, Inc. What Is FXDirect ® Audio Subsystem Add-on to V+ –Currently built-in Consists of Objects.
SE in RT Audio Applications Bert Schiettecatte Promotor: Prof. D. Vermeir Co-promotor: Prof. R. Lauwereins Advisors: S. Himpe & T.
Technology ICT Option: Audio.
Speech Compression. Introduction Use of multimedia in personal computers Requirement of more disk space Also telephone system requires compression Topics.
File Organization. File Types Pro Tools Session File: Created when you start a new project Map of all audio tracks, audio & video files, settings, edits,
Lecture 4. US Systems. Advanced Mobile Phone System Analog Signal Processing at the sender side Compress Pre Emphasize Limit Low Pass Filter + Frequency.
Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 5: The Ring Buffer Ken Greenebaum.
Sample vs. Tick Absolute timeline Unchanging, regardless of tempo – Samples – Min:Secs – Time Code – Feet + Frames Relative timeline Change dynamically.
Data Communication and Networks Lecture 2 ADTs in Protocol Design (Ring Buffer, Queue, FSM) September 16, 2004 Joseph Conron Computer Science Department.
1 PC Audio 2 Sound Card  An expansion board that enables a computer to receive, manipulate and output sounds.
Informationsteknologi Friday, November 16, 2007Computer Architecture I - Class 121 Today’s class Operating System Machine Level.
Java Audio.
Chapter 9 Audio.
Welcome to AUDIO PRODUCTION!. Significant Concepts are highlighted in Yellow.
FreeRTOS.
MSS & AMS Name and configure MIDI controllers, devices and sound modules. Control their routing to Pro Tools MSS - Configurations can be imported or exported.
School of Informatics CG087 Time-based Multimedia Assets Sampling & SequencingDr Paul Vickers1 Sampling & Sequencing Combining MIDI and audio.
Lab #8 Follow-Up: Sounds and Signals* * Figures from Kaplan, D. (2003) Introduction to Scientific Computation and Programming CLI Engineering.
Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 17:Wavetable Synthesis Ken Greenebaum.
Digital Radio Receiver Amit Mane System Engineer.
CSC 322 Operating Systems Concepts Lecture - 25: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Signal Digitization Analog vs Digital Signals An Analog Signal A Digital Signal What type of signal do we encounter in nature?
MULTIMEDIA INPUT / OUTPUT TECHNOLOGIES
MIDI Musical Instrument Digital Interface. MIDI A data communications protocol that describes a means for music systems and related equipment to exchange.
IMGD-1001 The Game Development Process Game Audio (Content by professor Brian Moriarty)
Basic Concepts of Audio Watermarking. Selection of Different Approaches Embedding Domain  time domain  frequency domain DFT, DCT, etc. Modulation Method.
What Every Developer Should Know about the Kernel Dr. Michael L. Collard 1.
CSE 451: Operating Systems Section 5 Midterm review.
Operating Systems (CS 340 D) Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 18:Noise Ken Greenebaum.
Lecture 11 Page 1 CS 111 Online Virtual Memory A generalization of what demand paging allows A form of memory where the system provides a useful abstraction.
Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 14: Envelopes Ken Greenebaum.
Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.
Sound and Digital Sound v © Allan C. Milne Abertay University.
Status report 2010/10/5 Atsushi Nukariya. Revision of control manager (1) ・ The things which control manager controls are as follows. 1. Double buffer.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose:  This course provides an overview of the serial communication.
Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 9: Panning/Balance Ken Greenebaum.
Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 4: Interfaces Ken Greenebaum.
IMGD-1001 The Game Development Process Class 15 Thursday, 24 September 2009.
Time Management.  Time management is concerned with OS facilities and services which measure real time.  These services include:  Keeping track of.
Fall 2000M.B. Ibáñez Lecture 26 I/O Systems II. Fall 2000M.B. Ibáñez Application I/O Interface I/O system calls encapsulate device behaviors in generic.
Introduction to Interactive Media Interactive Media Raw Materials: Digital Data.
Where Testing Fails …. Problem Areas Stack Overflow Race Conditions Deadlock Timing Reentrancy.
COMPUTER NETWORKS Lecture-8 Husnain Sherazi. Review Lecture 7  Shared Communication Channel  Locality of Reference Principle  LAN Topologies – Star.
Computer Control and Monitoring Today we will look at: What we mean by computer control Examples of computer control Sensors – analogue and digital Sampling.
Calliope-Louisa Sotiropoulou FTK: E RROR D ETECTION AND M ONITORING Aristotle University of Thessaloniki FTK WORKSHOP, ALEXANDROUPOLI: 10/03/2014.
© Oxford University Press All rights reserved. Data Structures Using C, 2e Reema Thareja.
High-Speed Control and Disk Streaming Monday Aug 24, 2:30 - 4:00 p.m. Thursday Aug 27, 12:45 - 2:15 p.m. and 2:30 - 4:00 p.m. Red River (4B) Aljosa (Al)
Serial Communications
Digital Control CSE 421.
Data Structures Using C, 2e
Queues.
CS 6560: Operating Systems Design
* Initialization (power-up, run)
Lectures Queues Chapter 8 of textbook 1. Concepts of queue
CS510 Operating System Foundations
Digital Audio Processing
This chapter provides a series of applications.
Asynchronous Serial Communications
Chapter 9: Virtual-Memory Management
Technology ICT Option: Audio.
CSCI1600: Embedded and Real Time Software
Lecture Topics: 11/1 General Operating System Concepts Processes
Technology ICT Option: Audio.
Serial Communications
Presentation transcript:

Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 6: Wrapped I/O Ken Greenebaum

Copyright 2004 Ken Greenebaum Assignment 1 Most people got it completely Most people got it completely Most common mistake missing the: Most common mistake missing the: scale = 0.5 * pow(2, numBits) - 1; scale = 0.5 * pow(2, numBits) - 1;

Copyright 2004 Ken Greenebaum Assignment 2 Questions? Questions?

Copyright 2004 Ken Greenebaum Assignment 2 4 new lines: 4 new lines: 1. #include "pablio.h“ 2. float buffer[1]; 3. OpenAudioStream(&outStream, 48000, paFloat32, PABLIO_WRITE|PABLIO_MONO); 4. WriteAudioStream(outStream, buffer, 1);

Copyright 2004 Ken Greenebaum Assignment 2 2 lines modified: 2 lines modified: 1. double frameTime = 1.0/48000; 2. buffer[0] = (float)sin(2*PI*frequency*theta);

Copyright 2004 Ken Greenebaum Assignment 2 Stereo? Stereo? Default mode Default mode Multiplexed L,R Multiplexed L,R Buffer[0], Buffer[1] Buffer[0], Buffer[1] 1 Frame = 2 Samples 1 Frame = 2 Samples

Copyright 2004 Ken Greenebaum Assignment 2 You did it! You did it! Sampling/Quantization/Synthesis Sampling/Quantization/Synthesis Audio Out Audio Out We can do anything now (and will) We can do anything now (and will) Next assignment: Next assignment: Collision synthesizer Collision synthesizer Using additive synthesis Using additive synthesis Wood, glass, bells Wood, glass, bells Will get us thinking about the mixer to come Will get us thinking about the mixer to come

Copyright 2004 Ken Greenebaum Ring Buffer Review Ring Buffer FIFO: Ring Buffer FIFO:

Copyright 2004 Ken Greenebaum Ring Buffer Review Ring Buffer Algebra: Ring Buffer Algebra: Samples Available Samples Available (Tail - Head - 1) mod Size (Tail - Head - 1) mod Size Space Available Space Available min((Head - Tail -1) mod Size, high water mark) min((Head - Tail -1) mod Size, high water mark) Empty Buffer when Empty Buffer when Head = TailBuffer Head = TailBuffer Full when Full when (Head - Tail) Mod Size = 1 (Head - Tail) Mod Size = 1

Copyright 2004 Ken Greenebaum Introduction to the Ring Buffer FIFO Queue Latency control via watermarks: Latency control via watermarks:

Copyright 2004 Ken Greenebaum Introduction to the Ring Buffer FIFO Queue Buffer over time: Buffer over time:

Copyright 2004 Ken Greenebaum Introduction to the Ring Buffer FIFO Queue Key Concepts: Key Concepts: Hysteresis (implications in thermostat) Hysteresis (implications in thermostat) Latency Latency Controlled by high water mark Controlled by high water mark Opportunities in latency Opportunities in latency Elasticity - Variable latency Elasticity - Variable latency Importance of the low water mark Importance of the low water mark Unblocking in time to re-fill Unblocking in time to re-fill

Copyright 2004 Ken Greenebaum Introduction to the Ring Buffer FIFO Queue Knowing the future by living in the (near) past: Knowing the future by living in the (near) past:

Copyright 2004 Ken Greenebaum Wrapped I/O: Questions from reading? Questions from reading?

Copyright 2004 Ken Greenebaum Wrapped I/O: Benefits to wrapping ring buffer in API: Benefits to wrapping ring buffer in API: Data abstraction Data abstraction Allows data structure to change Allows data structure to change Enforce uniform access Enforce uniform access Contract allows ring buffer algebra to work Contract allows ring buffer algebra to work Code re-use Code re-use Every application doesn’t have to re-create the wheel Every application doesn’t have to re-create the wheel (Potentially inconsistently!) (Potentially inconsistently!)

Copyright 2004 Ken Greenebaum Wrapped I/O: Issues with wrapping ring buffer in API: Issues with wrapping ring buffer in API: Extra copy required Extra copy required Actually Read and Write req’d anyway Actually Read and Write req’d anyway Perhaps limit possibilities: Perhaps limit possibilities: Move H or T w/o modifying samples Move H or T w/o modifying samples

Copyright 2004 Ken Greenebaum Buffer Issues D/A, A/D are realtime devices D/A, A/D are realtime devices Can’t be blocked Can’t be blocked Need/Generate Frame every 1/FrameRate seconds Need/Generate Frame every 1/FrameRate seconds Underflow Underflow D/A requires next sample but RB empty D/A requires next sample but RB empty Producer wasn’t run in time to meet deadline Producer wasn’t run in time to meet deadline Overflow Overflow A/D produces next sample but RB is full A/D produces next sample but RB is full Consumer wasn’t run in time to meet deadline Consumer wasn’t run in time to meet deadline

Copyright 2004 Ken Greenebaum Buffer Issues Underflow, Overflow result: Underflow, Overflow result: Dropped samples Dropped samples Lost forever Lost forever Annoying clicks, pops Annoying clicks, pops Very Annoying sound loop Very Annoying sound loop

Copyright 2004 Ken Greenebaum Underflow Policies Stop (silently) + wait for the missing data Stop (silently) + wait for the missing data Application: Radio talk show Application: Radio talk show Continue immediately Continue immediately Application: Playing music Application: Playing music Give up and start all over again Give up and start all over again Application: Mastering CD Application: Mastering CD

Copyright 2004 Ken Greenebaum Underflow Policy Quiescent underflow Quiescent underflow System provides zero’s (silence) on underflow System provides zero’s (silence) on underflow SGI AL, PABLIO SGI AL, PABLIO Consumer zero’s samples after they are used Consumer zero’s samples after they are used Non-Quiescent underflow Non-Quiescent underflow DirectSound DirectSound Many (most?) libraries Many (most?) libraries

Copyright 2004 Ken Greenebaum Quiescent Underflow Uses Sound injection Sound injection Hold sound stream open Hold sound stream open Only inject (brief) sounds as desired Only inject (brief) sounds as desired No need for audio process to wait and flush the samples out No need for audio process to wait and flush the samples out Sound may played at time with extreme precision Sound may played at time with extreme precision

Copyright 2004 Ken Greenebaum Stricter Underflow Policy Underflow notification required: Underflow notification required: Recording/Mastering application Recording/Mastering application Master failed, need to re-record Master failed, need to re-record Debugging/Tuning realtime application Debugging/Tuning realtime application Perhaps human tuning Perhaps human tuning Perhaps automatic, dynamic tuning Perhaps automatic, dynamic tuning Using high-water mark Using high-water mark Fallback to higher latency Fallback to higher latency Fallforward? Fallforward?

Copyright 2004 Ken Greenebaum Aliasing Underflow must be detected in audio system Underflow must be detected in audio system Did the pointer advance by one sample? Did the pointer advance by one sample? Or loop completely? Or loop completely?

Copyright 2004 Ken Greenebaum Detecting Aliasing in User-space Attempt to monitor underflow/aliasing Attempt to monitor underflow/aliasing Using large buffer: Using large buffer: (underflow?) (underflow?)

Copyright 2004 Ken Greenebaum Detecting Aliasing in User-space May also use another clock source May also use another clock source CPU’s high resolution timer CPU’s high resolution timer Issue Issue Another clock isn’t locked to D/A Another clock isn’t locked to D/A Overcome using synchronization techniques Overcome using synchronization techniques

Copyright 2004 Ken Greenebaum Does your computer drop samples? Well does it? Well does it? How do you know? How do you know? What can you do about it? What can you do about it?

Copyright 2004 Ken Greenebaum Ramptest Output a known signal Output a known signal What signal? What signal? Why? Why? Loopback outback to input Loopback outback to input Analyze the signal received Analyze the signal received Best if digital loopback Best if digital loopback What conditions to test for? What conditions to test for?

Copyright 2004 Ken Greenebaum Latency as a cure-all? Many audio systems will increase buffering in an attempt to provide more robustness Many audio systems will increase buffering in an attempt to provide more robustness How much buffering in your system? How much buffering in your system? How to determine this? How to determine this? What are the costs of latency? What are the costs of latency?

Copyright 2004 Ken Greenebaum Canonicalization/Mixing Hardware probably has native format Hardware probably has native format 16 bit 2’s complement stereo? 16 bit 2’s complement stereo? Nice if system accepts any format Nice if system accepts any format Easiest to mix like streams Easiest to mix like streams Copy opportunity to canonicalize format Copy opportunity to canonicalize format Can attenuate Can attenuate Can even re-sample at this time too Can even re-sample at this time too

Copyright 2004 Ken Greenebaum Underflow in a Mixer What should happen if one stream of a mix underflows? What should happen if one stream of a mix underflows? 1. Underflow the result of the mix? 2. Allow the mix to continue minus the one channel? AL does #2 AL does #2 What does Direct Sound do? What does Direct Sound do? Why? Why?

Copyright 2004 Ken Greenebaum Overflow in a Mixer Opposite of a mixed output Opposite of a mixed output Fanned out input Fanned out input Input signal provided to many consumers simulteneously Input signal provided to many consumers simulteneously Why would this be desirable? Why would this be desirable?

Copyright 2004 Ken Greenebaum Fan-out Simultaneous Examples: Simultaneous Examples: Audio recorder Audio recorder Audio level meter Audio level meter Voice recognizer Voice recognizer What should happen if one stream in a fanout backs up? What should happen if one stream in a fanout backs up?

Copyright 2004 Ken Greenebaum Overflow in Fan-out AL provides input to all inputs AL provides input to all inputs Only the overflowing buffer loses samples Only the overflowing buffer loses samples

Copyright 2004 Ken Greenebaum Readings: Audio Anecdotes Audio Anecdotes Perceivable Audio Latencies Perceivable Audio Latencies

Copyright 2004 Ken Greenebaum Next class: Perception of Latency Perception of Latency Additive Synthesis Additive Synthesis Next assignment: Collision Synth Next assignment: Collision Synth