DOC PREVIEW
Rutgers University ECE 348 - Lab 5 – Digital Audio Effects

This preview shows page 1-2-3-4-5-6 out of 17 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

56Lab 5 – Digital Audio Effects5.1. Plain ReverbThe reverberation of a listening space is typically characterized by three distinct time periods: the directsound, the early reflections, and the late reflections, as illustrated below:earlyreflectionsearliestreflectiondirectsounddirectearlylatelatereflectionstpredelayreverberation timeThe early reflections correspond to the first few reflections off the walls of the room. As the wavescontinue to bounce off the walls, their density increases and they disperse, arriving at the listener fromall directions. This is the late reflection part.The reverberation time constant is the time it takes for the room’s impulse response to decay by 60dB. Typical concert halls have time constants of about 1.8–2 seconds.In this and several other labs, we discuss how to emulate such reverberation characteristics usingDSP filtering algorithms. A plain reverberator can be used as an elementary building block for morecomplicated reverberation algorithms. It is given by Eq. (8.2.12) of the text [1] and shown in Fig. 8.2.6.Its input/output equation and transfer function are:y(n)= ay(n −D)+x(n), H(z)=11 − az−DThe comb-like structure of its frequency response and its pole-pattern on the z-plane are depicted inFig. 8.2.7 of Ref. [1] and shown below.2πD2π/D4πD6πD2πω0. . .1/(1-a)1/(1+a)|H(ω)|ρ=polesunitcircleIts sample processing algorithm using a circular delay-line buffer is given by Eq. (8.2.14) of [1]:xyz-DasDfor each input sample x do:sD=∗(p + D)y = x +asD∗p = y−−pIt can be immediately translated to C code with the help of the function pwrap() and embedded inthe interrupt service routine isr():5 DIGITAL AUDIO EFFECTS 57interrupt void isr(){float sD, x, y; // D-th state, input & outputread_inputs(&xL, &xR); // read inputs from codecx = (float) xL; // process left channel onlysD = *pwrap(D,w,p+D); // extract D-th state relative to py=x+a*sD; // compute output sample*p = y; // delay-line inputp = pwrap(D,w,--p); // backshift pointeryL = yR = (short) y;write_outputs(yL,yR); // write outputs to codecreturn;}Lab Procedurea. Modify the template program into a C program. plain1.c, that implements the above ISR. Set thesampling rate to 8 kHz and the audio input to MIC. With the values of the parametersD = 2500 anda = 0.5, compile and run your program on the DSK.Listen to the impulse response of the system by lightly tapping the microphone on the table. Speakinto the mike.Set the audio input to LINE, recompile and run. Play one of the wave files in the directory c:\dsplab\wav(e.g., dsummer, noflange from [3]).b. Recompile and run the program with the new feedback coefficienta = 0.25. Listen to the impulseresponse. Repeat fora = 0.75. Discuss the effect of increasing or decreasing a.c. According to Eq. (8.2.16), the effective reverberation time constant is given byτeff=ln ln aTD,TD= DT = D/fsFor each of the above values of a, calculate τeffin seconds, assuming = 0.001 (which correspondsto the so-called 60-dB time constant.) Is what you hear consistent with this expression?d. According to this formula,τeffremains invariant under the replacements:D → 2D, a → a2Test if this is true by running your program and hearing the output with D = 5000 and a = 0.52= 0.25and comparing it with the caseD = 2500 and a = 0.5. Repeat the comparison also with D = 1250anda =√0.5 = 0.7071.e. When the filter parametera is positive and near unity, the comb peak gains 1/(1 −a) become large,and may cause overflows. In such cases, the input must be appropriately scaled down before it ispassed to the filter.To hear such overflow effects, choose the feedback coefficients to be very near unity, for example,a = 0.99, with a corresponding gain of (1 −a)−1= 100. You may also need to multiply the input x byan additional gain factor such as 2 or 4.f. Modify the above ISR so that it processes the input samples in stereo (you will need to define twoseparate buffers for the left and right channels.) Experiment with choosing slightly different valuesof the left and right delay parametersD, or different values of the feedback parameter a. Keep theleft/right speakers as far separated as possible.5 DIGITAL AUDIO EFFECTS 585.2. Allpass ReverbLike the plain reverberator, an allpass reverberator can be used as an elementary building block forbuilding more complicated reverberation algorithms. It is given by Eq. (8.2.25) of the text [1] and shownin Fig. 8.2.17. Its I/O equation and transfer function are:y(n)= ay(n −D)−ax(n)+x(n − D), H(z)=−a + z−D1 − az−DAs discussed in [1], its impulse response is similar to that of the plain reverberator, but its magnituderesponse remains unity (hence the name “allpass”), that is,H(ejω)= 1 , for all ωIts block diagram representation using the so-called canonical realization and the corresponding sam-ple processing algorithm using a circular delay-line buffer is given by Eq. (8.2.14) of [1]:xs0sDz-Dya-afor each input sample x do:sD=∗(p + D)s0= x +asDy =−as0+ sD∗p = s0−−pThe algorithm can be translated immediately to C with the help of pwrap(). In this lab, we are goingto put these steps into a separate C function, allpass(), which is to be called by isr(), and linked tothe overall project. The function is defined as follows:// ---------------------------------------------------------------------------// allpass.c - allpass reverb with circular delay line - canonical realization// ---------------------------------------------------------------------------float *pwrap(int, float *, float *);float allpass(int D, float *w, float **p, float a, float x){float y, s0, sD;sD = *pwrap(D,w,*p+D);s0=x+a*sD;y =-a*s0+sD;**p = s0;*p = pwrap(D,w,--*p);return y;}// ---------------------------------------------------------------------------The allpass function is essentially the same as that in the text [1], but slightly modified to use floatsand the function pwrap(). In the above definition, the parameterp was declared as pointer to pointerto float because in the calling ISR functionp must be defined as a pointer to float and must be passedpassed by address because it keeps changing from call to call. The calling ISR function isr() is definedas follows:5 DIGITAL AUDIO EFFECTS 59interrupt void isr(){float x, y;read_inputs(&xL, &xR); // read inputs from codecx = (float) xL; // process left channel onlyy = allpass(D,w,&p,a,x); // to be linked with main()yL = yR = (short) y;write_outputs(yL,yR); // write outputs


View Full Document

Rutgers University ECE 348 - Lab 5 – Digital Audio Effects

Documents in this Course
Load more
Download Lab 5 – Digital Audio Effects
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lab 5 – Digital Audio Effects and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lab 5 – Digital Audio Effects 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?