Chapter 5.5 Audio Programming Lacey Montgomery. 2 Audio Programming Audio in games is more important than ever before - less repetitive - More complex.

Slides:



Advertisements
Similar presentations
CSE 380 – Computer Game Programming Audio Engineering.
Advertisements

Chapter 5.5 Audio Programming
Sound in multimedia How many of you like the use of audio in The Universal Machine? What about The Universal Computer? Why or why not? Does your preference.
Sound can make multimedia presentations dynamic and interesting.
1. Digitization of Sound What is Sound? Sound is a wave phenomenon like light, but is macroscopic and involves molecules of air being compressed and expanded.
GCSE Computing#BristolMet Session Objectives#10 MUST define the term sample rate COULD explain how sound can be sampled and stored in digital form SHOULD.
Chapter 4: Representation of data in computer systems: Sound OCR Computing for GCSE © Hodder Education 2011.
Digital Audio Coding – Dr. T. Collins Standard MIDI Files Perceptual Audio Coding MPEG-1 layers 1, 2 & 3 MPEG-4.
Chapter 5-Sound.
I Power Higher Computing Multimedia technology Audio.
SWE 423: Multimedia Systems Chapter 3: Audio Technology (2)
CHAPTER 16 Audio © 2008 Cengage Learning EMEA. LEARNING OBJECTIVES In this chapter you will learn about: – –The fundamentals of sound – –DirectX Audio.
COMPUTER AUDIO CGDD 4003 What is Sound?  Compressions of air or other media (such as water or metal) from something vibrating  Sounds are made up of.
Digital Audio.
Chapter 5.5 Audio Programming. 2 Audio Programming Audio in games is more important than ever before.
Digital Voice Communication Link EE 413 – TEAM 2 April 21 st, 2005.
EET 450 Chapter 18 – Audio. Analog Audio Sound is analog Consists of air pressure that has a variety of characteristics  Frequencies  Amplitude (loudness)
1 Manipulating Digital Audio. 2 Digital Manipulation  Extremely powerful manipulation techniques  Cut and paste  Filtering  Frequency domain manipulation.
Game Audio Mark Peskir November 14, 2005 ITCS 5010.
5. Multimedia Data. 2 Multimedia Data Representation  Digital Audio  Sampling/Digitisation  Compression (Details of Compression algorithms – following.
Chapter 14 Recording and Editing Sound. Getting Started FAQs: − How does audio capability enhance my PC? − How does your PC record, store, and play digital.
Digital Audio Multimedia Systems (Module 1 Lesson 1)
Introduction to Sound Sounds are vibrations that travel though the air or some other medium A sound wave is an audible vibration that travels through.
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?
Digital Sound and Video Chapter 10, Exploring the Digital Domain.
Fundamentals Rawesak Tanawongsuwan
Introduction to Interactive Media 10: Audio in Interactive Digital Media.
COMP Representing Sound in a ComputerSound Course book - pages
Audio. Why Audio Essential tool for – Interface – Narrative – Setting & Mood.
CHAPTER SEVEN SOUND. CHAPTER HIGHLIGHTS Nature of sound – Sine waves, amplitude, frequency Traditional sound reproduction Digital sound – Sampled – Synthesized.
CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play.
Signal Digitization Analog vs Digital Signals An Analog Signal A Digital Signal What type of signal do we encounter in nature?
Multimedia Elements: Sound, Animation, and Video.
Overview of Multimedia A multimedia presentation might contain: –Text –Animation –Digital Sound Effects –Voices –Video Clips –Photographic Stills –Music.
Sound Part 2 Sound and how to make it. What is Sound? Sound is a compression wave.
Multimedia Technology and Applications Chapter 2. Digital Audio
Games Development Practices Sound Effects & OpenAL CO2301 Games Development 1 Week 15.
Chapter 15 Recording and Editing Sound. 2Practical PC 5 th Edition Chapter 15 Getting Started In this Chapter, you will learn: − How sound capability.
MULTIMEDIA TECHNOLOGY SMM 3001 MEDIA - VIDEO. In this chapter How digital video differs from conventional analog video How digital video differs from.
Sound element Week - 11.
More Meaningful Jargon Or, All You Need to Know to Speak Like a Geek Sound.
IMGD-1001 The Game Development Process Game Audio (Content by professor Brian Moriarty)
CS Spring 2009 CS 414 – Multimedia Systems Design Lecture 3 – Digital Audio Representation Klara Nahrstedt Spring 2009.
© 2011 The McGraw-Hill Companies, Inc. All rights reserved Chapter 4: Sound.
Marwan Al-Namari 1 Digital Representations. Bits and Bytes Devices can only be in one of two states 0 or 1, yes or no, on or off, … Bit: a unit of data.
MMDB-8 J. Teuhola Audio databases About digital audio: Advent of digital audio CD in Order of magnitude improvement in overall sound quality.
CSCI-100 Introduction to Computing Hardware Part II.
COMP135/COMP535 Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 2 Lecture 2 – Digital Representations.
IntroductiontMyn1 Introduction MPEG, Moving Picture Experts Group was started in 1988 as a working group within ISO/IEC with the aim of defining standards.
CS Spring 2014 CS 414 – Multimedia Systems Design Lecture 3 – Digital Audio Representation Klara Nahrstedt Spring 2014.
Glencoe Introduction to Multimedia Chapter 8 Audio 1 Section 8.1 Audio in Multimedia Audio plays many roles in multimedia. Effective use in multimedia.
1 What is Multimedia? Multimedia can have a many definitions Multimedia means that computer information can be represented through media types: – Text.
Fundamentals of Multimedia Chapter 6 Basics of Digital Audio Ze-Nian Li and Mark S. Drew 건국대학교 인터넷미디어공학부 임 창 훈.
© 2011 The McGraw-Hill Companies, Inc. All rights reserved Chapter 4: Sound.
Lifecycle from Sound to Digital to Sound. Characteristics of Sound Amplitude Wavelength (w) Frequency ( ) Timbre Hearing: [20Hz – 20KHz] Speech: [200Hz.
XP Practical PC, 3e Chapter 14 1 Recording and Editing Sound.
CS 426 : Multimedia Audio & Sound Design © Steve Jones Communication & Electronic Visualization Lab, University of Illinois at Chicago.
Chapter 8 Sound FX Composition. Chapter 8 Sound FX Composition.
Chapter 15 Recording and Editing Sound
CSCE 552 Spring 2010 Audio By Jijun Tang.
Introduction to Digital Audio
Data Representation Keywords Sound
Introduction to Digital Audio
Introduction to Digital Audio
Introduction to Digital Audio
Games Development Practices Sound Effects
Assist. Lecturer Safeen H. Rasool Collage of SCIENCE IT Dept.
Introduction to Digital Audio
Digital Audio Application of Digital Audio - Selected Examples
Presentation transcript:

Chapter 5.5 Audio Programming Lacey Montgomery

2 Audio Programming Audio in games is more important than ever before - less repetitive - More complex sound and musical components

3 Programming Basic Audio Most gaming hardware has similar capabilities (on similar platforms)  Mostly programming interfaces differ Learning fundamental concepts of audio programming is important

4 API Choices DirectSound (part of DirectX API)  Only available on Windows platforms  Free  Most popular  Antiquated, faults, problems  Support and Example Code

5 More API Choices OpenAL (like OpenGL, but for sound)  Newer API  Available on multiple platforms  Lack of support for basic 2D sound rendering  Proprietary APIs Typically available on consoles 3 rd Party Licensable APIs Can offer broad cross-platform solutions

6 Analog Sound Wave

7 Basic Audio Terminology and Physics Amplitude  Measurement of a sound wave’s pressure (positive or negative direction) Frequency  Measurement of the interval between wave cycles, typically measured in Hertz (cycles/second) Pitch  The perception of frequency (perceive high notes at a slightly higher frequency and lower notes at a slightly higher frequency), usually used interchangeably with Frequency Tuning  Musical distribution of frequencies over keys Decibel  Measures sound amplitude, measures perceived difference in loudness between two sounds

8 Digital Representation of a Sound Wave

9 Most common technique known as sampling  Sampling involves measuring the amplitude of the analog wave file at discrete intervals  Sampling Rate = frequency of sampling  Each sample is typically stored in a value ranging from 4 to 24 bits in size  The size of the sample value in bits is known as the ‘bit depth’  Music CDs have a sample rate and bit depth of 44.1 kHz (samples/sec) and 16 bits (sample size)

10 Quantization Error in Sampling Amplitude cannot be perfectly represented due to low bit depth Lower the bit depth, the more noise that will be introduced into the signal

11 Bit Depth and Signal Noise Bit depth of sample data affects signal noise  Signal to noise ratio = number of available bits / 1  For example, 8-bit samples have a 256:1 SNR (~48 dB), and 16-bit samples have a 65,536:1 SNR (~96 dB)  Decibel ratio is calculated using 10 x log 10 (ratio) or x log e (ratio)

12 Sampling Frequency and Frequency Reproduction Sampling frequency affects range and quality of high-frequency reproduction Nyquist Limit  Frequencies up to one-half the sampling rate can be reproduced  Audio quality degrades as frequency approaches this limit

13 Modern Audio Hardware Samples are piped into sound “channels”  Often a hardware pipeline from this point Various operations, such as volume, pan, and pitch may be applied 3D sounds may apply HRTF algorithms and/or mix the sound into final output buffers.

14 Sound Playback Techniques Two basic playback methods: 1. Play sample entirely from memory buffer 2. Stream data in real-time from storage medium Streaming is more memory efficient for very large audio files, such as music tracks, dialogue, etc Streaming systems use either a circular buffer with read-write pointers, or a double-buffering algorithm

15 Sample Playback and Manipulation Three basic operations  Panning is the attenuation of left and right channels of a mixed sound Results in spatial positioning within the aural stereo field  Pitch allows the adjustment of a sample’s playback frequency in real-time  Volume control typically attenuates the volume of a sound Amplification is generally never supported

16 Compressed Audio Format Compressed audio formats allow sound and music to be stored more compactly  Bit reduction codecs generally are lightweight ADPCM compression is implemented in hardware on all the major current video game console systems  Psycho-acoustic codecs often have better compression Require substantially more computational horsepower to decode

17 MP3, Ogg Vorbis, Licensing & Patent Issues The MP3 format is patented  Any commercial game is subject to licensing terms as determined by Fraunhofer & Thompson Multimedia, the holders of the patents Ogg Vorbis is similar to MP3 in many ways  Open source and patent-free (royalty-free) Be aware of patent and license restrictions when using 3 rd party software

18 ADSR Envelope (Attack, Decay, Sustain, Release)

19 3D Audio Two sets of data required when working in world coordinates:  Listener Data Composed of world position and orientation (virtual microphone in the world)  Source Data Composed of sound position, orientation, velocity, etc (virtual sound source in the world)

20 Environmental Effects Environmental effects nearly always implemented in hardware Sound transmission is categorized in three ways  Direct transmission  Early reflections (echo)  Late reflections (reverberation)

21 Sound Transmission Categories

22 Programming Music Systems Two common music systems  MIDI-based systems (Musical Instrument Digital Interface)  Digital audio streaming systems (CD audio, MP3 playback, etc)

23 Advantages and Disadvantages of MIDI Actual music data size is negligible Easy to control, alter, and even generate in real-time High quality music is more difficult to compose and program Only effective if you can guarantee playback of a common instrument set

24 Other MIDI-based technologies to be aware of DLS (DownLoadable Sound) Format  A standardized format for instrument definition files iXMF (Interactive eXtensible Music Format)  New proposed standard for a container format for interactive music

25 Advantages / Disadvantages of Digital Audio Streams Superb musical reproduction is guaranteed Allows composers to work with any compositional techniques Some potential interactivity is sacrificed for expediency and musical quality Generally high storage requirements

26 A Conceptual Interactive Music Playback System Divide music into small two to eight-bar chunks that we’ll call segments. A network of transitions from segment to segment (including loops and branches) is called a theme. Playing music is now as simple as choosing a theme to play. The transition map tracks the details.

27 Advanced Audio Programming 3D Audio Environmental Effects Integration Audio Scripting and Engine Integration Lip-sync Technology Advanced Voice Playback Voice Recognition

28 3D Audio Environmental Effects Integration Environmental effects should be driven by a room’s shape and material composition.  Can determining the optimal effect settings be done automatically?  This may be important as game worlds become larger and more complex

29 3D Audio Environmental Effects Integration (cont) Sound occlusion and damping is a particularly difficult problem to solve  This is essentially a pathfinding problem for audio.  Doors can dynamically affect a sound’s properties  Very few titles have even attempted a robust, general-purpose, and automated solution to these problems.

30 Dynamic Occlusion

31 Audio Scripting and Engine Integration Very little audio programming should be done by general game programmers Game Engine should offer robust support for audio triggers and scripts Engine should deal with audio scripts, not “sound files”

32 Audio Scripting Many situations require much more information than can be embedded in a linear audio file  Sound Variation  Sound Repetition  Complex Sound Looping  Background Ambience

33 Lip-sync Technology Lip-sync technology is a blending of audio and visual techniques to create realistic- looking speech by in-game actors.  Simple techniques such as waveform amplitude measurement has worked previously, but…  In future titles, it will be considered inadequate.  Much work can still be done in this field.

34 Advanced Voice Playback Real-time spoken feedback is especially important in sports titles (simulated announcers) Game are reaching the limits of what current techniques (canned, prerecorded phrases combined in series) can provide. Again, this is an opportunity for future groundbreaking audio work.

35 Voice Recognition Spoken commands are much easier to deliver in certain situations.  Squad-based tactical shooters. Current generation systems are still very error prone.  Research Area

36 Music for Games Remember copyright laws If you use someone else’s work for a game you plan to sell, GET PERMISSION. Writing your own music may be the better option. Fruity-Loops/FL Studios (Windows) Garage Band (Mac)

37 Writing Music for Games Start with a theme. Steal ideas, not whole songs. Use variations of a theme and build on it until you have a complete song. It doesn’t need to be very long… its going to be playing over and over anyway! The longest song on the Half-Life 2 soundtrack is less than 3 minutes long!

38 Screenshots of Fruity Loops

39 More Fruity Loops

40 Garage Band

41 More Garage Band

The End Any Questions?