function convolutionLoop(x_n)
{
// Initialize the offset to 0;
var offset = 0;
// Prepare an array to collect the output values of the filter
var output = [];
// Loop to run the filter
for (var n=0; n<x_n.length; n++)
{
// Calculate the weighted average for all the samples in the window
var Y_n = weightedAverageRoutine(x_n, offset);
// Increment the offset
offset++;
// Add Y_n to the output array
output.push(Y_n);
}
// Return the output array
return output;
}