Understand the basic principal of audio format

advertisement
Audio 2
Subject
Session
Tahun
Versi
:
:
:
:
T0934 / Multimedia Programming Foundation
9
2009
1/0
Learning Outcomes
In the end of this session, students must be
able to:
– Understand the basic principal of
audio format and compression
– Apply Java Sound API syntax to
manipulate basic audio properties
Bina Nusantara
Outline
• Audio Coding
• Audio Compression
• Java Sound API
Bina Nusantara
PCM
• PCM (Pulse Code Modulation) 
quantized sample output
– Differences versions is called DPCM
– Much-simplified version of DPCM is called DM (Delta Modulation
– Adaptive version is called ADPCM
• PCM encodings
– Linear quantization
– Non-linear quantization
Bina Nusantara
Linear quantization
• samples are typically stored as uniformly
quantized values
• Compact discs, for example, use linear
PCM-encoded sound.
Bina Nusantara
Non-linear quantization
• maps the original sound's amplitude to the
stored value using a nonlinear function
• Mu-law encoding and A-law encoding are
common nonlinear encodings, usually used for
telephony or recordings of speech.
Bina Nusantara
PCM Coding Process
Input analog
signal
Output analog
signal
•
•
Bina Nusantara
Bandlimiting
filter
Mu-law/A-law
compressor
Linear PCM
Low-pass filter
Mu-law/A-law
decompressor
Digital to
analog
converter
Bandlimiting filter
• blocks out very low and high frequencies
Low-pass filter
• allows only frequencies up to the original signal to be
retained
WAVE format
• The WAVE file format uses Microsoft's RIFF (Resource
Interchange File Format) standard for the storage of
multimedia files.
• A RIFF file starts out with a file header followed by a
sequence of data chunks.
RIFF header
chunk
identifies the file
as a WAV file
fmt chunk
describes the sound
data's format such as :
• type of compression
• number of channels
• sample rate
• bits per sample
• other attributes
Bina Nusantara
data chunk
contains the size
of the data and
the actual sound
MPEG-1 audio
• Has three layers of audio compression
• The higher layers, the better compression
Layer 1
• Digital Audio Tape
Layer 2
• Proposed for use in digital audio broadcasting
Layer 3 (MP3)
• Originally aimed at audio transmission over ISDN lines
• Common digital audio format compression
Bina Nusantara
MPEG-1 audio Format
Header
•
•
•
•
Synchronization code
Sampling rate
Bitrate
Stereo information
Bina Nusantara
SBS Format
SBS
Ancillary data
(subband-samples)
(extra information)
•
•
Multilingual data
Surround-sound
data
MPEG-2/4/7
• MPEG-2
– Standard for DVD
– MPEG-2 Advanced Audio Coding (AAC) can have five channels
(5.1 channel systems)
• MPEG-4
– Integrates several different audio components into one standard
– Audio components include speech compression, text-to-speech,
and MIDI
• MPEG-7
– Promotes ease of search for audio objects
– Supports ASR (Automatic Speech Recognition) application
Bina Nusantara
Java Sound API
•
•
•
•
Play and stop sampled audio
Volume up and down
Right and left channel balance
Play and stop MIDI
Bina Nusantara
Sound Property
Midi File
- Get duration
Sampled Sound File
- Get duration
- Get Audio Format
- Get Sample Rate
- Get Channels
Bina Nusantara
Sample Code
To Play Midi
To Play Sampled Sound
To Control Volume and Balance Sampled Sound
Bina Nusantara
Sample Code
Create JSlider to control Balance and Volume Sampled Sound
Bina Nusantara
Sample Code
Result
Bina Nusantara
References
• WAVE PCM soundfile format. 2003.
http://ccrma.stanford.edu/courses/422/projects/WaveFor
mat/
• WAV File Format. 2009.
http://technology.niagarac.on.ca/courses/ctec1631/WavF
ileFormat.html
• The Java Sound API. 2009.
http://onjava.com/onjava/excerpt/jenut3_ch17/
• MP3. 2009. http://en.wikipedia.org/wiki/MP3
• WAV. 2009. http://en.wikipedia.org/wiki/WAV
Bina Nusantara
Download