Frequency Detector

How To Add This Control To Your Project

  1. Make sure you have the latest version of EZ-Builder installed.
  2. Select the Install button below to download the archive file.
  3. Double click the downloaded archive file to execute installer.
  4. The installer will add this control to EZ-Builder.
  5. Load EZ-Builder and press the Project -> Add Control button from the menu.
  6. Choose the Audio category tab.
  7. Press the Frequency Detector icon to add the control to your project.

This plugin will use the default recording device (i.e. microphone) configured on the Windows PC to detect frequencies. The identified frequency can be assigned to a variable and move servos. A range can be specified to limit the servo movements between Min and Max frequencies.

User-inserted image

The type of algorithm used to detect the frequency is called Fast Fourier transform, or FFT for short. Detecting multiple frequencies is heard as noise, which will produce bumpy responses in the data log. Ideally, a single frequency works best.

The best instrument that I have used for frequency detection is a Piano sound. This is because a piano has an Attack and Decay, which is represented by the amplitude of the frequency range.

The configuration screen gives you options for configuring Servos, range and the variable which holds the frequency, if you wish to do something with it in other control code.

User-inserted image

Demo Game
Here is a little game that uses the frequency plugin. This game uses the PC Microphone to detect frequency. The higher the frequency, the more the servo connected to port D0 will move. Download the game here:

User-inserted image


Servo(D0, 1)

$lastMax = 0


if ($FrequencyDetected > $lastMax)

print("Detected " + $FrequencyDetected)
$lastMax = $FrequencyDetected

Servo(D0, (((GetServo(D0)) + 5)))