Wednesday, September 26, 2012

Sound Processing on DSP

Sound Processing


Introduction

Sound processing is one of the many applications of Digital Signal Processing. Different effects can be performed with various filters. In this project we will describe some processing methods using sound signals. Then we will show how to implement these filter and compare their outputs.
All musical programs are produced in basically two stages. First, sound from each individual instrument is recorded in an acoustically inert studio on a single track of a multi-track tape recorder. Then the signals from each track are manipulated by the sound engineer to add special audio effects and are combined to in a mix down system to finally generate the stereo recording on a two-track tape recorder. The audio effects are artificially generated using various signal processing circuits and devices, and they are increasingly being performed using digital signal processing techniques. They can be done by Time-Domain Operations and Frequency-Domain Operations.
For years musicians have been using different to give their music a unique sound. Some of these techniques were found by accident, while others were found after a lot of work and experimentation. While the effects have not changed much in the past few years, the ways in which these effects are produced have.In recent years there has been a movement away from analog signal processing towards digital signal processing of music.This movement has allowed for very precise and easily reproduced effects.

Our Project

As part of our EE623 DSP course, we worked on producing echo effect using the single echo filter and the multiple echo FIR filter. It was a very intersting project, but we found the filters to be limiting in their effects. We wanted to experiment with filters which will produce a better and clearer output effect. This also encouraged us to work on other concepts like delay, reverberation, flanging, and equalizer.
In this report,we have described some of the filters we used, provided links to the Matlab code,the response plots of the filters, and the input and output sound files.
  • Delaying  

The delay is one of the simplest effects out there, but it is very valuable when used properly. A little delay can bring life to dull mixes, widen your instrument's sound, and even allow you to solo over yourself. The delay is the also a building block for a number of other effects,such as reverb,  flanging, chorusing.
Simply put, a delay takes an audio signal, and plays it back after the delay time. The delay time can range from several milliseconds to several seconds.
  • Reverberation

Reverberation is the result of the many reflections of a sound that occur in a room. From any sound source, say a speaker of your stereo, there is a direct path that the sounds covers to reach our ears. But that's not the only way the sound can reach us. Sound waves can also take a slightly longer path by reflecting off a wall or the ceiling, before arriving at your ears, as shown in Figure 1. A reflected sound wave like this will arrive a little later than the direct sound, since it travels a longer distance, and is generally a little weaker, as the walls and other surfaces in the room will absorb some of the sound energy. Of course, these reflected waves can again bounce off another wall before arriving at your ears, and so on. This series of delayed and attenuated sound waves is what we call reverb, and this is what creates the 'spaciousness' of a room.
Reverberation
  • Flanging

Flanging has a very characteristic sound that many people refer to as a "whooshing" sound, or a sound similar to the sound of a jet plane flying overhead. Flanging is generally considered a particular type of phasing (another popular effect). Flanging is created by mixing a signal with a slightly delayed copy of itself, where the length of the delay is constantly changing.

Sound Effects Implemented

  In the filters section we will describe about the filters, their usage and advantages and in effects section we will talk about 
  1. Delay
  2. Multiple Echo
  3. All pass Reverberation
  4. A Natural Sounding Reverberation
  5. Flanging
  6. Equalizer

  1. Delay

    A simple delay filter is shown below in figure 1.
    Delay

  2. Multi Echo Filter

    This filter realizes infinite number of echoes spaced "R" sampling periods apart and with exponentially decaying amplitude.
    The Block diagram of the multi-echo filter is given below.
    Multi Echo Filter
    Its Transfer function is given by
    H(Z) =  Z-R / (1 - alpha * ( Z-R))
    This filter is not good enough to provide natural sound reverberation because of two reasons.
    1. Its magnitude response is not constant for all frequencies resulting in, a 'coloration' of many musical sounds that are often unpleasant for listening purposes.
    2. The output echo density generated by unit impulse at the input is much lower than that observed in a real room.


  3. All Pass Reverberator

    To develop a more realistic reverberation, a reverberator with an all pass structure has been implemented
    All Pass Filter
    Its transfer function is given by
    H(Z) = (alpha + Z-R) / (1 + alpha * Z-R)
    Matlab Code
    Input Sound file
    Output Sound File

  4. A Natural Sounding Reverberator (Schroeder's Reverberator)

    In this case we try to simulate with a combination of 4 IIR filters and 2 All pass filters. We can have a general model of standard reverberation filter. With a suitable choice of decay factor,and delay units, we can have a more natural reverberator. This duplicates the sound that occurs in a specific closed space, such as a concert hall.
    A Natural Reverberator
    Matlab Code
    Input Sound file
    Output Sound File1

  5. Flanging effect

    The block diagram is given below
    A flange effect
    Its transfer function is
    H(Z) =(1 + alpha *( Z-beta (n) )
    where beta (n) is the time varying cosine function which is periodically varying between 0 an R
    Matlab Code
    Input Sound file
    Output Sound File

  6. Equalizer

    By using the Low-Pass, High Pass and Band-Pass Filters, an audio equalizer can be built. This allows the user to magnify or dampen any frequencies that they choose.Many equalizers on the market allow users to change up to 20 different frequency bands.For simplification we designed an equalizer with three bands: the lower band, a middle band, and the upper band. This was done with the MATLAB code that follows and the output is also shown below. The user can go through and change the gains to see the different effects that occur to the signal.
    A simple block diagram of the equalizer is given below
    Equalizer
    Output Sound File1 (Output of the Low Pass Filter) 
    Output Sound File2 (Output of the Band Pass Filter)
    Output Sound File3 (Output of the High Pass Filter)
    Output Sound File4 (The total output of the three filters)

Conclusion

Music signal processing includes a wide variety of effects and filtering techniques. Many of the algorithms discussed can be implemented quite easily with a few lines of MATLAB code. The effects covered above have been around for quite some time but can still be heard in many of the bands we listen to today. In the past the effects were implemented with analog technology, or in some cases two tape reels spinning at different speeds. Today, however, almost all musical signal processing effects are done digitally allowing for a wider variety of manipulation. We are able to see that in the past few years, how sound quality has improved tremendously. This will be greatly useful wherever sound transmission or its processing is done.

References

  1. Digital Signal Processing - A Computer Based Approach by Sanjit K Mitra
  2. Harmony Central
  3. McGill DSP course
  4. Handbook for Acoustic Ecology

Project done by
Rajani Shankar Sadasivam
Rajesh Samudrala
Vikas Sahdev
Click to view our Powerpoint Presentation


Reference
http://www-ece.eng.uab.edu/DCallaha/courses/DSP/
http://www-ece.eng.uab.edu/DCallaha/courses/DSP/Projects%202001/T4/sound.htm

https://ccrma.stanford.edu/~jos/fp/Definition_Simplest_Low_Pass.html
\



huffman coding
http://en.nerdaholyc.com/huffman-coding-on-a-string/
http://www.programminglogic.com/implementing-huffman-coding-in-c/
http://cprogramminglanguage.net/code-snippets/huffman-coding.aspx

No comments:

Post a Comment