660 likes | 781 Vues
Sega 500. Audio in UT2003. Jeff “Ezeikeil” Giles jgiles@artschool.com http://gamestudies.cdis.org/~jgiles. The plan . The goal for today is to cover the basics of what’s required to get sound files into UT2003 and see how they are used. But first,.
E N D
Sega 500 Audio in UT2003 Jeff “Ezeikeil” Giles jgiles@artschool.com http://gamestudies.cdis.org/~jgiles
The plan • The goal for today is to cover the basics of what’s required to get sound files into UT2003 and see how they are used.
But first, • As always, UT has some specific requirements for how it likes its sound files. • Hence, there are a few things that we have to be aware of to make sure that we’re doing them right.
Digital Audio theory • A crash course. Starting with:
A Little Sound theory. • So what is sound?...Well…if you can hear me you already have *some* idea. • But the real question is how does it “work” and what are the terms used to describe it.
Sound theory • An object produces sound when it vibrates in matter. This could be a solid, such as earth; a liquid, such as water; or a gas, such as air. • In this way, a vibrating object sends a wave of pressure fluctuation through the atmosphere.
Sound theory • We hear different sounds from different vibrating objects because of variations in the sound wave frequency. • A higher wave frequency simply means that the air pressure fluctuation switches back and forth more quickly.
Sound theory • The frequency of a sound is measured in Hertz or Hz. • The human ear is able to discern frequencies between 20Hz-20000Hz. http://www.hammersound.net/audiobasics/audiobasics.html#DA_Frequency
Sound theory • A higher wave frequency simply means that the air pressure fluctuation switches back and forth more quickly. • We hear this as a higher pitch. When there are fewer fluctuations in a period of time, the pitch is lower.
Sound theory • The level of air pressure in each fluctuation, the wave's amplitude, determines how loud the sound is. • Measured in decibel’s or db’s.
Sound theory • The decibel is the unit used to measure the intensity of a sound. • The decibel scale is a little odd because the human ear is incredibly sensitive.
Sound theory • The calculation of a decibel is a RELATIONSHIP between two values of POWER. • Want to know the math? Link here
Sound theory • On the decibel scale, the smallest audible sound (near total silence) is 0 dB. • A sound 10 times more powerful is 10 dB. • A sound 100 times more powerful than near total silence is 20 dB. • A sound 1,000 times more powerful than near total silence is 30 dB .
Sound theory • Climbing logarithmically. • This means that as decibel intensity increases by units of 10, each increase is 10 times the lower figure. Thus, 20 decibel is 10 times the intensity of 10 decibels, and 30 decibels is 100 times as intense as 10 decibels.
Sound theory • Here are some good examples • Near total silence - 0 dB • A whisper - 15 dB • Normal conversation - 60 dB • A lawnmower - 90 dB • A car horn - 110 dB • A rock concert or a jet engine - 120 dB • A gunshot or firecracker - 140 dB
Sound theory • Any sound above 85 dB can cause hearing loss, and the loss is related both to the power of the sound as well as the length of exposure. • You know that you are listening to an 85-dB sound if you have to raise your voice to be heard by somebody else.
Sound theory • any exposure to 140-dB sound causes immediate damage (and causes actual pain).
Digital Sound theory • So how does this relate to the computer? Well, it makes sound…
Digital Sound theory • True, it does. But there are some key distinctions to make between Analogue and Digital sound. • This difference is incurred due to how the computer stores it’s data.
Digital Sound theory • Analogue sound is best described as continuous sound.
Digital Sound theory • As were digital stores the sound data as a set of binary data…a 1 or 0…on or off.
Digital Sound theory • The "sound" one wants to digitize is an analog electrical continuous signal. Digital recording systems are discontinuous, made from a long succession of logical "0" and "1". • It is then necessary to "cut" the continuous analog signal into small parts in order to quantify its value at regular times.
Digital Sound theory • This conversion is done by a device called an analog-to-digital converter (ADC).
Digital Sound theory • Once processed by the ADC, this succession of values will then be recorded on the hard drive. • How its recorded is detemined by two factors:
Digital Sound theory • The sampling rate Controls how many samples are taken per second. • The sampling precision Controls how many different gradations (quantization levels or resolution) are possible when taking the sample.
Digital Sound theory • In a graph these are represented as: Precision (bits) Rate (frequency)
Digital Sound theory • The sample rate of a piece of digital audio is defined as 'the number of samples recorded per second'. • Sample rates are measured in Hz, or kHz (kiloHertz, a thousand samples per second). • The most common sample rates used in multimedia applications are:
Digital Sound theory • To put this another way…
Digital Sound theory • Right, so we’ve talked about sampling rates and bits have been mentioned… • what does this mean to us?
Digital Sound theory • Going back to this graph, the red line is the analogue signal an the green bars are a digital approximation. • Let's assume for this graph that the sampling rate is 1,000 per second and the precision is 10:
Digital Sound theory • When the digital-to-analog converter (DAC) recreates the wave from these numbers during play back, you get the blue line shown in the following figure.
Digital Sound theory • You can see that the blue line lost quite a bit of the detail originally found in the red line, and that means the fidelity of the reproduced wave is not very good. • This is the sampling error.
Digital Sound theory • You reduce sampling error by increasing both the sampling rate and the precision to better approximate the analogue signal.
Digital Sound theory • Here, both the rate and the precision have been improved by a factor of 2 (20 gradations at a rate of 2,000 samples per second)
Digital Sound theory • Right, I get how the frequency works into this, but what’s this about bits? • The number of bits provide how much resolution we have in our samples.
Digital Sound theory • What is the practical significance of the resolution? The higher the resolution with which you record a sound, the greater your ability to record the finest details.
Digital Sound theory • The max precision corresponds to the smallest sample. • This gives the dynamic one the ability to reproduce the difference between the smallest sample and the max digital value.
Digital Sound theory • So think about it this way. • The resolution (in bits) is how many steps there are between full on and off. • Also known as our dynamic range.
Digital Sound theory • So for an 8bit resolution, ( 2 to the power of 8 ) we have 256 levels of sound. • 65535 levels for 16 bits. • And so on….
Digital Sound theory • So how does this translate into our usage?
Digital Sound theory • The first thing we must note is the size of our sound file. • Take CD’s for example (also using digital format).
Digital Sound theory • In the case of CD sound, fidelity is an important goal, so the sampling rate is 44,100 samples per second and the number of gradations is 65,536. (16 bits) • At this level, the output of the DAC so closely matches the original waveform that the sound is deemed essentially "perfect“.
Digital Sound theory • There are two sound streams being recorded (one for each of the speakers on a stereo system). A CD can store up to 74 minutes of music, so the total amount of digital data that must be stored on a CD is: 44,100 samples/channel/second * 2 bytes/sample * 2 channels * 74 minutes * 60 seconds/minute = 783,216,000 bytes http://entertainment.howstuffworks.com/cd1.htm
Digital Sound theory • That’s 780MB!!! That’s huge. • The size of the recording depends on its nature (mono or stereo), its sampling frequency and its resolution. The information stream S is: S=(KxFsxR )/8000 ( given in KiloBits per second; K=1 for mono, 2 for stéréo)
Digital Sound theory • A very simple rule to follow is this: the higher the sampling frequency and the greater the resolution, the larger the recording will be. • Similarly, a stereo recording is twice the size of a mono one.
Digital Sound theory • Whiew! That’s lots of theory in a small space. • But how does this relate to UT2003?
Sound in UT2k3 • Well, as mentioned, UT rather specific requirements of how it likes it’s sounds to be imported. • Note, we’ll be dealing with music separately, for now just sound which will be used for in game effects.