Plugins / ezrobot / Frequency Detector

Frequency Detector

Have servos respond to audio frequencies detected by the PC Microphone

Register   Download Plugin

This plugin is version 0, was last modified on 2/21/2017, and is 19,791 Bytes. The author is ezrobot.

Requirements

This plugin requires EZ-Builder for Microsoft Windows PC.

  Get EZ-Builder for Windows

Plugin Details

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)