Basics of Digital Audio Outline Introduction Digitization of Sound MIDI: Musical Instrument...

26
Basics of Digital Audio

Transcript of Basics of Digital Audio Outline Introduction Digitization of Sound MIDI: Musical Instrument...

Page 1: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Basics of Digital Audio

Page 2: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Outline Introduction Digitization of Sound MIDI: Musical Instrument Digital Interface

Page 3: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Introduction What is Sound? Sound is a wave phenomenon like light, but is

macroscopic and involves molecules of air being compressed and expanded under the action of some physical device.

Is a form of energy produced & transmitted by vibrating matter

Travels in waves Travels more quickly through solids than liquids or

gases

Page 4: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Introduction For example, a speaker in an audio system vibrates back

and forth and produces a longitudinal pressure wave that we perceive as sound.

Since sound is a pressure wave, it takes on continuous values, as opposed to digitized ones

Even though such pressure waves are longitudinal, they still have ordinary wave properties and behaviors, such as reflection (bouncing),refraction (change of angle when entering a medium with a different density) and diffraction (bending around an obstacle).

If we wish to use a digital version of sound waves we must form digitized representations of audio information.

Page 5: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Vibration Back and forth movement of molecules of

matter

Page 6: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Compression

- Where molecules are being pressed together as the sound waves move through matter

- For example,- a wave travels through the springs just like sound

waves travel through the air- the places where the springs are close together

are like compressions in the air.

Page 7: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Sound Waves- Alternating areas of high & low pressure in the

air- ALL sound is carried through matter as sound

waves- Sound waves move out in ALL directions from

a vibrating object

Page 8: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Wavelength & Frequency- Wavelength is the distance between one part

of a wave and the same part of the next wave

- Frequency is the number of waves moving past a point in one second

Page 9: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Pitch

A measure of how high or low a sound is. Pitch depends on the frequency of a sound

wave For example,

- Low pitch

- Low frequency

- Longer wavelength

- High pitch

- High frequency

- Shorter wavelength

Page 10: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Volume

Amount of sound energy reaching your ears

Depends on: How far the

vibrating object is moving as it goes back and forth

How far you are from the source of a sound Volume Control

Page 11: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Sound and Instruments

- Instruments can be played at different pitches by changing lengths of different parts.

- For example,

- Another way to make different pitches is to change the thickness of the material that vibrates.

Page 12: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Digitization Digitization means conversion to a stream of

numbers, and preferably these numbers should be integers for efficiency.

Fig. 6.1 shows the 1-dimensional nature of sound: amplitude values depend on a 1D variable, time. (And note that images depend instead on a 2D set of variables, x and y).

Values change over time in amplitude: the pressure increases or decreases with time.

Page 13: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Digitization

Page 14: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Digitization The graph in Fig. 6.1 has to be made digital in

both time and amplitude. To digitize, the signal must be sampled in each dimension: in time, and in amplitude.

To represent waveforms on digital computers, we need to digitize or sample the waveform

• side effects of digitization:

• introduces some noise

Page 15: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Digitization

Page 16: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Sampling Rate

The sampling rate (SR) is the rate at which amplitude values are digitized from the original waveform.(sample per cycle) CD sampling rate (high-quality):

SR = 44,100 samples/second medium-quality sampling rate:

SR = 22,050 samples/second phone sampling rate (low-quality):

SR = 8,192 samples/second

For audio, typical sampling rates are from 8 kHz (8,000 samples per second) to 48 kHz. This range is determined by the Nyquist theorem, discussed later.

Page 17: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Sampling Rate The human ear can hear from about 20 Hz (a

very deep rumble) to as much as 20 KHz; above this level, we enter the range of ultrasound.

The human voice can reach approximately 4 KHz and we need to bound our sampling rate from at least double this frequency. Thus we arrive at the useful range about 8 to 40 or so KHz.

Page 18: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Sampling Rate

Higher sampling rates allow the waveform to be more accurately represented

Page 19: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Nyquist Theorem and Aliasing

Nyquist Theorem:We can digitally represent only frequencies up to half the sampling rate.

Example:CD: SR=44,100 HzNyquist Frequency = SR/2 = 22,050 Hz

Example:SR=22,050 HzNyquist Frequency = SR/2 = 11,025 Hz

Page 20: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Nyquist Theorem and Aliasing

Frequencies above Nyquist frequency "fold over" to sound like lower frequencies. This foldover is called aliasing.

Aliased frequency f in range [SR/2, SR] becomes f':

f' = |f - SR|

Page 21: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Nyquist Theorem and Aliasing

f' = |f - SR|

Example: SR = 20,000 Hz Nyquist Frequency = 10,000 Hz f = 12,000 Hz --> f' = 8,000 Hz f = 18,000 Hz --> f' = 2,000 Hz f = 20,000 Hz --> f' = 0 Hz

Page 22: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Nyquist Theorem and Aliasing

Graphical Example 1a: SR = 20,000 Hz Nyquist Frequency = 10,000 Hz f = 2,500 Hz (no aliasing)

Page 23: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Nyquist Theorem and Aliasing Graphical Example 1b:

SR = 20,000 Hz Nyquist Frequency = 10,000 Hz f = 5,000 Hz (no aliasing)

Page 24: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Nyquist Theorem and Aliasing Graphical Example 2:

SR = 20,000 Hz Nyquist Frequency = 10,000 Hz f = 10,000 Hz (no aliasing)

Page 25: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Nyquist Theorem and Aliasing Graphical Example 2:

BUT, if sample points fall on zero-crossings the sound is completely cancelled out

Page 26: Basics of Digital Audio Outline  Introduction  Digitization of Sound  MIDI: Musical Instrument Digital Interface.

Nyquist Theorem and Aliasing Graphical Example 3:

SR = 20,000 Hz Nyquist Frequency = 10,000 Hz f = 12,500 Hz, f' = 7,500