Delay-and-sum beamforming: implementing steering in C I am currently trying to understand how delay-and-sum beamforming works.
I have found this website which explains the process of this technique very well in which the following C code is provided:

#include &lt;stdio.h&gt;
#include &lt;math.h&gt;

#define ANGLE_RESOLUTION 500    // Number of angle points to calculate

int main(void)
{
   int numElements = 4;         // Number of array elements
   double spacing = 0.2;        // Element separation in metres
   double freq = 1000.0;        // Signal frequency in Hz 
   double speedSound = 343.0;   // m/s
   int a;
   int i;
   // Iterate through arrival angle points
   for (a=0 ; a&lt;ANGLE_RESOLUTION ; a++)
   {
      // Calculate the planewave arrival angle
      double angle = -90 + 180.0 * a / (ANGLE_RESOLUTION-1);
      double angleRad = M_PI * (double) angle / 180;
      double realSum = 0;
      double imagSum = 0;
      // Iterate through array elements
      for (i=0 ; i&lt;numElements ; i++)
      {
         // Calculate element position and wavefront delay
         double position = i * spacing;
         double delay = position * sin(angleRad) / speedSound;

         // Add Wave
         realSum += cos(2.0 * M_PI * freq * delay);
         imagSum += sin(2.0 * M_PI * freq * delay);
      }
      double output = sqrt(realSum * realSum + imagSum * imagSum) / numElements;
      double logOutput = 20 * log10(output);
      if (logOutput &lt; -50) logOutput = -50;
      printf("%d %f %f %f %f\n", a, angle, angleRad, output, logOutput);
   }
   return 0;
}


Beamforming works by steering to the direction that we want to listen to. 
Since the above code calculates the delay for -90 to 90 degrees, I thought that it was steering for a sound wave coming from -90 to 90 degrees.

But when going all the way down to that same website, it states "So far the main lobe of the array's sensitivity pattern has been fixed to a single direction; perpendicular to the array."

From that statement, I deduce that the above C code wasn't steering at all? If not, how could I implement it?
The code is calculating the beam pattern of a linear array which is the response at a single frequency.You might note that no actual sensor data is being summed or delayed.

The pattern is defined over all the angles from -90 to 90 and will have a main lobe. 

There are essentially two ways of steering a beam, by multiplication by phase at a single frequency or by actually delaying the signal in the time domain, typically using a N point interpolation, where N is small.

For 4 elements,  500 hundred look directions is rather too much.