Thumbnail

Frequency Detector

Have servos respond to audio frequencies detected by the PC Microphone

+ How To Add This Control To Your Project (Click to Expand)
  1. Make sure you have the latest version of ARC installed.
  2. Select the Get button in this page to download the archive file.
  3. Double click the downloaded archive file to execute installer.
  4. The installer will add this control to ARC.
  5. Load ARC 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.

Manual

This ARC skill uses 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 sound source that we have used for frequency detection is a Piano. This is because a piano has an Attack and Decay, which is represented by the amplitude of the frequency range.

Main Window


User-inserted image


1. Visual Feedback Waveform
This visually displays the peaks and valleys of the detected frequency. It also shows you if your default recording device is working properly.

2. Min/Max Detected Frequency
Represents the minimum and maximum detected frequency values that have been detected since the skill has been used.

3. Reset Button
Resets the Min/Max detected frequency values.

4. Pause Checkboxes
These checkboxes will pause the servo movements and the output field values when selected.

5. Frequency Output Field
This field displays the detected frequency values in real-time.

Configuration


User-inserted image


1. Min/Max Detection Values
This output displays the peaks and valleys of the detected frequency. It also shows you if your default recording device is working properly.

2. servo Settings
You can change the servo port, min/max values, board index, and direction. You can also add multiple relative servos. The servo moves in conjunction with the detected frequency

3. Variable Name
Here you can change the variable name for the detected frequency value.

How to Use the Frequency Detector Skill


1) Add the Frequency Detector skill to your ARC project (Project -> Add Skill -> Audio -> Frequency Detector).

2)  Enable a default recording device and confirm that it's working.

3) Connect a servo to an EZ-B.

4) Configure the servo and/or frequency values in the configuration window of the skill.

5) Ensure the servo is not paused in then Main window, then watch the servo move with the detected frequency.

Script Sample



User-inserted image


Here's a little demo game that uses the frequency detector skill. This game uses the PC Microphone to detect frequency. The higher the frequency, the more the servo connected to port D0 will move. 

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)

Requirements


An installed audio input device (microphone).

Resources


Download the game mentioned above here: https://synthiam.com/Community/Apps/High-Frequency-Detect-Game-10927