Games Development Practices Sound Effects & OpenAL CO2301 Games Development 1 Week 15.

Slides:



Advertisements
Similar presentations
Chapter 5.5 Audio Programming
Advertisements

Prepared By: Shakil Raiman.  Sound waves are longitudinal waves  Sound waves are produced by vibration of objects.  Here the loudspeaker vibrate and.
CHAPTER 16 Audio © 2008 Cengage Learning EMEA. LEARNING OBJECTIVES In this chapter you will learn about: – –The fundamentals of sound – –DirectX Audio.
Waves Physical Science Goal 3.04.
Chapter 12 SOUND.
James T. Shipman Jerry D. Wilson Charles A. Higgins, Jr. Waves and Sound Chapter 6.
AMPLITUDE, WAVELENGTH, FREQUENCY AND PITCH. REVISION.
Sound and Hearing. Sound Waves Sound waves are mechanical and longitudinal waves What does this tell you about sound waves? Sound waves need a material.
Sound waves.
Chapter 5.5 Audio Programming. 2 Audio Programming Audio in games is more important than ever before.
1 Multimedia Systems 1 Dr Paul Newbury School of Engineering and Information Technology ENGG II - 3A11 Ext: 2615.
PH 105 Dr. Cecilia Vogel Lecture 3. OUTLINE  Oscillations  Waves  graph  sound  types  Wave behavior  reflection  diffraction.
SOUND WAVE PROPERTIES Sound longitudinal Sound is a longitudinal (Mechanical)wave caused by a vibrating object Molecules collide, producing sound Examples:
Warm-Up: 1)What do you think of when you hear the word “waves”? 2)What do you think it means for something to oscillate?
Harrison County High School Waves. A wave is a disturbance that carries energy through matter or space (356) We generally discuss two types of waves:
17.4 Sound and Hearing Sound waves are longitudinal waves that travel through a medium. Many behaviors of sound can be explained by using a few properties:
ESSENTIAL QUESTION - WHAT ARE SOUND WAVES AND LIGHT WAVES AND HOW DO THEY CARRY ENERGY DIFFERENTLY ? Waves pt 2 Sound vs Light Chapter 17 Chapter 19.
Sound Name: ________________ Class: _________________
DTC 354 Digital Storytelling Rebecca Goodrich. Wave made up of changes in air pressure by an object vibrating in a medium—water or air.
Art 321 Sound, Audio, Acoustics Dr. J. Parker. Sound What we hear as sound is caused by rapid changes in air pressure! It is thought of as a wave, but.
Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.
Go to section Interest Grabber Vibrations A wave is a vibration that carries energy from one place to another. But not all vibrations are waves. Hold a.
Sound Waves. Sound is a Longitudinal Wave particles vibrate parallel to the direction of the motion of the wave.
Like all waves, sound waves are produced by a vibration.  A tuning fork vibrates to produce a sound.  A guitar string vibrates to produce a sound.
Waves A repeating movement or disturbance that transfers energy...
Chapter 13 - Sound 13.1 Sound Waves.
Sound Overview The Facts of Sound The Ear and Sound Sound Vocabulary Musical Instruments and Sound.
The wavelength, λ, is 20 m. What is the speed of this wave? CT Time (sec) A) 1 m/s B) 6 m/s C) 10 m/s D) 15 m/s E) None of the above/not enough.
Chapter 14 Waves and Sound
Notice: A quick lab will require some of you to download a free app on an iPhone or iPod touch. App title: Physics Oscilloscope Size: 309 Kb Compatibility:
Making Sound a longitudinal wave produced when matter vibrates – this in turn, causes the medium in which it is in to vibrate ex: tuning fork (the matter)
Sound Vibration and Motion.
Sound
Phy 103: Fundamentals of Physics III Chapter 20: Sound Lecture Notes.
Sound. Sound Waves Sound is a disturbance that travels through a medium as a longitudinal wave.
Sound Waves You Have to Hear This!!!! Producing a Sound Wave Like all waves, sound waves are produced by a ________.  A tuning fork ________ to produce.
SOUND WAVES & BEAT FREQUENCY. SOUND WAVES Sound waves are caused by vibrations Vibrations cause contraction and expansion of an object, which creates.
Sound Bites. Basics Sound is a mechanical, longitudinal wave. The medium usually associated with sound is air, but sound can travel through both liquids.
Define sound waves A sound wave is a pressure variation ( changing pressure) that is transmitted through matter Sound Waves.
Sound 13-1 A “physical phenomenon that stimulates the sense of hearing.”
Sound and Hearing Properties of Sound Waves, Ultrasound, The Doppler Effect.
Sound and Digital Sound v © Allan C. Milne Abertay University.
Encoding and Simple Manipulation
10.2 Essential Questions How is sound intensity measured?
Games Development 1 Review / Revision CO2301 Games Development 1 Semester 2.
SOUND SECONDARY 3 PHYSICS. NATURE AND PRODUCTION OF SOUND Sound is….. A form of energy an example of longitudinal wave Produced by vibrating sources placed.
Chapter 12 Review. Explain how waves are produced Vibration of an object is what produces sound waves. The vibrating object moves in one direction and.
HEARING (and Balance) Hearing: Audition Balance: Vestibular System.
Chapter 15 Sound What is Sound? a pressure disturbance
Digital Audio I. Acknowledgement Some part of this lecture note has been taken from multimedia course made by Asst.Prof.Dr. William Bares and from Paul.
AN ACTIVE LEARNING ASSIGNMENT IN “AUDIO AND VIDEO SYSTEMS” GUIDED BY : PROF. VISMAY YAGNIK PROF. NIRAV PATEL PREPARED BY : MOHNISH LAVANIA ( )
Chapter 15 – Sound Properties and Detection of Sound.
Lecture #28: Waves and Sound AP Physics B. wave direction What is a wave? A wave is a traveling disturbance. A wave carries energy from place to place.
Waves Measurements. Guided Notes Please write out each Comprehension Check question along with any diagrams. Attempt to answer each question using the.
Wave Properties. Amplitude The distance a wave vibrates from its rest position. The distance a wave vibrates from its rest position. The greater the amplitude,
~ Sound ~ The Nature of Sound  Speed of Sound  Human hearing  Doppler effect  “Seeing” with sound.
10.2 Essential Questions How is sound intensity measured?
Sound waves Sound is a form of energy produced and transmitted by vibrating matter Medium - The stuff (matter) through which waves move.
The Behavior of Mechanical Waves
Sound.
Sound COS: #18 Use Models to determine how light and sound waves differ in how they are absorbed, reflected, and transmitted through different media.
The Physics of Sound.
Sound and Hearing it.
Representing Sound 2.6 – Data Representation.
Games Development Practices Sound Effects
Sound and HOW WE Hear it.
1. Which of the following is a false statement?
Games Development 1 Review / Revision
Sound.
Sound and Hearing it.
Presentation transcript:

