No Title

EECS20: Introduction to Real-Time Digital Systems

Lab04: Digital Audio Effects


EECS20: Introduction to Real-Time Digital Systems
©1996 Regents of the University of California.
By K. H. Chiang, William T. Huang, Brian L. Evans.
URL: http://www-inst.eecs.berkeley.edu/~ee20
News: ucb.class.ee20
Assigned: 19 Feb 97, Checkoff: 26 Feb 97, Writeup Due: 28 Feb 97

Introduction

In the last laboratory, you played music as a sequence of notes, and experimented with making the music sound more realistic. In this laboratory, you will use simple mathematical operations to add style and special effects to the computer-generated music. You will add vibrato and tremelo playing styles. For special effects, you will replicate a melody to sound as if it were coming from many similar instruments (chorusing), and incorporate echo and reverberation, which are feedback techniques employed often in rock 'n' roll.

Vibrato and Tremelo

Vibrato is the variation of the amplitude of a tone by a low frequency sine wave. In mathematical terms:

where is the frequency of the underlying sine wave, or the carrier frequency; is the modulating frequency, with ; and is the sampling frequency, with to ensure that the Nyquist criterion is satisfied.

Tremelo is the variation of the frequency of the tone by a low frequency sine wave. In mathematical terms:

where is the frequency of the underlying sine wave, or the carrier frequency; is the modulating frequency. with ; is the modulation index, and is the sampling frequency, with to ensure that the Nyquist criterion is satisfied. To get a feel for what these parameters actually do, graph the frequency as a function of time ; the frequency will have a nominal value of , but will exhibit a sinusoidal variation at a frequency of with a maximum amplitude of . Suggested values of will be on the order of 2.5% to 10% of .

Varying the amplitude of a sine wave by some signal is commonly called amplitude modulation. Varying the frequency of a sine wave by some signal is commonly called frequency modulation. In frequency modulated (FM) radio, ranges from 88.5 to 108.5 MHz, the maximum is 15 kHz, and . In amplitude modulated (AM) radio, is 530 to 1700 100 kHz and the maximum is 5 kHz. This is one of the reasons that music on an FM radio station sounds better- more of the frequencies in the music are being transmitted. AM radio carries enough frequencies for human speech to sound good, but not enough for music because music contains frequencies over the entire audible range from 20 Hz to 20 kHz.

Chorusing

One way that studios use to make a few people sound like a crowd is chorusing. This is done adding to the original signal several delayed and attenuated versions of the original signal, as illustrated in Figure 1.

  
Figure 1: A system that implements chorusing.

The arrows in the figure indicate paths for the input signal. Figures such as these are usually drawn with the signal flow from left to right. Blocks represent systems which operate on their inputs to produce outputs. The delay blocks will return delayed versions of their inputs; in Figure 1, the amount of delay is represented by the variables D1 through DN. The gain blocks multiply their input by a constant value; this constant value is denoted G1 through GN. The circle with the plus sign is an adder, whose output is the sum of its inputs.

Echo

Consider clapping your hands once in a large room. First you hear the clap, and then an attenuated version of that clap, and then an attenuated version of that attenuated version... One way to reproduce this effect in the lab is to use a feedback loop, as in Figure 2.

  
Figure 2: A system that implements echo.

The input to the system is the original signal and the output is the echoed signal. Note that there is a direct connection from the input to the output. However, there is also a connection feeding a delayed and attenuated [assuming the gain is less than unity] version of the output signal back into the input. This is called a feedback loop, because the output is fed back to the input.

This system can be directly realized by summing appropriately delayed and attenuated copies of the original signal. Let the original signal be denoted , sampled at rate . If we desire a delay of seconds, this translates into a delay of samples. In addition, if the attenuation factor is denoted , the signal with echoes is then:

Reverberation

If the delay in the echo system above is sufficiently small, we can no longer hear distinct echoes. With a few appropriate modifications, as described below, we instead have reverberation.

Reverberation is the combination of a direct sound, an early return, and a reverberation tail. Going back to our example of clapping in a room, the direct sound is the initial clap. The early return would be the first echo that you would hear. The reverberation tail would be all the other echoes coming back to your ears, except that they would be close enough together that they wouldn't be very distinct. A simple reverberation system is shown in Figure 3.

  
Figure 3: A system that implements reverb.

With the appropriate selection of the parameters in Figure 3, we can simulate the response of any room from a dead one [with no return at all; this would be a room with a lot of sound insulation on the walls] to an extremely lively one [like a stadium or church].

Of course, the key word here is ``appropriate''. From the data available on various acoustical spaces, two of the available parameters are initial time delay (ITD) and reverberation time. The ITD is the time between when you make a sound and when you hear the first echo. The reverberation time is the time it takes for a sound that you make at to die away to of its initial amplitude.

Relating the ITD and the reverberation time to the values you need to put into the system in Figure 3 is a matter of engineering discipline [translation: make a reasonable guess]. As far as i can make it out, rules of thumb for choosing the various values are as follows:

For Symphony Hall in Boston, MA, the ITD is and the reverberation time is if the hall is occupied. This translates into:

Questions

  1. Vibrato and tremelo:
    1. Implement both vibrato and tremelo on a tone. Use , and for tremelo, a modulation index of 1.
    2. Sketch [plot by hand] waveforms for the above parameters.
    3. Play the waveforms back using the sound command. Can you hear any difference between them?
    4. What happens when you vary the modulation index?

  2. Chorusing: to make yourself sound like a crowd, implement the system in Figure 1. For the various delays, choose values between 0 and [you may wish to change this maximum value]. For the various gains, choose values between and .

  3. Echo:
    1. Record an sound and create an echoed version of that sound by adding together appropriately attenuated and delayed copies of the original sound. For amusement value, vary the attenuation and the delay.
    2. The system in Figure 2 has the system transfer function:

      Read the documentation for the filter command. Use that command with b=[1],
      a=[1 zeros(1, delay-1) -alpha], and a sufficiently long copy of x, padded with zeros. Compare the resulting output with that directly generated. Note that the filter command could take a long time to run, especially for large values of .

  4. Reverberation:
    1. Implement the system in Figure 3 and experiment with various values of the parameters. Note that the delays are given in seconds and need to be translated into sample delays. Consider recycling some of your work from the previous section.
    2. What values make the room sound dead?
    3. Try the values in the table below.

  5. Take the music that you generated in lab03 and run it through all your special effects above.

  6. Humor value: from where did these quotes originate?gif
    1. ``What's rock 'n' roll without feedback?''
    2. ``But it's louder- it goes to 11!''
    3. ``Hope I die before I get old?''



khc
Mon Feb 12 10:23:28 PST 1996