audio 2 subject:t0934 / multimedia programming foundation session:9 tahun:2009 versi:1/0

17
Audio 2 Subject : T0934 / Multimedia Programming Foundation Session : 9 Tahun : 2009 Versi : 1/0

Upload: blaze-corson

Post on 15-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

Audio 2

Subject : T0934 / Multimedia Programming FoundationSession : 9Tahun : 2009Versi : 1/0

Page 2: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

Bina Nusantara

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

Page 3: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

Outline

• Audio Coding• Audio Compression• Java Sound API

Bina Nusantara

Page 4: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

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

Page 5: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

Linear quantization

• samples are typically stored as uniformly quantized values

• Compact discs, for example, use linear PCM-encoded sound.

Bina Nusantara

Page 6: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

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

Page 7: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

PCM Coding Process

Bina Nusantara

Input analog signal

Output analog signal

• Bandlimiting filter• blocks out very low and high frequencies

• Low-pass filter• allows only frequencies up to the original signal to

be retained

• Bandlimiting filter• blocks out very low and high frequencies

• Low-pass filter• allows only frequencies up to the original signal to

be retained

Page 8: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

WAVE format

Bina Nusantara

• 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

RIFF header chunk fmt chunkfmt chunk data chunkdata chunk

identifies the file as a WAV file

describes the sound data's format such as :

• type of compression• number of channels• sample rate• bits per sample• other attributes

contains the size of the data and

the actual sound

Page 9: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

MPEG-1 audio

• Has three layers of audio compression

• The higher layers, the better compression

Bina Nusantara

Page 10: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

MPEG-1 audio Format

Bina Nusantara

• Synchronization code

• Sampling rate• Bitrate• Stereo information

HeaderHeader SBS FormatSBS Format SBS(subband-samples)

SBS(subband-samples)

Ancillary data(extra information)Ancillary data

(extra information)

• Multilingual data• Surround-sound

data

Page 11: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

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

Page 12: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

Java Sound API

• Play and stop sampled audio• Volume up and down• Right and left channel balance• Play and stop MIDI

Bina Nusantara

Page 13: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

Sound Property

Bina Nusantara

- Get durationMidi File

Sampled Sound File

- Get Audio Format

- Get duration

- Get Sample Rate

- Get Channels

Page 14: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

Sample Code

Bina Nusantara

To Play Sampled Sound

To Control Volume and Balance Sampled Sound

To Play Midi

Page 15: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

Sample Code

Bina Nusantara

Create JSlider to control Balance and Volume Sampled Sound

Page 16: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

Sample Code

Bina Nusantara

Result

Page 17: Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0

References

• WAVE PCM soundfile format. 2003. http://ccrma.stanford.edu/courses/422/projects/WaveFormat/

• WAV File Format. 2009. http://technology.niagarac.on.ca/courses/ctec1631/WavFileFormat.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