Projet la musique réactive avec Arduino

Objectifs

  1. Savoir lire la sortie Audio
  2. Savoir la dynamique des signaux audio
  3. Savoir convertir un signal stéréo en mono
  4. Savoir contrôler l’intensité d’une LED (ou plusieurs) avec un signal audio
  5. Etc.

Lecture & affichage des signaux audio

#define Gain    1

#define pinPWM  2




unsigned int Audio_left,Audio_right,Audio_sig;




void setup() {

  Serial.begin(115200);

}




void loop() {

  // Lecture des canaux - Signal stéréo

  Audio_left=analogRead(A0);

  Audio_right=analogRead(A1);




  // Sommation + Gain

  Audio_sig=Gain*(Audio_left+Audio_right);




  // Contrôle de la LED

  analogWrite(pinPWM,Audio_sig);




  // Affichage dans le port série

  Serial.print(Audio_left);Serial.print(",");

  Serial.print(Audio_right);Serial.print(",");

  Serial.println(Audio_sig);

  delay(20);

}

Contrôle de la LED

#define Gain    1

#define pinPWM  2




unsigned int Audio_left,Audio_right,Audio_sig;




void setup() {

}




void loop() {

  // Lecture des canaux - Signal stéréo

  Audio_left=analogRead(A0);

  Audio_right=analogRead(A1);




  // Sommation + Gain

  Audio_sig=Gain*(Audio_left+Audio_right);




  // Contrôle de la LED

  analogWrite(pinPWM,Audio_sig);

}
Click to rate this post!
[Total: 1 Average: 5]

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Retour en haut

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

FPGA | Arduino | Matlab | Cours will use the information you provide on this form to be in touch with you and to provide updates and marketing.