CS 4455: Video Game Design & Implementation

Similar documents
Digital Media. Daniel Fuller ITEC 2110

Chapter 5.5 Audio Programming

ITNP80: Multimedia! Sound-II!

Lecture #3: Digital Music and Sound

Digital Audio. Amplitude Analogue signal

08 Sound. Multimedia Systems. Nature of Sound, Store Audio, Sound Editing, MIDI

3 Sound / Audio. CS 5513 Multimedia Systems Spring 2009 LECTURE. Imran Ihsan Principal Design Consultant

Level Editor. Should be stable (as of Sunday) Will be updating the source code if you want to make tweaks to it for your final

Fundamental of Digital Media Design. Introduction to Audio

CHAPTER 10: SOUND AND VIDEO EDITING

Data Representation. Reminders. Sound What is sound? Interpreting bits to give them meaning. Part 4: Media - Sound, Video, Compression

Wolf-Tilo Balke Silviu Homoceanu Institut für Informationssysteme Technische Universität Braunschweig

UNDERSTANDING MUSIC & VIDEO FORMATS

the gamedesigninitiative at cornell university Lecture 15 Game Audio

CS 074 The Digital World. Digital Audio

Digital Audio Basics

Optimizing Audio for Mobile Development. Ben Houge Berklee College of Music Music Technology Innovation Valencia, Spain

CHAPTER 6 Audio compression in practice

Principles of Audio Coding

Squeeze Play: The State of Ady0 Cmprshn. Scott Selfon Senior Development Lead Xbox Advanced Technology Group Microsoft

Elementary Computing CSC 100. M. Cheng, Computer Science

A Digital Audio Primer

2.4 Audio Compression

Rich Recording Technology Technical overall description

Basic features. Adding audio files and tracks

Embedding Audio into your RX Application

DIY Audio Rosanne Hutton, MindCross Training

ITEC 120 2/25/11. Review. Objectives. Sound. Arrays. Lecture 18 Sound. See a real world usage of arrays

MV-8800 Production Studio

ICT 514 Multimedia Systems Topic 4: Audio

Audio Coding and MP3

Transporting audio-video. over the Internet

Digital Music. You can download this file from Dig Music May

Introducing Audio Signal Processing & Audio Coding. Dr Michael Mason Senior Manager, CE Technology Dolby Australia Pty Ltd

Teaching KS3 Computing. Session 5 Theory: Representing text and sound Practical: Building on programming skills

计算原理导论. Introduction to Computing Principles 智能与计算学部刘志磊

AudioLiquid Converter User Guide

Audio Fundamentals, Compression Techniques & Standards. Hamid R. Rabiee Mostafa Salehi, Fatemeh Dabiran, Hoda Ayatollahi Spring 2011

3.01C Multimedia Elements and Guidelines Explore multimedia systems, elements and presentations.

COS 116 The Computational Universe Laboratory 4: Digital Sound and Music

COS 116 The Computational Universe Laboratory 4: Digital Sound and Music

Introducing Audio Signal Processing & Audio Coding. Dr Michael Mason Snr Staff Eng., Team Lead (Applied Research) Dolby Australia Pty Ltd

CHAPTER 2 - DIGITAL DATA REPRESENTATION AND NUMBERING SYSTEMS

Java Sound API Programmer s Guide

Skill Area 325: Deliver the Multimedia content through various media. Multimedia and Web Design (MWD)

Bits, bytes, binary numbers, and the representation of information

Lossy compression. CSCI 470: Web Science Keith Vertanen

Mpeg 1 layer 3 (mp3) general overview

Multimedia Systems Speech I Mahdi Amiri February 2011 Sharif University of Technology

Export Audio Mixdown

Digital Media. Daniel Fuller ITEC 2110

HP-1B Bluetooth Stereo Headphones USER S MANUAL

Audio for Everybody. OCPUG/PATACS 21 January Tom Gutnick. Copyright by Tom Gutnick. All rights reserved.

Skill Area 214: Use a Multimedia Software. Software Application (SWA)

Digital Media Getting Started

Inserting multimedia objects in Dreamweaver

5: Music Compression. Music Coding. Mark Handley

Digital Media. Lecture 2: SemesterOverview. Georgia Gwinnett College School of Science and Technology Dr. Mark Iken

Sound 5 11/21/2016. Use MIDI and understand its attributes, especially relative to digitized audio.

University of Pennsylvania Department of Electrical and Systems Engineering Digital Audio Basics

CSC 101: Lab #7 Digital Audio Due Date: 5:00pm, day after lab session

Table of Contents. Chapter 1 Overview Chapter 2 Interface & Controls Interface MaxxAudio Views Preset System...

Lecture 19 Media Formats

Introduction to LAN/WAN. Application Layer 4

Extraction and Representation of Features, Spring Lecture 4: Speech and Audio: Basics and Resources. Zheng-Hua Tan

Digitization of Multimedia Elements

Completing the Multimedia Architecture

