Perceptual Audio Coding Hw3

  • August 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Perceptual Audio Coding Hw3 as PDF for free.

More details

  • Words: 1,053
  • Pages: 2
MUS 422/EE 367C Winter 2006/2007 Assignment #3 Due February 2nd, 2007 1) CQF filter banks (extra credit): In this exercise you will design an N = 4 CQF filter bank. Recall that implementing the CQF 2-channel Filter bank requires finding a low pass prototype filter h0[n] that satisfies the power complementarity condition H0(z)H0(1/z) + H0(-z)H0(-1/z) = 2. One way to create a CQF prototype filter h0[n] is to create a half-band filter p[n] that has nonnegative Fourier Transform and to factor its z Transform into H0(z)H0(1/z). A candidate half-band filter p[n] can be created by windowing the ideal half-band filter sinc[n/2] with a window centered on n=0. (See pp. 105-110 in Chapter 5 of the textbook for definitions of common windows.) a) Prove that the power complementarity condition is satisfied if P(z) ≡ H0(z)H0(1/z) has only odd powers of z other than the constant term (z to the zeroth power) which is equal to 1. b) If H0(z) = a + b z -1 + c z -2 + d z -3 then show that P(z) satisfies the power complementarity condition if

a = − sin(θ) cos(φ) c = cos(θ) sin(φ) b = sin(θ) sin(φ) d = cos(θ) cos(φ)

Write out the form of P(z) in terms of the angles θ and φ. c) If h0[n] is 4 taps long then p[n] will be seven taps long and will run from n = -3 to n = 3. Create a candidate half-band filter p[n] using a 7-tap Hanning window wH[n] (see Chapter 5 pp. 107-108): p[n] = wH[n+3]*sinc[n/2]. Notice that this candidate filter satisfies the power complementarity condition. However, if the Fourier Transform of the candidate filter has negative values it will not be possible to factor it to determine h0[n] — find the minimum value δ of the Fourier transform of the candidate p[n] and, if negative, shift it up by |δ| and then multiply by 1/(1+|δ|) to preserve its normalization. Tune the angles θ and φ so that P(z) best fits the z Transform of this candidate half-band filter. What are the filter coefficients h0[n] corresponding to these best fit angles θ and φ? d) Use the other CQF filter conditions to determine h1[n], g0[n], and g1[n]. Graph |H0(f)| and |H1(f)| in dB relative to |H0(0)| and compare with a similar graph for the Haar filter. e) Use these CQF filters to implement a 2-channel perfect reconstruction filter bank. Test that the output exactly matches the input using the signal x[n] = 0.3 sin[3πn/4] + 0.6 sin[πn/4]. Graph the input signal against the outputs of the 2 channels. Now make another graph using the signal x[n] = 0.3 sin[3πn/4] wS[n] + 0.6 sin[πn/4] wS[n - 50] where wS[n] is a sine window of length N = 100. How are the 2 sub-band signals related to the input signal x[n]? 2) MDCT: In this exercise you will implement a time-to-frequency mapping using the MDCT. You will verify that the mapping leads to perfect reconstruction and that the fast implementation is significantly faster than straightforward implementation. Your fast MDCT/IMDCT implementation will be useful for later exercises. a) Implement a 50% window/overlap-add system (see for example Chapter 5, Figure 6, page 115 of the textbook, where M= N/2 and steps 2), 3), and 4) are omitted). Make sure that this system allows for perfect reconstruction of the input signal. (Recall that the window used needs to satisfy the conditions at page 128, where you may set the analysis window

b) c) d) ƒ ƒ e)

f) g)

identical to the synthesis window. You may choose to use a sine or KBD window to satisfy these conditions). Program functions to carry out the MDCT and IMDCT using the transform definitions. Use your MDCT/IMDCT functions to implement a 50% overlap analysis/synthesis system. Allow for arbitrary block sizes N and do your windowing using the sine or KBD window. Verify that your system leads to perfect reconstruction by testing it using N = 2048 window length transforms and the following test signals: x[n] = cos(2πn/44.1) [1 kHz tone sampled at 44.1 kHz] x[n] = θ(n) [step function] Program new functions to carry out the MDCT and IMDCT using the FFT-based fast implementation. To do so, you will need a routine for implementing the FFT/IFFT. Source code for such routines is readily available (e.g., see the Numerical Recipes book), but you will need to check that the conventions for sign (-j in the forward transform) and normalization factor (1/N for inverse transform) are consistent with our usage. Verify that your new routines are correct by using them in your analysis/synthesis system with the above test signals. Compare the execution time of your analysis/synthesis system when using the fast implementation versus using the straightforward implementation. Compare the output of the MDCT with the output of the DTF for the test files in 2 d). (For this comparison please use the sine window for the MDCT and sine and Hanning window for the DTF).

3) A Frequency Domain Audio Coder: In this exercise you will convert the audio coder you developed in Assignment #2 into a frequency domain coder using the MDCT as a time-to-frequency mapping. a) Write an audio coder that reads in 16 bit PCM audio files, MDCT-transforms sinewindowed (or KBD-windowed) blocks of N time samples into N/2 frequency components, quantizes those frequency components, packs and writes the quantized frequency components into coded files, reads your coded files, dequantizes and inverse transforms blocks of N/2 frequency components into N time samples, overlaps and adds the time samples with 50% overlap, and writes the decoded signal into a 16 bit PCM audio file you can play. Verify that your coder is bug-free by making sure that files coded using 16-bit midtread uniform quantization do not sound degraded when decoded. b) Test your codec on some sound samples using N = 512, 1024, 2048 while using 1) 8-bit midtread uniform quantization, and 2) 3 scale bits, 5 mantissa bits midtread floating point quantization. What compression ratio do you get? Describe the quantization noise you hear. How does the quantization noise differ from what you heard at the same quantization in the coder of Assignment #2? 4) Reading Assignment: Chapters 6 and 7 from the textbook, M. Bosi and R. E. Goldberg, “Introduction to Digital Audio Coding and Standards”, KAP 2003.

Related Documents