Games Development Practices Sound Effects & OpenAL CO2301 Games Development 1 Week 15

Today’s Lecture 1.What is Sound 2.Digital Sound Representation 3.Stereo / 3D Sound 4.Special Effects 5.DirectSound

What is Sound? Sound is caused when a vibrating object creates waves of pressure. These waves travel through the air (or other medium) –Speed of sound in air ~340 m/s –Water 1480m/s, Steel 4000m/s The waves radiate outwards from their source in a spherical manner The pressure waves diminish with distance

How do we Perceive Sound? Our ears are very sensitive to such pressure waves The volume of a sound is determined by the amount of pressure variation –the amplitude of the waves The pitch of a sound (how high or low it is) is driven by how quickly the pressure varies –the frequency of the waves Quieter Louder Higher Pitched

Waveforms Draw waveforms to represent the pressure variation created at the source Simple waveforms (like the last few) make very simple sounds Real-world sounds have much more complex waveforms –And waveform is densely packed Computers cannot store these analogue waveforms, they use a digital representation instead… Acoustic Guitar Guitar Clip Electric Guitar

Sampling a Sound A computer stores a sound by sampling the waveform A sample is just the measurement of a waveform at a given time Samples taken at a fixed sample frequency (rate) –e.g. CDs sampled at 44100Hz : samples / second Each sample is a value representing the amplitude (pressure) of the waveform at that point Samples are usually integers –Hence they have a max/min value – not realistic

