Have servos respond to audio frequencies detected by the PC Microphone
+ How To Add This Control To Your Project (Click to Expand)
- Make sure you have the latest version of ARC installed.
- Select the Get button in this page to download the archive file.
- Double click the downloaded archive file to execute installer.
- The installer will add this control to ARC.
- Load ARC and press the Project -> Add Control button from the menu.
- Choose the Audio category tab.
- 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.
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.
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.Synthiam.com/Community/EZCloud/RobotAppDetails.aspx?id=4384
$lastMax = 0
if ($FrequencyDetected > $lastMax)
print("Detected " + $FrequencyDetected)
$lastMax = $FrequencyDetected
Servo(D0, (((GetServo(D0)) + 5)))