Wiki

Reso-nance numérique | Arts et cultures libres

Outils du site


projets:light-synth:accueil

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
projets:light-synth:accueil [2017/10/04 10:40]
resonance [light-synth]
projets:light-synth:accueil [2018/06/09 11:33] (Version actuelle)
resonance [Boite a rythme a led]
Ligne 4: Ligne 4:
   * Licence : [[http://creativecommons.org/licenses/by-sa/3.0/legalcode|CC-by-sa-3.0]]   * Licence : [[http://creativecommons.org/licenses/by-sa/3.0/legalcode|CC-by-sa-3.0]]
   * Description : synthé qui marche avec la lumiere   * Description : synthé qui marche avec la lumiere
-  * Fichiers sources : //mettre un lien ...//+  * Fichiers sources : voir plus bas pour les codes , design : {{ :projets:light-synth:lightsynthdesign.ai |}}
   * Lien : //mettre un lien//   * Lien : //mettre un lien//
  
Ligne 11: Ligne 11:
 ===== Note d'intention ===== ===== Note d'intention =====
 Synthé qui marche avec la lumiere : Synthé qui marche avec la lumiere :
-Plusieurs pistes sont possible, notamment en changeant les frequences des pwm avec library tone...+Plusieurs pistes sont possible, notamment en changeant les fréquences des pwm avec library Tone et Mozzi
  
 {{projets:light-synth:accueil:instrument_lumiere_minuscule.jpg?800|light-synth}} {{projets:light-synth:accueil:instrument_lumiere_minuscule.jpg?800|light-synth}}
Ligne 34: Ligne 34:
  
 <code c+> <code c+>
-// 3 led au pin 11/12/13 jouant a la noire, croche et triolet+// 3 led jouant a la noire, croche et triolet
 // un potentiometre 10k en A0 : controle le tempo général... // un potentiometre 10k en A0 : controle le tempo général...
 // une photo resistance en A1 : controle un effet de delay // une photo resistance en A1 : controle un effet de delay
  
-#define led1 11   // +#define led1 5 
-#define led2 12  //pin for each led +#define led2   
-#define led3 13  //pin for each led +#define led3 10   
-#define factor 6  //pin for each led+#define factor 6  //factor for pwm tone !
  
 unsigned long previousMillis[3]; //[x] = number of leds unsigned long previousMillis[3]; //[x] = number of leds
Ligne 141: Ligne 141:
 ++++ ++++
  
-==== Synth fm avec 5 potentiomètres ====+==== Synth fm avec 5 potentiomètres avec MOZZI ====
 On controle un synthe fm avec 5 potards, On controle un synthe fm avec 5 potards,
  le son passe par la led en pin 9...  le son passe par la led en pin 9...
Ligne 401: Ligne 401:
 ++++  ++++ 
  
 +==== Theremin fluctuant Mozzi ====
 +2 pot (selecteur si pot ou ldr pour controler le pitch, pitch ) un ldr (pitch)....
  
 +++++ Le code   
 +<code c+>
 +/*  
 +*/
  
 +#include <MozziGuts.h>
 +#include <Oscil.h> // oscillator template
 +#include <tables/sin2048_int8.h> // sine table for oscillator
 +#include <RollingAverage.h>
 +#include <ControlDelay.h>
 +
 +#define INPUT_PIN 0 // analog control input
 +#define INPUT_PINA 2 // analog control input
 +#define MIX_PIN 3 // analog control input
 +
 +unsigned int echo_cells_1 = 32;
 +unsigned int echo_cells_2 = 60;
 +unsigned int echo_cells_3 = 127;
 +    int bumpy_input = 12;
 +
 +#define CONTROL_RATE 64
 +ControlDelay <128, int> kDelay; // 2seconds
 +
 +// oscils to compare bumpy to averaged control input
 +Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> aSin0(SIN2048_DATA);
 +Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> aSin1(SIN2048_DATA);
 +Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> aSin2(SIN2048_DATA);
 +Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> aSin3(SIN2048_DATA);
 +
 +// use: RollingAverage <number_type, how_many_to_average> myThing
 +RollingAverage <int, 32> kAverage; // how_many_to_average has to be power of 2
 +int averaged;
 +
 +void setup(){
 +  kDelay.set(echo_cells_1);
 +  startMozzi();
 +}
 +
 +
 +void updateControl(){
 +  int mix =  mozziAnalogRead(MIX_PIN);
 +  int pot = mozziAnalogRead(INPUT_PINA) ;
 +  int ldr = mozziAnalogRead(INPUT_PIN) ;
 +
 +if (mix > 500)
 +{
 +  bumpy_input = ldr;
 +}
 +else
 +{
 +  bumpy_input = pot;
 +}
 +
 +  
 +  averaged = kAverage.next(bumpy_input);
 +  aSin0.setFreq(averaged);
 +  aSin1.setFreq(kDelay.next(averaged));
 +  aSin2.setFreq(kDelay.read(echo_cells_2));
 +  aSin3.setFreq(kDelay.read(echo_cells_3));
 +}
 +
 +
 +int updateAudio(){
 +  return 3*((int)aSin0.next()+aSin1.next()+(aSin2.next()>>1)
 +    +(aSin3.next()>>2)) >>3;
 +}
 +
 +
 +void loop(){
 +  audioHook();
 +}
 +
 +</code>
 +++++ 
  
 ===== Matériaux et outils ===== ===== Matériaux et outils =====
/home/resonancg/www/wiki/data/attic/projets/light-synth/accueil.1507106403.txt.gz · Dernière modification: 2017/10/04 10:40 de resonance