Sounds Logical
home

WaveWarp 2.0 Example DrawingBoard

Index Current Example DrawingBoard Group Previous Example DrawingBoard Group Next Example DrawingBoard Group Previous Example DrawingBoard Next Example DrawingBoard Bottom of Page

Description | Components Used

ConvolutionEducationalExample1

Description
Convolution Educational Example 1 Illustrates how the "Convolution" block can be used to calculate the exact convolution of two input vectors. NOTE: THIS DRAWINGBOARD WILL NOT RUN IN THE DEMO VERSION SINCE THE OUTPUT FILE FUNCTIONALITY HAS BEEN DISABLED. As a first example, compute the convolution of the sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] with itself. (This is the default setting of this Drawing Board). The input sequence is stored in the ascii file "input1to10.txt" (verify by opening it with any text editor). By feeding this same file into both inputs of the "Convolution" block (with the Data buffer length set to 10 -- corresponding to the length of the input sequence, the output gain set to 0dB, and the "Scaling" option de-selected), the first 10 elements of the output sequence of the convolution should be: [1, 4, 10, 20, 35, 56, 84, 120, 165, 220]. Run the Drawing Board. Check the contents of the destination text file "output.txt". The first 10 elements will be equal to 0 (due to latency associated with the algorithm -- see note below). The next 10 elements will be the sequence: [1, 4, 10, 20, 35, 56, 84, 120, 165, 220] as expected. The exact convolution has thus been computed. Note that, by definition, the convolution of two sequences should have a length equal to: [length of first sequence] + [length of second sequence] -1. In order to operate in real time with selectable buffer length without incurring a data explosion, only the first half of the total sequence is computed by the Convolution block. There is no loss of generality since the total sequence can be obtained by appropriate arrangement of the input sequences. For example, consider again the sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] convolved with itself. The complete resulting sequence is: [1, 4, 10, 20, 35, 56, 84, 120, 165, 220, 264, 296, 315, 320, 310, 284, 241, 180, 100]. This can be obtained by arranging the input sequences to the Convolution blocks as follows: first input sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; second input sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]. For convenience these files have been included on the DrawingBoard ("input1to10repeated.txt" and "input1to10padded.txt"). Try connecting these two into the Convolution block and checking that the resulting output is the full sequence as described above. For the next example, try feeding "impluse.txt" into one of the inputs of the "Convolution" block with "input1to10.txt" in the other. This "impluse.txt" file contains the "unit impulse" sequence (defined as: [1, 0, 0, 0, 0, 0, 0, 0, 0, 0] for 10 elements). By convolving this with the original sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] (in "input1to10.txt") the expected result is simply the original sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] in accordance with a key property of convolution, namely that the convolution of any sequence with the "unit impulse" should yield the original sequence. Run the Drawing Board. Check the contents of the destination text file "output.txt". The first 10 elements should be equal to 0 (due to latency associated with the algorithm -- see note below). The next 10 elements should be the original sequence: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] as expected. The exact convolution has thus been computed. The Convolution block performs pure convolution of the two inputs. Although it uses the Fast Fourier Transform (FFT) for efficiency, appropriate zero-padding and overlapping is applied to eliminate "circular convolution", such that the output is exactly the direct convolution of the two inputs, as if the computations were carried out in the time domain. The only tell-tale sign that the FFT has been used is the inherent "latency". In other words, the output is delayed by the length of the input data buffer.
Components used:

Index Current Example DrawingBoard Group Previous Example DrawingBoard Group Next Example DrawingBoard Group Previous Example DrawingBoard Next Example DrawingBoard Top of Page

home - news - products - store - support - site map - company info
© 2007 Sounds Logical. All rights reserved.
Sounds Logical
legal notice - privacy statement