Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
projets:fiat_lux:accueil [2018/06/09 15:38] resonance [Codes] |
projets:fiat_lux:accueil [2022/11/17 11:51] (Version actuelle) resonance |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
====== Fiat lux ====== | ====== Fiat lux ====== | ||
- | * Porteur du projet : [[: | + | * Porteur du projet : [[: |
* Date : 01/09/2017/ - 01/ | * Date : 01/09/2017/ - 01/ | ||
* Licence : [[http:// | * Licence : [[http:// | ||
Ligne 10: | Ligne 10: | ||
===== Description ===== | ===== Description ===== | ||
- | Synthé | + | Fiat lux est un triple synthétiseur |
+ | 3 Arduino programmés en synthétiseur (avec la library Mozzi pour certains), envoient du signal audio (électrique) dans des leds. | ||
+ | Celles-ci sont manipulables et orientables, | ||
+ | Ces panneaux solaires ont des sorties jack, permettant de se brancher à un ampli audio. | ||
+ | |||
+ | **Cet instruments a été exposé :** | ||
+ | |||
+ | * Mixart Myris Toulouse - Sonoptic 2020 | ||
+ | * Printemps de Bourges - 2018 | ||
+ | * CityLab Barcelona - 2017 (beta) | ||
+ | * ... et utilisé dans des concerts de Fenshu | ||
{{projets: | {{projets: | ||
Ligne 20: | Ligne 30: | ||
{{youtube> | {{youtube> | ||
//Le troisieme synth de la video est l' | //Le troisieme synth de la video est l' | ||
+ | |||
+ | {{youtube> | ||
Ligne 25: | Ligne 37: | ||
===== Circuit basique ===== | ===== Circuit basique ===== | ||
- | Et réaliser dans les regles | + | Un montage digne des plus grands moments |
{{ : | {{ : | ||
Ligne 47: | Ligne 59: | ||
Output Pin 9 - led ... | Output Pin 9 - led ... | ||
*/ | */ | ||
+ | |||
#include < | #include < | ||
#include < | #include < | ||
Ligne 59: | Ligne 71: | ||
const int MIN_CARRIER_FREQ = 22; | const int MIN_CARRIER_FREQ = 22; | ||
const int MAX_CARRIER_FREQ = 440; | const int MAX_CARRIER_FREQ = 440; | ||
+ | |||
const int MIN = 1; | const int MIN = 1; | ||
const int MAX = 10; | const int MAX = 10; | ||
+ | |||
const int MIN_2 = 1; | const int MIN_2 = 1; | ||
const int MAX_2 = 15; | const int MAX_2 = 15; | ||
+ | |||
// desired intensity max and min, for AutoMap, note they' | // desired intensity max and min, for AutoMap, note they' | ||
const int MIN_INTENSITY = 700; | const int MIN_INTENSITY = 700; | ||
const int MAX_INTENSITY = 10; | const int MAX_INTENSITY = 10; | ||
+ | |||
// desired mod speed max and min, for AutoMap, note they' | // desired mod speed max and min, for AutoMap, note they' | ||
const int MIN_MOD_SPEED = 10000; | const int MIN_MOD_SPEED = 10000; | ||
const int MAX_MOD_SPEED = 1; | const int MAX_MOD_SPEED = 1; | ||
+ | |||
AutoMap kMapCarrierFreq(0, | AutoMap kMapCarrierFreq(0, | ||
AutoMap kMapIntensity(0, | AutoMap kMapIntensity(0, | ||
Ligne 79: | Ligne 91: | ||
AutoMap mapThis(0, | AutoMap mapThis(0, | ||
AutoMap mapThisToo(0, | AutoMap mapThisToo(0, | ||
- | + | ||
- | const int KNOB_PIN = 0; // set the input for the knob to analog pin 0 | + | const int KNOB_PIN = 0; // Pitch |
- | const int LDR1_PIN=1; // set the analog input for fm_intensity to pin 1 | + | const int LDR1_PIN=5; // RingMOD |
- | const int LDR2_PIN=2; // set the analog input for mod rate to pin 2 | + | const int LDR2_PIN=2; // LFO speed |
- | const int LDR3_PIN=3; | + | const int LDR3_PIN=3; |
- | const int LDR4_PIN=4; | + | const int LDR4_PIN=4; |
+ | |||
Oscil< | Oscil< | ||
Oscil< | Oscil< | ||
Oscil< | Oscil< | ||
+ | |||
int mod_ratio = 5; // brightness (harmonics) | int mod_ratio = 5; // brightness (harmonics) | ||
long fm_intensity; | long fm_intensity; | ||
+ | |||
// smoothing for intensity to remove clicks on transitions | // smoothing for intensity to remove clicks on transitions | ||
float smoothness = 0.95f; | float smoothness = 0.95f; | ||
Smooth < | Smooth < | ||
- | + | ||
+ | |||
void setup(){ | void setup(){ | ||
Serial.begin(115200); | Serial.begin(115200); | ||
startMozzi(); | startMozzi(); | ||
} | } | ||
+ | |||
void updateControl(){ | void updateControl(){ | ||
- | | + | |
// freqVal = map(LDR3_PIN, | // freqVal = map(LDR3_PIN, | ||
int freqVal = mozziAnalogRead(LDR3_PIN); | int freqVal = mozziAnalogRead(LDR3_PIN); | ||
Ligne 110: | Ligne 122: | ||
int knob2 = mozziAnalogRead(LDR4_PIN); | int knob2 = mozziAnalogRead(LDR4_PIN); | ||
int knob2Val = mapThis(knob2); | int knob2Val = mapThis(knob2); | ||
- | | + | |
// read the knob | // read the knob | ||
int knob_value = mozziAnalogRead(KNOB_PIN); | int knob_value = mozziAnalogRead(KNOB_PIN); | ||
+ | |||
// map the knob to carrier frequency | // map the knob to carrier frequency | ||
int carrier_freq = kMapCarrierFreq(knob_value); | int carrier_freq = kMapCarrierFreq(knob_value); | ||
- | | + | |
//calculate the modulation frequency to stay in ratio | //calculate the modulation frequency to stay in ratio | ||
int mod_freq = carrier_freq * mod_ratio * FRQ; | int mod_freq = carrier_freq * mod_ratio * FRQ; | ||
- | | + | |
// set the FM oscillator frequencies | // set the FM oscillator frequencies | ||
aCarrier.setFreq(carrier_freq); | aCarrier.setFreq(carrier_freq); | ||
aModulator.setFreq(mod_freq); | aModulator.setFreq(mod_freq); | ||
- | | + | |
// read the light dependent resistor on the width Analog input pin | // read the light dependent resistor on the width Analog input pin | ||
int LDR1_value= mozziAnalogRead(LDR1_PIN); | int LDR1_value= mozziAnalogRead(LDR1_PIN); | ||
// print the value to the Serial monitor for debugging | // print the value to the Serial monitor for debugging | ||
+ | |||
int LDR1_calibrated = kMapIntensity(LDR1_value); | int LDR1_calibrated = kMapIntensity(LDR1_value); | ||
+ | |||
// calculate the fm_intensity | // calculate the fm_intensity | ||
fm_intensity = ((long)LDR1_calibrated * knob2Val * (kIntensityMod.next()+128))>> | fm_intensity = ((long)LDR1_calibrated * knob2Val * (kIntensityMod.next()+128))>> | ||
- | + | ||
- | + | ||
// read the light dependent resistor on the speed Analog input pin | // read the light dependent resistor on the speed Analog input pin | ||
int LDR2_value= mozziAnalogRead(LDR2_PIN); | int LDR2_value= mozziAnalogRead(LDR2_PIN); | ||
- | + | ||
- | + | ||
| | ||
Serial.print(knob_value); | Serial.print(knob_value); | ||
Serial.print(" | Serial.print(" | ||
- | | + | |
| | ||
Serial.print(LDR1_value); | Serial.print(LDR1_value); | ||
Serial.print(" | Serial.print(" | ||
- | | + | |
| | ||
Serial.print(LDR2_value); | Serial.print(LDR2_value); | ||
Serial.print(" | Serial.print(" | ||
- | + | ||
+ | |||
Serial.print(" | Serial.print(" | ||
Serial.print(freqVal); | Serial.print(freqVal); | ||
Serial.print(" | Serial.print(" | ||
+ | |||
Serial.print(" | Serial.print(" | ||
Serial.print(knob2); | Serial.print(knob2); | ||
Serial.print(" | Serial.print(" | ||
- | | + | |
+ | |||
// use a float here for low frequencies | // use a float here for low frequencies | ||
float mod_speed = (float)kMapModSpeed(LDR2_value)/ | float mod_speed = (float)kMapModSpeed(LDR2_value)/ | ||
+ | |||
kIntensityMod.setFreq(mod_speed); | kIntensityMod.setFreq(mod_speed); | ||
- | | + | |
Serial.println(); | Serial.println(); | ||
} | } | ||
+ | |||
int updateAudio(){ | int updateAudio(){ | ||
long modulation = aSmoothIntensity.next(fm_intensity) * aModulator.next(); | long modulation = aSmoothIntensity.next(fm_intensity) * aModulator.next(); | ||
return aCarrier.phMod(modulation); | return aCarrier.phMod(modulation); | ||
} | } | ||
+ | |||
void loop(){ | void loop(){ | ||
audioHook(); | audioHook(); | ||
Ligne 187: | Ligne 199: | ||
- | <code c+> | + | <code c+>// 3 led a jouant a la noire, croche et triolet |
- | // 3 led a 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 5 | #define led1 5 | ||
#define led2 9 | #define led2 9 | ||
#define led3 10 | #define led3 10 | ||
- | #define factor | + | //#define factor |
+ | int factor = 10; | ||
unsigned long previousMillis[3]; | unsigned long previousMillis[3]; | ||
+ | |||
void setup() { | void setup() { | ||
pinMode(led1, | pinMode(led1, | ||
pinMode(led2, | pinMode(led2, | ||
pinMode(led3, | pinMode(led3, | ||
+ | |||
Serial.begin(9600); | Serial.begin(9600); | ||
} | } | ||
void loop() { | void loop() { | ||
- | + | ||
- | int sensorValue = analogRead(A0); | + | int sensorValue = analogRead(A1); |
- | sensorValue = map(sensorValue, | + | sensorValue = map(sensorValue, |
+ | |||
if(sensorValue > 1990) { | if(sensorValue > 1990) { | ||
sensorValue == 10000; | sensorValue == 10000; | ||
} | } | ||
- | int sensorValueB = analogRead(A1); | + | int sensorValueB = analogRead(A0); |
sensorValueB = map(sensorValueB, | sensorValueB = map(sensorValueB, | ||
+ | int sensorValueC = analogRead(A2); | ||
+ | factor = map(sensorValueC, | ||
+ | |||
if(sensorValueB > 800) { | if(sensorValueB > 800) { | ||
| | ||
Ligne 222: | Ligne 236: | ||
| | ||
} | } | ||
+ | |||
if(sensorValueB > 400 && sensorValueB < 800 ) { | if(sensorValueB > 400 && sensorValueB < 800 ) { | ||
| | ||
Ligne 228: | Ligne 242: | ||
| | ||
} | } | ||
+ | |||
if(sensorValueB < 400) { | if(sensorValueB < 400) { | ||
| | ||
Ligne 234: | Ligne 248: | ||
| | ||
} | } | ||
+ | |||
Serial.print(" | Serial.print(" | ||
Serial.println(sensorValue); | Serial.println(sensorValue); | ||
+ | |||
Serial.print(" | Serial.print(" | ||
Serial.println(sensorValueB); | Serial.println(sensorValueB); | ||
- | | + | // |
+ | |||
} | } | ||
+ | |||
///Simple blink | ///Simple blink | ||
void BlinkLedSimple (int led, int interval, int array, int pwm){ | void BlinkLedSimple (int led, int interval, int array, int pwm){ | ||
Ligne 251: | Ligne 265: | ||
| | ||
}} | }} | ||
+ | |||
///delayyyy blink | ///delayyyy blink | ||
void BlinkLed (int led, int interval, int array, int pwm){ | void BlinkLed (int led, int interval, int array, int pwm){ | ||
if (((long)millis() - previousMillis[array]) >= interval){ | if (((long)millis() - previousMillis[array]) >= interval){ | ||
- | + | ||
previousMillis[array]= millis(); //stores the millis value in the selected array | previousMillis[array]= millis(); //stores the millis value in the selected array | ||
- | + | ||
digitalWrite(led, | digitalWrite(led, | ||
delay (pwm/ | delay (pwm/ | ||
Ligne 265: | Ligne 279: | ||
} | } | ||
} | } | ||
+ | |||
///super delayyyy blink | ///super delayyyy blink | ||
void BlinkLedSuper (int led, int interval, int array, int pwm){ | void BlinkLedSuper (int led, int interval, int array, int pwm){ | ||
if (((long)millis() - previousMillis[array]) >= interval){ | if (((long)millis() - previousMillis[array]) >= interval){ | ||
- | + | ||
previousMillis[array]= millis(); //stores the millis value in the selected array | previousMillis[array]= millis(); //stores the millis value in the selected array | ||
- | + | ||
digitalWrite(led, | digitalWrite(led, | ||
delay (pwm/ | delay (pwm/ | ||
Ligne 291: | Ligne 305: | ||
} | } | ||
} | } | ||
- | |||
</ | </ | ||
++++ | ++++ | ||
Ligne 302: | Ligne 315: | ||
++++ Le code | ++++ Le code | ||
<code c+> | <code c+> | ||
- | / | ||
- | */ | ||
- | |||
#include < | #include < | ||
#include < | #include < | ||
Ligne 311: | Ligne 321: | ||
#include < | #include < | ||
- | #define INPUT_PIN 0 // analog control input | + | #define INPUT_PIN 0 // analog control input LDR |
- | #define INPUT_PINA | + | #define INPUT_PINA |
- | #define MIX_PIN | + | #define MIX_PIN |
unsigned int echo_cells_1 = 32; | unsigned int echo_cells_1 = 32; | ||
Ligne 441: | Ligne 451: | ||
++++ | ++++ | ||
- | ==== Code sympa fluctuant | + | ==== Relaxation didgeridoo |
- | 2 pot volume et pitch | + | Synth 2 ou 3 \\ |
+ | Audio pin 9 | ||
++++ Le code | ++++ Le code | ||
Ligne 494: | Ligne 505: | ||
</ | </ | ||
++++ | ++++ | ||
+ | |||
+ | ==== Multitone Bug ==== | ||
+ | synth 2 ou 3 : bug avec 3 tone... | ||
+ | audio out : pin 9 | ||
+ | |||
+ | ++++ Le code | ||
+ | <code c+> | ||
+ | #define led1 9 | ||
+ | #define led2 5 | ||
+ | #define led3 10 | ||
+ | |||
+ | void setup() { | ||
+ | pinMode(led1, | ||
+ | pinMode(led2, | ||
+ | pinMode(led3, | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | int sensorValue = analogRead(A1); | ||
+ | sensorValue = map(sensorValue, | ||
+ | |||
+ | int sensorValueB = analogRead(A0); | ||
+ | sensorValueB = map(sensorValueB, | ||
+ | |||
+ | int sensorValueC = analogRead(A2); | ||
+ | sensorValueC = map(sensorValueC, | ||
+ | |||
+ | tone(led1, | ||
+ | delay (sensorValueC); | ||
+ | tone(led1, | ||
+ | delay (sensorValueC); | ||
+ | tone(led1, | ||
+ | delay (sensorValueC); | ||
+ | } | ||
+ | </ | ||
+ | ++++ | ||
+ | |||
Ligne 517: | Ligne 565: | ||
* feràsouder... | * feràsouder... | ||
* patience (compter 2 jours sans manger) | * patience (compter 2 jours sans manger) | ||
+ | |||
+ | |||
===== Photos ===== | ===== Photos ===== | ||
+ | {{: | ||
+ | |||
{{gallery>?& | {{gallery>?& | ||
+ | |||
+ | ===== Notice d' | ||
+ | - Brancher les 5 lampions sur les sorties instruments | ||
+ | - Brancher les sortie audio principale (panneau solaire) sur une table de mixage ou enceintes audio | ||
+ | - Brancher l' | ||
+ | - Brancher l' | ||
+ | - Si les lampions s' | ||
+ | |||
+ | |||
+ | Il ya quelques problemes qui sont encore a resoudre : | ||
+ | * Retirer les lampions peut aussi arreter le synthé du milieu... donc eviter de brancher et debrancher celui ci en live... (commencer tout branché) | ||
+ | * Possible faux contact pres des leds par moments... il faut les bouger un peu et ca repart (a moins que la led soit grillée) | ||