Digital Sound Quality Higher sample rates result in a better approximation to the original sound and hence a better quality sound –Nyquist criterion: sample rate must be greater than 2 x required max frequency in the sound –Typical sample frequencies: 11,000->48,000Hz The bit-depth of the samples is the number of bits used for each sample and determines the accuracy of each sample –E.g. An 8-bit, 16-bit or even floating point value for each sample A higher bit-depth will also improve digital sound quality –But improvement is less than the effect of increasing sample rate

Stereo Sound Each ear receives a different waveform from a single sound If the sound is off-centre then the sound waves will reach one ear sooner (and louder) Also, our head is an obstacle for the pressure waves and they distort when passing by –So the position of the head relative to the sound affects the received waveforms at each ear We can model this difference by recording stereo sound: 2 waveforms, one for each ear –Greatly improves sound quality But pre-recorded sound is statically positioned…

3D Sound Can dynamically model the different sounds received by our ears: –We first consider the 3D position of the sound source –Then calculate how the sound emitted will be perceived at each ear of the observer Need to take account of: –The 3D position of the sound relative to the observer –The head position (HRTF – head related transfer functions are used here) –Any obstacles in the way (e.g. walls) These calculations can be performed in hardware Can then model dynamic sound in our 3D scenes

The Doppler Effect We have considered the relative 3D position of a sound source But the relative velocity also has an effect on the perceived sound: –Sounds moving towards an observer are higher in pitch –Those moving away are lower in pitch The waves are compressed / stretched by the movement: This should also be modelled to create a compelling 3D sound Also typically supported in hardware Animation by Dr. Dan Russell, Kettering University

Other Special Effects There is other special processing we may perform on a waveform: –Echo, reverberation, distortion, etc. –Involve numeric processing of the samples Reverberation is most interesting for games –The reflection and damping of a sound against the walls and furniture of a environment We often apply an environmental reverberation to all sounds depending on the current scene Basic Sound Church Bathroom

OpenAL OpenAL is a simple, effective audio API –Free, open source project –Supported by Creative Labs –Cross-platform, supports Windows, Macs, Linux –Appropriate for games Particularly good for 3D sound Used in several titles –Fairly easy to use – similar principles to OpenGL –Consider for 3 rd year projects

OpenAL Basics OpenAL introduces three basic concepts: –Buffers: A buffer holds sound data in memory Creating a buffer doesn't play a sound Equivalent to meshes in the TL-Engine –Sources: An actual sound in the world. Must be associated with a buffer Equivalent to models in the TL-Engine –The Listener OpenAL always assumes there is a listener

OpenAL Basics Buffers, sources & listener have properties: –Buffers: Sample rate, bit depth, and other source data related properties –Sources: Pitch, gain (volume), looping, position, velocity, etc. –The Listener Position, orientation, velocity, master gain (volume) –Relative position of source / listener used to determine how to play sound out of speakers –Velocity is used to generate Doppler effect

Other APIs DirectSound is part of the DirectX SDK –Deprecated now, may see in older projects XAudio2 is DirectSound’s replacement –Cross-platform API for Windows and 360 –Fully featured and effective, many tools/APIs Proprietary, not open source –Rather more complex than OpenAL FMOD Ex is a free API, widely used for games –Supports all platforms (Windows, Linux, PS3, Xbox) –Low-level and a little more complex than OpenAL