Soundance Bluetooth Speaker User Manual Model SDY019

What Do I Really Need to Know about itunes? COPYRIGHTED MATERIAL

GCSE Computing. Revision Pack TWO. Data Representation Questions. Name: /113. Attempt One % Attempt Two % Attempt Three %

Core Audio. MSDOSX : Lecture 20

Compression; Error detection & correction

Introducing working with sounds in Audacity

VS1063 ENCODER DEMONSTRATION

REVIEW: PROCEDURES FOR PRODUCING AUDIO

Linked Structures Songs, Games, Movies Part IV. Fall 2013 Carola Wenk

ELL 788 Computational Perception & Cognition July November 2015

Data Representation. Data is more than just numbers! Representations of Text ASCII. Interpreting bits to give them meaning.

Super UA Q&A 2015/03/16

Aud-X 5.1 Help.

Lecture 16 Perceptual Audio Coding

AAMS Auto Audio Mastering System V3 Manual

What is multimedia? Multimedia. Continuous media. Most common media types. Continuous media processing. Interactivity. What is multimedia?

Audio Compression. Audio Compression. Absolute Threshold. CD quality audio:

AET 1380 Digital Audio Formats

The 1-Bit Advantage Future Proof Recording

fffasdf Pro Tools App 2 Week 1 Chapter 1: Basics I Chapter 1: Basics I 2017 Dajaun Martineau 1

For Mac and iphone. James McCartney Core Audio Engineer. Eric Allamanche Core Audio Engineer

The Design and Implementation of Multimedia Software

Auralization and Geometric acoustics ERIK MOLIN, HANNA AUTIO

CS378 -Mobile Computing. Audio

Here is the design that I created in response to the user feedback.

How Analog and Digital Recording and CDs Work Adapted from by Marshall Brain

COMP : Practical 11 Video

Multimedia. What is multimedia? Media types. Interchange formats. + Text +Graphics +Audio +Image +Video. Petri Vuorimaa 1

HTML5: MULTIMEDIA. Multimedia. Multimedia Formats. Common Video Formats

Physics 9 Friday, September 28, 2018

Data Compression. Audio compression

Analogue Ripper. What TAR does not do. Record Albums Break Them Into Tracks Send the tracks to itunes

Euphonia. Manual. by tb-software (C) tb-software 2014 Page 1 of 6

Transcription:

CS 4455: Video Game Design & Implementation March 31, 2006: Audio (Insert Disclaimer Here)

Overview Today s Lecture What I m talking about now Audio Theory Digitizing Sound Game Implementation High Level APIs

Why is Audio important?

What is audio? Inside your ear is an eardrum A thin piece of skin When it vibrates, your brain interprets this as sound Changes in air pressure often cause this vibration

How Audio Works An object produces sound when it vibrates This moves air particles Those particles in turn move other particles

Terms to Note: Wavelength - distance between repeating points Amplitude - non-negative height of the wave

Audio Terminology Terms: Period - How long it takes between cycles Frequency - How many cycles occur (These are inverses)

Audio Terminology The faster they loop, the higher their frequency. The SI unit for this is Hertz (Hz). 1 Hz = once a second, 1 KHz = one thousand times a second

Audio Terminology Intensity = the power of the sound A fairly large scale, so usually expressed logarithmically: With Sound, I0 ~= 10^-12 W/m^2

0dB 10dB 30dB 60dB 70dB 90dB 100dB 120dB 150dB 250dB Common DB Levels Threshold of hearing Human breathing at 3 meters Theatre, no talking Inside of office or restaurant Busy traffic at 5m Loud factory, heavy truck at 1m Jack Hammer at 2m; inside disco Rock Concert Jet engine at 3m Inside tornado; nuclear bomb @ 5m +10dB means 10 times as powerful +3dB roughly twice as powerful

Fun facts about audio strength 85dB 120dB 150dB 163dB 19xdB 200dB potentially harmful to hearing unsafe physical damage to body windows break eardrums rupture can cause death

Digitizing Sound

Sampling At a given interval, sample the amplitude of the wave

Sampling: Nyquist Limit Nyquist Limit - a given sampling rate can only represent frequencies up to one-half that rate

Sampling Typical factors on a computer How many times per second? How many levels can we differentiate between? How many channels?

CD Quality audio Sampling 44kHz (44,100 samples/sec) 16-bit (65,536 possible levels) 2 channels (left and right) 176,400 bytes/sec This is approximately 6 seconds per megabyte!

Sampling Low Quality Audio 8kHZ (8 samples per second) 8-bit (1 byte) 1 channel 8,000 bytes/sec About two minutes per megabyte

Sampling Comparison

Sampling Comparison

What can we do? (Or, a brief history of computer audio)

FM synthesis Used in early systems like the GameBoy Hardware continually produced one or more sine waves (sometimes other shapes, too) Software could modify frequency and amplitude Can be done in very little space (the BIGGEST GameBoy games were about 1/2MB)

