Bài giảng Đa phương tiện và các ứng dụng giải trí - Chương VI: Audio

pdf 62 trang ngocly 1240
Bạn đang xem 20 trang mẫu của tài liệu "Bài giảng Đa phương tiện và các ứng dụng giải trí - Chương VI: Audio", để tải tài liệu gốc về máy bạn click vào nút DOWNLOAD ở trên

Tài liệu đính kèm:

  • pdfbai_giang_da_phuong_tien_va_cac_ung_dung_giai_tri_chuong_vi.pdf

Nội dung text: Bài giảng Đa phương tiện và các ứng dụng giải trí - Chương VI: Audio

  1. IT4440 Đa phương tiện và các ứng dụng giải trí (MULTIMEDIA AND GAMES)
  2. Nội dung môn học Tuần Chủ đề Số tiết 1 Giới thiệu về môn học 1 – 5 Phần I. Tổng quan về thông tin đa phương tiện và các kỹ thuật xử lý 15 1 Chương I: Nhập môn Multimedia 1 1 Chương II: Một số kiến thức cơ bản 1 2 Chương III: Ảnh 4 3 Chương IV: Màu 3 4 Chương V: Video 3 5 Chương VI: Audio 3 6 – Phần II. Một số ứng dụng đa phương tiện Chương V: Multimedia- ứng dụng và giải trí Chương VI: Ứng dụng web Chương VII: Ứng dụng mobile Chương VIII: Ứng dụng 3D Chương IX: Ứng dụng Game Bảo vệ Bài tập lớn, Tổng kết ôn tập
  3. Nội dung môn học Tuần Chủ đề Số tiết 1 Giới thiệu về môn học 1 – 5 Phần I. Tổng quan về thông tin đa phương tiện và các kỹ thuật xử lý 15 1 Chương I: Nhập môn Multimedia 1 1 Chương II: Một số kiến thức cơ bản 1 2 Chương III: Ảnh 4 3 Chương IV: Màu 3 4 Chương V: Video 3 5 Chương VI: Audio 3 6 – Phần II. Một số ứng dụng đa phương tiện Chương V: Multimedia- ứng dụng và giải trí Chương VI: Ứng dụng web Chương VII: Ứng dụng mobile Chương VIII: Ứng dụng 3D Chương IX: Ứng dụng Game Bảo vệ Bài tập lớn, Tổng kết ôn tập
  4. Chương VI: Audio Mục tiêu của chương Một số khái niệm Âm thanh số Nén âm MIDI vs. Audio Tổng kết chương Tài liệu tham khảo
  5. V.1 Mục tiêu của chương Người học sẽ: Được trang bị kiến thức âm thanh, biểu diễn, lưu trữ và tạo âm thanh Được giới thiệu nguyên lý và phương pháp nén, xử lý và truyền âm thanh Sau khi kết thúc chương, người học : Nắm được kiến thức cơ bản về âm thanh Biết vận dụng một số kỹ thuật, công cụ xử lý âm thanh để tạo và lưu trữ âm thanh trong ứng dụng cụ thể
  6. Âm thanh là gì ? If a tree falls in the forest and nobody is there to hear it, will it make a sound? Sound provided by
  7. Âm thanh là gì ? Âm thanh có thể là Tiếng nói Âm nhạc Tiếng ồn Âm thanh là một mối quan hệ phức tạp của các đối tượng sau: Nguồn âm Môi trường truyền (thường là không khí) Bộ thu nhận âm (tai) Bộ cảm nhận âm (não bộ)
  8. Hệ thống truyền nhận âm tự nhiên
  9. Hệ thống truyền nhận âm điện tử Môi trường Sound Sources Máy biến năng truyền âm – Vibrations at 20Hz-20kHz Khuếch đại Phát lại Điều hòa tín hiệu Trích chọn thông tin, đo Xử lý, lường phân tích, Lưu trữ tổng hợp
  10. Sóng âm Something vibrates Waves of pressure Ear drums will translate in the air these changes in wave Forms as sound Âm thanh được đo bằng decibel dB (decibel) Âm thanh lan truyền trong môi trường: sóng âm.
  11. Một số ví dụ về sóng âm Piano Pan flute Snare drum
  12. Audio vs Images Sự khác biệt lớn nhất của âm thanh và hình ảnh là gì ? TIME
  13. Âm thanh và nhiễu âm A pleasant sound has a regular wave pattern. The pattern is repeated over and over.  But the waves of noise are irregular. They do not have a repeated pattern.
  14. Đặc trưng của sóng âm Âm thanh được mô tả bởi hai đặc trưng sau: Tần số Frequency (or pitch) Biên độ Amplitude (or loudness) Time for one cycle Amplitude wavelength distance along wave Cycle
  15. Tần số Frequency is a measure of how many vibrations occur in one second. This is measured in Hertz (abbreviation Hz) and directly corresponds to the pitch of a sound. The more frequent vibration occurs the higher the pitch of the sound. Low pitch High pitch  Optimally, people can hear from 20 Hz to 20,000 Hz (20 kHz)  Sounds below 20 Hz are infrasonic  sounds above 20 kHz are ultrasonic.
  16. Biên độ âm thanh Amplitude is the maximum displacement of a wave from an equilibrium position. The louder a sound, the more energy it has. This means loud sounds have a large amplitude. Quiet Loud Low amplitude High Amplitude  The amplitude relates to how loud a sound is.
  17. Âm thanh tương tự và âm thanh số Âm thanh tương tự Tín hiệu điện mang tông tin về âm thanh như một giá trị điện thế liên tục Số hóa âm thanh Để sử dụng trong các ứng dụng đa phương tiện, giống như ảnh, video, âm thanh phải được số hóa Việc số hóa được thực hiện thông qua hai bước: lấy mẫu và lượng tử hóa
  18. Âm thanh tương tự và âm thanh số
  19. Biểu diễn số của tín hiệu âm thanh 0101010000101010101010011010001010100110100101001 0100011100010101010100101111001001010
  20. Âm thanh số Dữ liệu âm thanh số là biểu diễn của âm thanh, được lưu trữ dưới dạng các điểm mẫu High Sampling Rate Samples stored in digital form waveform Low Sampling Rate
  21. Âm thanh số Chất lượng âm thanh số phụ thuộc vào 1. Tốc độ lấy mẫu (sampling rate) 2. Kích thước mẫu (quantization step) Sampling Rate Sample size
  22. Âm thanh số Ngoài ra, chất lượng âm thanh số phụ thuợc vào Chất lượng của nguồn âm Chất lượng của thiết bị thu và các phần cứng hỗ trợ. Các đặc trưng sử dụng để thu âm. Khả năng phát lại của môi trường phát âm.
  23. Biểu diễn số tín hiệu âm thanh Tín hiệu âm thanh được Lấy mẫu Lượng tử hóa Nén
  24. Lấy mẫu (Sampling) Measure amplitude at regular intervals How many times should we sample?
  25. Example Suppose we have a sound wave with a frequency of 1 cycle per second 1.5 1 0.5 0 -0.5 -1 -1.5
  26. Example If we sample at one cycle per second, where would the sample points fall? 1.5 1 0.5 0 -0.5 -1 -1.5
  27. Example If we sample at 1.5 cycles per second, where will the sample points fall? 1.5 1 0.5 0 -0.5 -1 -1.5
  28. Example If we sample at two cycles per second, where do the sample points fall? 1.5 1 0.5 0 -0.5 -1 -1.5
  29. Nyquist Theorem For lossless digitization, the sampling rate should be at least twice the maximum frequency response. In mathematical terms: fs > 2*fm where fs is sampling frequency and fm is the maximum frequency in the signal
  30. Nyquist Limit max data rate = 2 H log2V bits/second, where H = bandwidth (in Hz) V = discrete levels (bits per signal change) Shows the maximum number of bits that can be sent per second on a noiseless channel with a bandwidth of H, if V bits are sent per signal Example: what is the maximum data rate for a 3kHz channel that transmits data using 2 levels (binary) ? Solution (2x3,000xln2=6,000bits/second)
  31. Limited Sampling But what if one cannot sample fast enough?
  32. Các khoảng lấy mẫu Auditory range 20Hz to 22.05 kHz must sample up to to 44.1kHz common examples are 8.000 kHz, 11.025 kHz, 16.000 kHz, 22.05 kHz, and 44.1 KHz Speech frequency [200 Hz, 8 kHz] sample up to 16 kHz but typically 4 kHz to 11 kHz is used
  33. Tốc độ lấy mẫu The sampling rate, sample rate, or sampling frequency defines the number of samples per second (or per other unit) taken from a continuous signal to make a discrete signal. For time-domain signals, the unit for sampling rate is 1/s
  34. Lượng tử hóa 1.5 1 0.5 0 -0.5 -1 -1.5
  35. Lượng tử hóa Typically use 8 bits = 256 levels 16 bits = 65,536 levels How should the levels be distributed? Linearly? (PCM) Perceptually? (u-Law) Differential? (DPCM) Adaptively? (ADPCM)
  36. Tỷ số tín hiệu trên nhiễu (SNR)
  37. Tỷ số tín hiệu trên nhiễu (SNR) Measures strength of signal to noise Signalenergy SNR (in DB)= 10 log10( ) Noiseenergy Given sound form with amplitude in [-A, A] 2 A 1 A 0.75 Signal energy = 0.5 2 0.25 0 0 -0.25 -0.5 -0.75 -A -1
  38. Nén âm thanh Tại sao phải nén âm thanh ?
  39. Nén âm thanh Nguyên lý của nén âm ?
  40. Nén âm thanh Sound is difficult to compress using lossless methods, except for special cases. Some compression of audio can be obtained by run-length encoding samples that fall below a threshold that can be considered to represent silence. Companding uses non-linear quantization to compress speech. µ-law and A-law companding are used for telephony.
  41. Thu và phát âm thanh số Air pressure variations Digital to Analogue Convert Converter s back into DAC Captured via voltage microphone Signal is converted into binary Analogue (discrete form) to Digital ADC 0101001101 Air pressure Converter 0110101111 variations
  42. Ghi file âm thanh Recording Audio Files on the pc Uses either: i. Microphone . connect microphone to the microphone port and record using sound recorder
  43. Ghi file âm thanh ii. CD-ROM Drive Move music files from CD to hard drive or; Play the cd and then record using the sound recorder. iii. Line-in pressing play on the audio source, which is connected to the computer’s audio line-in socket. Record using the sound recorder. Line in port on the pc Audio cable
  44. Midi Audio Musical Instrument Digital Interface Before there was a wide use of mp3 and high bandwidth network, MIDI format audio is popular when an audio is required to be put on a website. Provides a standardized and efficient means of conveying musical performance information as electronic data. Is a easiest and quickest way to compose our own score. . (provided we have knowledge of musical instrument and composing) It is in the form of music score and not samples or recording.
  45. Midi Audio: Requirements To make MIDI score, we need: 1. Midi keyboard / Midi keyboard software 2. Sequencer software 3. Sound synthesizer (built-in in to sound card)
  46. Midi Keyboard MIDI keyboard is used to simplify the creation of music scores (MIDI information) MIDI information is transmitted in "MIDI messages", which can be thought of as instructions which tell a music synthesizer how to play a piece of music. The synthesizer receiving the MIDI data must generate the actual sounds.
  47. Midi Sequencer A MIDI sequencer software lets us to record and edit MIDI data like a word processor Cut and paste Insert / delete
  48. Midi Audio Facts Since they are small, MIDI files embedded in web pages load and play. Length of a MIDI file can be changed without affecting the pitch of the music or degrading audio quality. Working with MIDI requires knowledge of music theory.
  49. Recording MIDI Files Recording MIDI Files MIDI files can be generated: by recording the MIDI data from a MIDI instrument (electronic keyboard) as it is played. by using a MIDI sequencer software application.
  50. Audio File Formats MIDI *.MID, *.KAR, *.MIDI, *.SMF AUDIO DIGITAL WINDOWS *.WAV MACINTOSH *.AIFF UNIX *.AU REALAUDIO *.RA MPEG3 *.MP3
  51. MIDI versus Digital Audio Advantages of MIDI over digital audio: MIDI files smaller that digital audio files. Because small file, MIDI files embedded in web pages load and play more quickly. If MIDI sound source are high quality – sound better. Can change the length of MIDI files without changing the pitch of the music or degrading the audio quality.
  52. MIDI versus Digital Audio Disadvantages of MIDI over digital audio: Because MIDI data does not represent the sound but musical instruments, playback will be accurate only if the MIDI playback (instrument) is identical to the device used in the production. Higher cost and requires skill to edit. Cannot emulate voice, other effects.
  53. Adding Sound to MM Project  File formats compatible with multimedia authoring software being used along with delivery mediums, must be determined.  Sound playback capabilities offered by end user’s system must be studied.  The type of sound, whether background music, special sound effects, or spoken dialog, must be decided.  Digital audio or MIDI data should be selected on the basis of the location and time of use.
  54. Audio file sizes How much space is needed for 1 minute on a CD? .Two channels (stereo) . 16 bits per channel (bit depth) (65,536 quanta) . Sampling rate of 44,100 Hz 60 s x 44,100 samples/s x 16 bits/sample x 2 = 84,672,000 bits = 10,584,000 bytes ≈ 10 MB So an 800MB CD can hold about 80 minutes of music .
  55. Audio file sizes To reduce file size: . Reduce sampling rate . Reduce bit depth . 8 bits will work for speech, but not music . Reduce channels (ie just mono) . Halves file size – could work for games . (Reduce duration? Unlikely ) . Use compression techniques . Be aware of lossy vs lossless compression
  56. MP3 MPEG-1 Audio Layer 3 . Lossy compression (ie loses some information) (so don’t use this for `master’ copies when editing) . Reduces size by factor of 11 compared to CD . Reduces accuracy of sounds which are unlikely to be heard . Based on `psychoacoustic models’ . Emerged in early 1990’s (Moving Picture Experts Group)
  57. MIDI Musical Instrument Digital Interface . Purely digital music created by a processor . Often used as a keyboard attached to a computer . Note information from a digital source . Small size (60s in 2KB) . Easily edited . Sound depends on local device
  58. Ưu nhược điểm của việc sử dụng âm thanh Sound adds life to any multimedia application and plays important role in effective marketing presentations. Advantages Ensure important information is noticed. Add interest. Can communicate more directly than other media. Disadvantages Easily overused. Requires special equipment for quality production. Not as memorable as visual media.
  59. Summary There are two main types of digital audio Sampled audio . Captured by sampling an analogue waveform at a set rate MIDI data . Instructions on how to perform some musical composition Sampled audio requires more storage space than MIDI information
  60. Chu trình thu phát âm thanh
  61. IV.6 Tài liệu tham khảo của chương Bài giảng, CSDL Đa phương tiện, H. Tran, ĐHBK, 2010 Bài giảng, Introduction to Multimedia, Chapter 7, Fatimah Khalid, Jabatan Multimedia, FSKTM, UPM, 2005 Bài giảng, Audio for game, Chapter 9, Alexander Brandon Ebook, Digital Multimedia, Chapter 7 Bài giảng, COSC1078 Introduction to Information Technology, Lecture 6, James Harland Bài giảng, Introduction to Audio Compression and Representation, Perry R. Cook, Princeton Computer Science