Behavior Control
This control is developed by:
AvatarDJ Sures
Created
Updated
Help Index

Frequency Detector

How To Download and Use This Control

  1. Make sure you have the latest version of EZ-Builder installed.
  2. Select Download This Control button below to download the file.
  3. Double click the downloaded file to open it.
  4. The installer will automatically add this control to EZ-Builder.
Download This Control

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: http://www.ez-robot.com/Community/EZCloud/RobotAppDetails.aspx?id=4384

User-inserted image

Code:


Servo(D0, 1)

$lastMax = 0

:loopForever

if ($FrequencyDetected > $lastMax)

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

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

sleep(100)


endif

goto(loopForever)