audio 1 subject:t0934 / multimedia programming foundation session:8 tahun:2009 versi:1/0
TRANSCRIPT
Bina Nusantara
Learning Outcomes
In the end of this session, students must be able to: – Understand the basic principal
of audio digitization and enhancement
– Identify Java Sound API syntax to manipulate basic audio properties
Outline
• Audio Digitization• MIDI• Audio Quantization and Transmission• Java Sound API
Bina Nusantara
A Typical Audio Architecture
Bina Nusantara http://java.sun.com/docs/books/tutorial/sound/index.html
Sound
• Sound are rapid vibrations that are transmitted as variations in air pressure
• To use sound digitally, we must digitize (converse to a stream of numbers) the analog sound first
Bina Nusantara Time
Amplitude
Analog signal of sound
Analog signal of sound
Sound Digitization
• To fully digitize the sound, we have to sample in Time (Sampling) and in Amplitude (Quantization)
Bina Nusantara
Sampling
Quantization
Sampling
• Sampling– Measuring at evenly spaced intervals
• Sampling Rate– Known as sampling frequency, measured in Hertz (Hz)
• Nyquist Rate– To have a correct sampling, sampling rate should equal
to at least twice the maximum frequency– If sampling rate is lower than Nyquist rate, it will result
in false (alias) frequency
Bina Nusantara
Quantization
• Sampling in the amplitude dimension, represented in fixed numbers of bits (8, 12, or 16 bits)
Bina Nusantara
• Results in a loss of precision which is called distortion (or called quantization noise)
• Dithering (adding random noise to quantized audio) can be used to remove some of the distortion
Common Rates
Quality Sample Rate (kHz)
Quantization
Mono/Stereo
Frequency Range
Telephone 8 8 Mono 200-3400
AM Radio 11,025 8 Mono 100-5500
FM Radio 22,05 16 Stereo 20-11000
CD 44,1 16 Stereo 5-20000
DAT 48 16 Stereo 5-20000
DVD audio 192 (max) 24 (max) Up to 6 channels
96000 (max)
Bina Nusantara
Sampled Audio Format
Bina Nusantara
File Type
Acronym For
Originally Created By
Type of Compression
Platforms
.aiff Audio Interchange File Format
Apple, adopted later by Silicon Graphics
usually not compressed, but has a compressed version
Apple Macintosh and Silicon Graphics computers, and now also on Windows
.wav IBM and Microsoft
supports a number of different compression formats
primarily for Windows, but can be run on in other systems
.au and .snd
Also called mu-law or Sun mu-law format
Sun and NeXT mu-law encoding compresses the file at a ratio of 2:1; slow decompression
Sun, NeXT, Unix or Linux operating system
.mp3 MPEG audio layer 3
Moving Pictures Experts Group
good compression rate with high quality sound
cross-platform
Synthesizing Sounds
• Frequency Modulation (FM)– Producing new audio signal using a source waveform’s
frequency is changed by a modulating frequency– Based on the same principles used for FM radio
trasmission– Used in low-end versions of Creative Sound Blaster PC
sound card
• Wave-Table– More accurate way reproducing sound– Using actual samples of real instruments– More expensive than FM synthesis (partly because of
larger data storage)
Bina Nusantara
MIDI
• Musical Instrument Digital Interface• A scripting language that codes
events (MIDI messages + timings)• Enable computers, synthesizers,
keyboards, and other musical devices to communicate with each others.
Bina Nusantara
A Possible MIDI Configuration
Bina Nusantara http://java.sun.com/docs/books/tutorial/sound/index.html
Synthesizers
• A sound generator that can vary pitch, loudness, and tone color.
• Now included on PC sound cards. The units that generate sound are called tone/sound modules.
Bina Nusantara
Sequencers
• In the beginning, a special hardware device for storing and editing a sequence of musical events (MIDI data)
• Now, a software music editor on the computer
Bina Nusantara
Channel Messages
• Voice Messages – Sends information of which note to play– Used to control sustain, vibrato, tremolo, and pitch
• Mode Messages– Determines how an instrument processes MIDI voice
messages (to respond all messages, respond just to correct channel, don’t respond at all, etc)
Bina Nusantara
System Messages
• For commands that are not channel-specific
• Common messages– Relates to timing or positioning
• Real-time messages– Relates to synchronization
• Exclusive messages– Included so manufacturers can extend the MIDI standard
Bina Nusantara
MIDI standard
• General MIDI (GM1)– Standard for assigning instruments to patch numbers so MIDI
music can sound more or less the same on every machine– Ex : patch no.1 = piano
• General MIDI level 2 (GM2)– Extended General Midi, with SMF (Standard MIDI File) format
defined.– Includes extra character of information such as karaoke lyrics– Increases the number of available sounds – Increases the amount of control available for sound editing
and musical performance
• General MIDI Lite (GML)– For mobile applications
Bina Nusantara
Standard MIDI Files
• a digital file that contains MIDI events
• was developed in 1990 for file exchange between MIDI sequencers
• The information in a standard MIDI file is referred to as a sequence
• contains one or more tracks which each typically contains the notes of a single instrument
Bina Nusantara
Java Sound API
• Supports both sampled audio and MIDI data
• javax.sound.sampled– This package specifies interfaces for capture, mixing,
and playback of digital (sampled) audio.
• javax.sound.midi– This package provides interfaces for MIDI synthesis,
sequencing, and event transport.
Bina Nusantara
Playing MP3
Bina Nusantara
Getting controller component
Result
Note : This program use JMF to play MP3 file.
Full code is downloadable in Additional Materi
References
• Basics of Digital Audio. 2001. http://www.cs.cf.ac.uk/Dave/Multimedia/node143.html
• Developing a Strategy for Creating and Assessing Digital Media Curriculum Material. 2004. http://imej.wfu.edu/articles/2004/1/01/
• Midi. 2008. http://www.midi.org/• Trail: Sound. 2008.
http://java.sun.com/docs/books/tutorial/sound/index.html
• The Java Sound API. 2009. http://onjava.com/onjava/excerpt/jenut3_ch17/
• Sound. 2009. http://en.wikipedia.org/wiki/SoundBina Nusantara