FM synthesis demo

MIDI synthesis Common in PC sound cards and many consoles, such as the Super Nintendo (SNES), Genesis, your cellphone... MIDI files contain instructions to turn on or off various instruments Instruments are externally defined Therefore, small file format Sound can differ player-to-player

MIDI synthesis demo

Module Audio Like MIDI, but you can (or are required to) supply your own instruments.mod/.s3m/.xm/.it file formats Used in the PlayStation, also common on the GameBoy Advance Usually still small, if you can share instruments

Module Audio Demo

RedBook Audio Music is streamed from CD Commonly used on the SegaCD May need to buffer or avoid when you need to read from the CD! Takes a lot of space

RedBook Audio Demo (Realistic Depiction of Bonus Stage)

Compressed Audio General Compression Lossy - small changes okay Loseless - must be 100% preserved

Compressed Audio Audio Compression Bit Reduction DPCM encodes the differences between subsequent samples (the D is for differential or delta) ADPCM is a more advanced version

Compressed Audio Audio Compression Psycho-acoustic Designed with human hearing in mind MP3, AAC, OGG, WMA,.etc

Compressed Audio Demo Nah.

Gaming Implementation

Gaming Implementation Sound in most games is divided into two parts: Background music Sound Effects

Background Music Unlike movies and TV, not timed Ambient and looping Can be streamed

Sound Effects Characteristics Typically very short Often tied to an event Examples: Gun fire, character is hit, explosion, speech,.etc Generally stored in memory

Mixing In many game consoles, separate HW for these functions is not unusual Hardware MIDI standard in some If not, convert to sampled in software

Mixing Software mixing is easy If sample rates are the same Just add! Beware of exceeding the max

Mixing Example def mixsound(dest, source): for i in range(1, min(getlength(dest), getlength(source))): sourcevalue = getsamplevalueat(source, i) destvalue = getsamplevalueat(dest, i) setsamplevalueat(dest, i, sourcevalue + destvalue)

Buffering When reading or converting sound, you need to stay ahead of the audio out device but can t convert the whole song Two techniques for buffers: Circular buffers - read and write in same buffer Buffer chaining - write to buffer, read from the other, swap

High Level APIs Audio is a lot simpler than graphics (in a game). A lot of APIs can be condensed to: Play(sample, loops) Stop(sample) SetPan SetVolume SetSpeed

Example Sound APIs Cross platform 2D APIs Java Sound SDL QuickTime Sound APIs with 3D support OpenAL DirectSound (NOT crossplatform)

Example (JavaSound) Sequence sequence = MidiSystem.getSequence(new java.net.url(url)); // Create a sequencer for the sequence Sequencer sequencer = MidiSystem.getSequencer(); sequencer.open(); sequencer.setsequence(sequence); sequencer.start(); See packages under javax.sound such as javax.sound.midi and javax.sound.sampled

Positional Audio Basic Theory Sound distance and volume are inversely related Sound differences in the ears help determine position

3D Audio Problem with traditional two speaker or headphone setup Forward vs. Behind Speaker setups available that have 5, 6, or 7 speakers Speaker setup tends to differ, so this is difficult!

3D Audio Example // Load wav data into a buffer. algenbuffers(1, &Buffer); if (algeterror()!= AL_NO_ERROR) return AL_FALSE; alutloadwavfile("wavdata/footsteps.wav", &format, &data, &size, &freq, &loop); albufferdata(buffer, format, data, size, freq); alutunloadwav(format, data, size, freq); // Bind buffer with a source. algensources(1, &Source); if (algeterror()!= AL_NO_ERROR) return AL_FALSE; alsourcei (Source, AL_BUFFER, Buffer ); alsourcef (Source, AL_PITCH, 1.0f ); alsourcef (Source, AL_GAIN, 1.0f ); alsourcefv(source, AL_POSITION, SourcePos); alsourcefv(source, AL_VELOCITY, SourceVel); alsourcei (Source, AL_LOOPING, AL_TRUE ); // Do an error check and return. } if (algeterror()!= AL_NO_ERROR) return AL_FALSE;

// Initialize OpenAL and clear the error bit. alutinit(null,0); algeterror(); // Load the wav data. if (LoadALData() == AL_FALSE) return 0; SetListenerValues(); // Begin the source playing. alsourceplay(source); // Loop ALint time = 0; ALint elapse = 0; while (!kbhit()) { elapse += clock() - time; time += elapse; if (elapse > 50) { elapse = 0; SourcePos[0] += SourceVel[0]; SourcePos[1] += SourceVel[1]; SourcePos[2] += SourceVel[2]; SourcePos); } } alsourcefv(source, AL_POSITION,

Resources OpenAL tutorials: http://www.devmaster.net/articles/ openal-tutorials/lesson1.php Sound Editing Software: http://audacity.sourceforge.net/ Sound Effects /net/dvfx/hollywood_edge http://www.sounddogs.com/