Audio Representation
CSCI N351
Andy Harris
Indiana University / Purdue University - Indianapolis
Analog audio
Sound is waves
differences in air pressure
Ear is sensitive to minute pressure changes
Replicate the pressure wave, replicate the sound
Rubens' tube video
Edison's phonograph
How the Edison phonograph works
Wave pattern produces sound
Needle on membrane inscribes groove on cylinder
Print copies of cylinder
Needle on hardened cylinder moves membrane
Membrane causes wave pattern reproducing original sound
Creating a digital sound
Move a speaker's membrane
Use an oscillator
Need a pattern for motion
Square pattern simplest
Push out for a while
Pull in for a while
The
synth
applet
Making a better sound
Use another pattern
Sawtooth - start silent - gradually louder
Triangle - gradually louder then softer
Sin wave - 'smooth' curve
Problems with digital oscillator
All patterns are blocky
Limited in X
Limited in Y
Even sine is ultimately blocky
'pure' audio (analog) is smooth
sampling rate
What time does one sample represent?
Measured in Hz (cycles / second)
Or kHz (1000 cycles / second)
Faster sampling rate = better sound
... but larger file
represented by distance on time axis
Common sampling rates (approx. quality)
8 kHz
bad cell phone
16 kHz
phone
22kHz
audio tape
44kHz
CD
Nyquist's Law
optimal sampling rate is double desired output frequency
backwards wagon wheels
20 kHz is a high frequency in human range
Sampling rate is (roughly) 44 kHz
bit depth
How many possible values for each sample?
square wave only requires 1 bit / sample
8 bits = 256 possible values / sample
16 bit = 65,537 possible values / sample
higher bit depth = better sound
... but larger file
Standard bit depths
8 bit
16 bit
32 bit
Quantizing an audio sample
Use bit depth and sample rate to break signal into digits
number of values depends on sample rate
range of each value depends on bit depth
Envelope
Modifies amplitude over lifespan of tone
Greatly changes character of tone
Often measured in ADSR
ADSR Envelope attributes
A - Attack
D - Delay
S - Sustain
R - Release
Improving the timbre
Most sounds are more complex than a simple frequency
You can add multiple oscillators to produce complex sounds
The need for Audio Formats
Raw audio data is expensive
Compression
Reconstruction
The MIDI format
Musical Instrument Digital Interface
NOT technically a file type!
A form of notation
MIDI file is stored by an instrument
Can be replayed by another MIDI Instrument
MIDI's bad rap
MIDI is looked down on in computer audio
Quality is dependant on hardware, skill of sequencer
Most typical computers have poor MIDI capabilities
MIDI can be most efficient format
MIDI can sound very good on higher-end equipment
MIDI accurately handles musical information
MIDI can be modified musically
Examining a MIDI file
Using Anvil Studio
Examining Event list
Events as a programming language
Modifying a MIDI file
Examining a file in the mixer view
Changing an instrument
The midi Instrument bank
Original "Blue Suede Shoes"
Brass version
Using MIDI to study Music
Examining Dvorak's 9th, 4th Movement
Looking at the bassoon part
Finding bassoon solo
Playing notes back
Composing MIDI Music
Using a keyboard or other instrument
Using computer keyboard
Drag and drop
Generating a song
The 'mayan song'
Creating the flute part
Creating the instruments
Sampling audio
using audacity to edit a sound
Choosing a sampling rate
Choosing a bit depth
Recording a sound
Modifying a sound
Using layers of sound
Applying filters echo, noise removal
Trimming a sound
Doing more with a segment
Duplicating a segment
Avoiding clipping
Exporting as an MP3 File
Audio Compression
using db powerAmp
Introducing Ogg Vorbis
Open source alternative to mp3
better compression than mp3
No DRM, legal encumbrances
Currently supported in HTML 5 audio tag
Audio Demo
Streaming Audio
File is compressed
a portion (maybe 10 seconds) is sent to a buffer
user plays file from buffer
New material flows in from server as user plays
As long as input is >= output, all is well
Streaming media is about throughput