Dies ist eine alte Version des Dokuments!
Der Tanzroboter soll den Rhythmus der Musik analysieren und sich dazu bewegen können.
Dafür benötigen wir drei unterschiedliche Arbeitsbereiche:
Quellcode!
FFT Test Compute a 1024 point Fast Fourier Transform (spectrum analysis) on audio connected to the Left Line-In pin. By changing code, a synthetic sine wave can be input instead. The first 40 (of 512) frequency analysis bins are printed to the Arduino Serial Monitor. Viewing the raw data can help you understand how the FFT works and what results to expect when using the data to control LEDs, motors, or other fun things! This example code is in the public domain.
#include <Audio.h> #include <Wire.h> #include <SPI.h> #include <SD.h>
const int myInput = AUDIO_INPUT_LINEIN; const int myInput = AUDIO_INPUT_MIC; Create the Audio components. These should be created in the order data flows, inputs/sources → processing → outputs AudioInputAnalog adc1(A0); audio shield: mic or line-in AudioAnalyzeFFT1024 myFFT; AudioConnection patchCord1(adc1, 0, myFFT, 0); void setup() { Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example AudioMemory(12); Serial.begin(9600);
// Configure the window algorithm to use myFFT.windowFunction(AudioWindowHanning1024); //myFFT.windowFunction(NULL);
} const int zeilen = 100; float array[zeilen][20];
void loop() {
float n; if (myFFT.available()) { for (int j= 0; j<100 ;j=j){ for (int i=0; i<20; i++) { n = myFFT.read(i); array[j][i] = n; Serial.print(array[j][i]); Serial.print(" "); } Serial.println(); if (myFFT.available()){ j=j+2; } } }
/* for (int i = 0; i<20; i++){
for (int j = 0; j<100; i++){ Serial.print(array[i][j]); Serial.print(" "); Serial.println("aAa"); } Serial.println(); }*/
}
Mit Hilfe eines Mikrofons soll Musik aufgenommen werden und anschließend auf einem internen Computer analysiert werden. Im Endeffekt soll der Rhythmus durch eine Lautstärke- bzw. Frequenzanalyse erkannt werden. Dafür setzen wir uns erst mit der Fouriertransformation und der Funktionsweise des Equalizers auseinander um uns anschließend für eine der beiden Methoden zu entscheiden.
wie breitet sich Schall aus? wie zerlegt man ein Audiosignal in verschiedene Frequenzen? wie kann man den Grundschlag herausfiltern?
Alternativen:
Der Roboter soll sich mit Hilfe zweier Getriebemotoren (siehe physischer Aufbau) nach einem durch die Frequenzanalyse erkannten Rhythmus bewegen.
Funktionsweise der Getriebemotoren bzw. Ansteuerung wie schnell ist die Übertragung zwischen Computer und Motoren?
Alternative: