mirror of
https://github.com/le-studio-5/MachineInfernale.git
synced 2025-04-03 16:29:38 +02:00
expés aout 2020
This commit is contained in:
parent
7a2adfdb3b
commit
08d5342a33
|
@ -0,0 +1,137 @@
|
|||
#define bounceTime 20
|
||||
#include <Bounce.h>
|
||||
Bounce bouncer0 = Bounce( 0, bounceTime );
|
||||
Bounce bouncer1 = Bounce( 1, bounceTime );
|
||||
Bounce bouncer2 = Bounce( 2, bounceTime );
|
||||
Bounce bouncer3 = Bounce( 3, bounceTime );
|
||||
Bounce bouncer4 = Bounce( 4, bounceTime );
|
||||
Bounce bouncer5 = Bounce( 5, bounceTime );
|
||||
Bounce bouncer6 = Bounce( 6, bounceTime );
|
||||
Bounce bouncer7 = Bounce( 7, bounceTime );
|
||||
Bounce bouncer8 = Bounce( 8, bounceTime );
|
||||
Bounce bouncer9 = Bounce( 9, bounceTime );
|
||||
Bounce bouncer10 = Bounce( 10, bounceTime );
|
||||
Bounce bouncer11 = Bounce( 11, bounceTime );
|
||||
|
||||
#include <Audio.h>
|
||||
#include <Wire.h>
|
||||
#include <SPI.h>
|
||||
#include <SD.h>
|
||||
#include <SerialFlash.h>
|
||||
#define LED 13
|
||||
|
||||
// GUItool: begin automatically generated code
|
||||
AudioPlaySdRaw playSdRaw5; //xy=127,175
|
||||
AudioPlaySdRaw playSdRaw6; //xy=128,205
|
||||
AudioPlaySdRaw playSdRaw7; //xy=128,231
|
||||
AudioPlaySdRaw playSdRaw4; //xy=129,148
|
||||
AudioPlaySdRaw playSdRaw9; //xy=129,305
|
||||
AudioPlaySdRaw playSdRaw10; //xy=129,333
|
||||
AudioPlaySdRaw playSdRaw11; //xy=129,360
|
||||
AudioPlaySdRaw playSdRaw8; //xy=131,276
|
||||
AudioPlaySdRaw playSdRaw0; //xy=135,20
|
||||
AudioPlaySdRaw playSdRaw1; //xy=135,48
|
||||
AudioPlaySdRaw playSdRaw2; //xy=135,81
|
||||
AudioPlaySdRaw playSdRaw3; //xy=136,109
|
||||
AudioMixer4 mixer1; //xy=374,62
|
||||
AudioMixer4 mixer2; //xy=392,162
|
||||
AudioMixer4 mixer3; //xy=392,284
|
||||
AudioMixer4 mixer4; //xy=528,163
|
||||
AudioOutputAnalogStereo dacs2; //xy=666,163
|
||||
AudioConnection patchCord1(playSdRaw5, 0, mixer2, 1);
|
||||
AudioConnection patchCord2(playSdRaw6, 0, mixer2, 2);
|
||||
AudioConnection patchCord3(playSdRaw7, 0, mixer2, 3);
|
||||
AudioConnection patchCord4(playSdRaw4, 0, mixer2, 0);
|
||||
AudioConnection patchCord5(playSdRaw9, 0, mixer3, 1);
|
||||
AudioConnection patchCord6(playSdRaw10, 0, mixer3, 2);
|
||||
AudioConnection patchCord7(playSdRaw11, 0, mixer3, 3);
|
||||
AudioConnection patchCord8(playSdRaw8, 0, mixer3, 0);
|
||||
AudioConnection patchCord9(playSdRaw0, 0, mixer1, 0);
|
||||
AudioConnection patchCord10(playSdRaw1, 0, mixer1, 1);
|
||||
AudioConnection patchCord11(playSdRaw2, 0, mixer1, 2);
|
||||
AudioConnection patchCord12(playSdRaw3, 0, mixer1, 3);
|
||||
AudioConnection patchCord13(mixer1, 0, mixer4, 0);
|
||||
AudioConnection patchCord14(mixer2, 0, mixer4, 1);
|
||||
AudioConnection patchCord15(mixer3, 0, mixer4, 2);
|
||||
AudioConnection patchCord16(mixer4, 0, dacs2, 0);
|
||||
AudioConnection patchCord17(mixer4, 0, dacs2, 1);
|
||||
// Use these with the Teensy 3.5 & 3.6 SD card
|
||||
#define SDCARD_CS_PIN BUILTIN_SDCARD
|
||||
#define SDCARD_MOSI_PIN 11 // not actually used
|
||||
#define SDCARD_SCK_PIN 13 // not actually used
|
||||
uint8_t pinBouton[12] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
|
||||
|
||||
void setup() {
|
||||
//Serial.begin(9600);
|
||||
AudioMemory(30);
|
||||
pinMode(13, OUTPUT);
|
||||
for (int i = 0; i < 12; i++) {
|
||||
pinMode(pinBouton[i], INPUT_PULLUP);
|
||||
}
|
||||
SPI.setMOSI(SDCARD_MOSI_PIN);
|
||||
SPI.setSCK(SDCARD_SCK_PIN);
|
||||
while (!(SD.begin(SDCARD_CS_PIN))) {
|
||||
digitalWrite(13, LOW);
|
||||
delay (100);
|
||||
digitalWrite(13, HIGH);
|
||||
delay (100);
|
||||
}
|
||||
digitalWrite(13, HIGH);
|
||||
delay(100);
|
||||
mixer4.gain(0, 0.7);
|
||||
mixer4.gain(1, 0.7);
|
||||
mixer4.gain(2, 0.7);
|
||||
mixer4.gain(3, 0.7);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
bouncer0.update ( );
|
||||
bouncer1.update ( );
|
||||
bouncer2.update ( );
|
||||
bouncer3.update ( );
|
||||
bouncer4.update ( );
|
||||
bouncer5.update ( );
|
||||
bouncer6.update ( );
|
||||
bouncer7.update ( );
|
||||
bouncer8.update ( );
|
||||
bouncer9.update ( );
|
||||
bouncer10.update ( );
|
||||
bouncer11.update ( );
|
||||
if ( bouncer0.fallingEdge()) {
|
||||
playSdRaw0.play("s0.raw");
|
||||
}
|
||||
if ( bouncer1.fallingEdge()) {
|
||||
playSdRaw1.play("s1.raw");
|
||||
}
|
||||
if ( bouncer2.fallingEdge()) {
|
||||
playSdRaw2.play("s2.raw");
|
||||
}
|
||||
if ( bouncer3.fallingEdge()) {
|
||||
playSdRaw3.play("s3.raw");
|
||||
}
|
||||
if ( bouncer4.fallingEdge()) {
|
||||
playSdRaw4.play("s4.raw");
|
||||
}
|
||||
if ( bouncer5.fallingEdge()) {
|
||||
playSdRaw5.play("s5.raw");
|
||||
}
|
||||
if ( bouncer6.fallingEdge()) {
|
||||
playSdRaw6.play("s6.raw");
|
||||
}
|
||||
if ( bouncer7.fallingEdge()) {
|
||||
playSdRaw7.play("s7.raw");
|
||||
}
|
||||
if ( bouncer8.fallingEdge()) {
|
||||
playSdRaw8.play("s8.raw");
|
||||
}
|
||||
if ( bouncer9.fallingEdge()) {
|
||||
playSdRaw9.play("s9.raw");
|
||||
}
|
||||
if ( bouncer10.fallingEdge()) {
|
||||
playSdRaw10.play("s10.raw");
|
||||
}
|
||||
if ( bouncer11.fallingEdge()) {
|
||||
playSdRaw11.play("s11.raw");
|
||||
}
|
||||
delay(10);
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
#include <Audio.h>
|
||||
#include <Wire.h>
|
||||
#include <SPI.h>
|
||||
//#include <SD.h>
|
||||
//#include <SerialFlash.h>
|
||||
|
||||
#include <Bounce.h>
|
||||
|
||||
// GUItool: begin automatically generated code
|
||||
AudioSynthWaveform waveform1; //xy=178,261
|
||||
AudioFilterStateVariable filter1; //xy=302,379
|
||||
AudioOutputAnalogStereo dacs1; //xy=581,302
|
||||
AudioConnection patchCord1(waveform1, 0, filter1, 0);
|
||||
AudioConnection patchCord2(filter1, 0, dacs1, 0);
|
||||
AudioConnection patchCord3(filter1, 0, dacs1, 1);
|
||||
// GUItool: end automatically generated code
|
||||
|
||||
//#define SDCARD_CS_PIN BUILTIN_SDCARD
|
||||
//#define SDCARD_MOSI_PIN 11 // not actually used
|
||||
//#define SDCARD_SCK_PIN 13 // not actually used
|
||||
|
||||
#include <Smoothed.h>
|
||||
Smoothed <uint32_t> cs0av;
|
||||
Smoothed <uint32_t> cs1av;
|
||||
Smoothed <uint32_t> cs2av;
|
||||
Smoothed <uint32_t> cs3av;
|
||||
const int ledPin = 13;
|
||||
uint32_t csc;
|
||||
const byte nb_cs = 8;
|
||||
byte out[nb_cs] = {0, 2, 25, 11, 8, 10, 24, 26};
|
||||
byte in[nb_cs] = {1, 3, 26, 12, 9, 11, 25, 27};
|
||||
int calib[nb_cs];
|
||||
int i;
|
||||
uint32_t cs[8];
|
||||
|
||||
void setup()
|
||||
{
|
||||
//cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an example
|
||||
Serial.begin(115200);
|
||||
pinMode(ledPin, OUTPUT);
|
||||
for (i = 0; i < nb_cs; i++) {
|
||||
pinMode(in[i], INPUT);
|
||||
pinMode(out[i], OUTPUT);
|
||||
digitalWrite(out[i], LOW);
|
||||
}
|
||||
cs0av.begin(SMOOTHED_AVERAGE, 10);
|
||||
cs1av.begin(SMOOTHED_AVERAGE, 10);
|
||||
cs2av.begin(SMOOTHED_AVERAGE, 10);
|
||||
cs3av.begin(SMOOTHED_AVERAGE, 10);
|
||||
delay(500);
|
||||
Serial.print("go2");
|
||||
AudioMemory(20);
|
||||
waveform1.begin(0.7, 444, WAVEFORM_SAWTOOTH);
|
||||
|
||||
//biquad1.setLowpass(0, 1, 0.7);
|
||||
//biquad2.setLowpass(0, 1, 0.7);
|
||||
//biquad3.setLowpass(0, 1, 0.7);
|
||||
//biquad4.setLowpass(0, 1, 0.7);
|
||||
filter1.resonance(0.9);
|
||||
calibration();
|
||||
}
|
||||
void calibration() {
|
||||
for (i = 0; i < nb_cs; i++) {
|
||||
calib[i] = 0;
|
||||
}
|
||||
for (int n = 0; n < 100; n++) {
|
||||
for (int m = 0; m < 2; m++) {
|
||||
capsens(m);
|
||||
calib[m] = calib[m] + cs[m];
|
||||
}
|
||||
delay(10);
|
||||
digitalWrite(ledPin, HIGH);
|
||||
delay(10);
|
||||
digitalWrite(ledPin, LOW);
|
||||
}
|
||||
for (i = 0; i < 2; i++) {
|
||||
calib[i] = calib[i] / 100;
|
||||
|
||||
}
|
||||
}
|
||||
void capsens(int i) {
|
||||
csc = 0;
|
||||
noInterrupts();
|
||||
pinMode(in[i], INPUT);
|
||||
digitalWrite(out[i], HIGH);
|
||||
while (digitalReadFast(in[i]) == LOW) {
|
||||
csc = csc + 1;
|
||||
}
|
||||
interrupts();
|
||||
digitalWrite(out[i], LOW);
|
||||
pinMode(in[i], OUTPUT); digitalWrite(in[i], LOW);
|
||||
cs[i] = csc;
|
||||
}
|
||||
void loop()
|
||||
{
|
||||
//long start = millis();
|
||||
// for (i = 0; i < 8; i++) {
|
||||
// capsens(i);
|
||||
// }
|
||||
//Serial.print(millis() - start);
|
||||
// Serial.print("\t");
|
||||
capsens(0);
|
||||
capsens(1);
|
||||
// capsens(2);
|
||||
// capsens(3);
|
||||
|
||||
cs0av.add(cs[0]);
|
||||
cs1av.add(cs[1]);
|
||||
// cs2av.add(cs[2]);
|
||||
// cs3av.add(cs[3]);
|
||||
|
||||
Serial.print(cs0av.get());
|
||||
Serial.print("\t");
|
||||
Serial.print(cs1av.get());
|
||||
|
||||
int F1 = 444 + (cs1av.get() - cs0av.get()) * 8;
|
||||
F1 =constrain(F1, 50, 5000);
|
||||
int FF = cs1av.get() + cs0av.get()-850;
|
||||
|
||||
FF =constrain(FF, 3, 330);
|
||||
FF = sq(FF)/6;
|
||||
// int F2 = cs1av.get() - calib[1] - 20;
|
||||
// F2 = constrain(F2, 3, 250);
|
||||
// F2 = sq(F2) / 6;
|
||||
// int F3 = cs2av.get() - calib[2] - 20;
|
||||
// F3 = constrain(F3, 3, 250);
|
||||
// F3 = sq(F3) / 6;
|
||||
//
|
||||
// int F4 = cs3av.get() - calib[3] - 20;
|
||||
// F4 = constrain(F4, 3, 250);
|
||||
// F4 = sq(F4) / 6;
|
||||
//AudioNoInterrupts();
|
||||
waveform1.frequency(F1);
|
||||
filter1.frequency(FF);
|
||||
|
||||
//AudioInterrupts();
|
||||
//Serial.print(F1);
|
||||
// Serial.print("\t");
|
||||
// Serial.print(F1);
|
||||
// Serial.print("\t");
|
||||
// Serial.print(F2);
|
||||
// Serial.print("\t");
|
||||
// Serial.print(F3);
|
||||
// Serial.print("\t");
|
||||
// Serial.print(F4);
|
||||
// for (i = 0; i < 8; i++) {
|
||||
// Serial.print("\t");
|
||||
// Serial.print(cs[i]);
|
||||
// }
|
||||
Serial.println();
|
||||
delay(10); // arbitrary delay to limit data to serial port
|
||||
}
|
|
@ -4,8 +4,6 @@
|
|||
#include <SPI.h>
|
||||
#include <SD.h>
|
||||
#include <SerialFlash.h>
|
||||
|
||||
// GUItool: begin automatically generated code
|
||||
AudioInputPDM pdm1; //xy=218.88888888888889,241.11111111111111
|
||||
AudioEffectGranular granular1; //xy=372.22216796875,159.9999542236328
|
||||
AudioEffectBitcrusher bitcrusher1; //xy=543.3333129882812,161.11109924316406
|
||||
|
@ -15,15 +13,14 @@ AudioConnection patchCord2(granular1, bitcrusher1);
|
|||
AudioConnection patchCord3(bitcrusher1, 0, dacs1, 0);
|
||||
AudioConnection patchCord4(bitcrusher1, 0, dacs1, 1);
|
||||
// GUItool: end automatically generated code
|
||||
|
||||
#define GRANULAR_MEMORY_SIZE 25600 // 12800 enough for 290 ms at 44.1 kHz
|
||||
#define GRANULAR_MEMORY_SIZE 12800 // 12800 enough for 290 ms at 44.1 kHz
|
||||
int16_t granularMemory[GRANULAR_MEMORY_SIZE];
|
||||
#include "USBHost_t36.h"
|
||||
USBHost usbHost1;
|
||||
USBHIDParser usbHid1( usbHost1 );
|
||||
JoystickController stick( usbHost1 );
|
||||
|
||||
bool freeze = 0;
|
||||
bool bouton[13];
|
||||
|
||||
void setup( ) {
|
||||
AudioMemory(40);
|
||||
|
@ -36,40 +33,55 @@ void setup( ) {
|
|||
|
||||
void loop() {
|
||||
usbHost1.Task();
|
||||
|
||||
int Xjoy = stick.getAxis( 0 );
|
||||
int Yjoy = stick.getAxis( 1 );
|
||||
int Zjoy = stick.getAxis( 5 );
|
||||
int Cross = stick.getAxis( 9 );
|
||||
uint32_t buttons = stick.getButtons();
|
||||
|
||||
if (buttons > 1) {
|
||||
byte bitc = buttons;
|
||||
bitcrusher1.bits(bitc);
|
||||
}
|
||||
else bitcrusher1.bits(16);
|
||||
|
||||
long SR = sq(1023 - Yjoy)/24;
|
||||
Serial.print(SR); Serial.println();
|
||||
bitcrusher1.sampleRate(SR);
|
||||
//granular1.beginPitchShift(10);
|
||||
if (buttons==1 && freeze == 0) {
|
||||
freeze=1;
|
||||
float msec = 10+(1023-Xjoy)/2;//500.0; // + (knobA3 * 190.0);
|
||||
for (int i = 1; i < 13; i++) { ///////////////////à tester...
|
||||
bouton[i] = (buttons >> (i - 1)) & 1;
|
||||
}
|
||||
if (bouton[2]) bitcrusher1.bits(1);
|
||||
else if (bouton[3]) bitcrusher1.bits(2);
|
||||
else if (bouton[4]) bitcrusher1.bits(3);
|
||||
else if (bouton[5]) bitcrusher1.bits(4);
|
||||
else if (bouton[6]) bitcrusher1.bits(4);
|
||||
else bitcrusher1.bits(16);
|
||||
///////// fin à tester
|
||||
long SR = sq(1023 - Yjoy) / 40;
|
||||
//Serial.print( buttons, BIN);
|
||||
Serial.print( Zjoy);
|
||||
Serial.println();
|
||||
bitcrusher1.sampleRate(SR);
|
||||
if (bouton[1] == 1 && freeze == 0) {
|
||||
freeze = 1;
|
||||
float msec = 10 + (1023 - Xjoy) / 2; //500.0; // + (knobA3 * 190.0);
|
||||
granular1.beginFreeze(msec);
|
||||
}
|
||||
if(buttons ==0 ){
|
||||
freeze=0;
|
||||
if (bouton[1] == 0 && freeze == 1) {
|
||||
freeze = 0;
|
||||
granular1.stop();
|
||||
}
|
||||
if (bouton[12]==1 ) {
|
||||
|
||||
granular1.beginPitchShift(10);
|
||||
}
|
||||
//
|
||||
if(freeze==1){
|
||||
float ratio;
|
||||
if(Zjoy>=0 && Zjoy<32) ratio = 0.25;
|
||||
if(Zjoy>=32 && Zjoy<96) ratio = 0.5;
|
||||
if(Zjoy>=96 && Zjoy<160) ratio = 1.0;
|
||||
if(Zjoy>=160 && Zjoy<224) ratio = 2.0;
|
||||
if(Zjoy>=224 && Zjoy<256) ratio = 4.0;
|
||||
//ratio = powf(2.0, (Zjoy)/255.0 * 2.0 - 1.0); // 0.5 to 2.0
|
||||
//ratio = powf(2.0, knobA2 * 6.0 - 3.0); // 0.125 to 8.0 -- uncomment for far too much range!
|
||||
granular1.setSpeed(ratio);
|
||||
delay(10);
|
||||
if (Zjoy >= 0 && Zjoy < 32) ratio = 0.25;
|
||||
if (Zjoy >= 32 && Zjoy < 96) ratio = 0.5;
|
||||
if (Zjoy >= 96 && Zjoy < 160) ratio = 1.0;
|
||||
if (Zjoy >= 160 && Zjoy < 224) ratio = 2.0;
|
||||
if (Zjoy >= 224 && Zjoy < 256) ratio = 4.0;
|
||||
//ratio = powf(2.0, (Zjoy)/255.0 * 2.0 - 1.0); // 0.5 to 2.0
|
||||
//ratio = powf(2.0, knobA2 * 6.0 - 3.0); // 0.125 to 8.0 -- uncomment for far too much range!
|
||||
granular1.setSpeed(ratio);
|
||||
}
|
||||
else{
|
||||
float pitch = Xjoy/1024.0;
|
||||
pitch=map(pitch, 0.0, 1.0, 0.75, 1.25);
|
||||
granular1.setSpeed(pitch);
|
||||
}
|
||||
delay(10);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
// Joystick Logitec extreme3Dpro to teensy3.6 to sérial
|
||||
#include <Audio.h>
|
||||
#include <Wire.h>
|
||||
#include <SPI.h>
|
||||
#include <SD.h>
|
||||
#include <SerialFlash.h>
|
||||
// GUItool: begin automatically generated code
|
||||
AudioSynthWaveform waveform1; //xy=64,144
|
||||
AudioSynthWaveform waveform2; //xy=64,210
|
||||
AudioFilterStateVariable filter1; //xy=258,158
|
||||
AudioFilterStateVariable filter2; //xy=261,235
|
||||
AudioMixer4 mixer1; //xy=496,155
|
||||
AudioEffectBitcrusher bitcrusher1; //xy=677,157
|
||||
AudioOutputAnalogStereo dacs1; //xy=883,162
|
||||
AudioConnection patchCord1(waveform1, 0, filter1, 0);
|
||||
AudioConnection patchCord2(waveform2, 0, filter2, 0);
|
||||
AudioConnection patchCord3(filter1, 0, mixer1, 0);
|
||||
AudioConnection patchCord4(filter2, 0, mixer1, 1);
|
||||
AudioConnection patchCord5(mixer1, bitcrusher1);
|
||||
AudioConnection patchCord6(bitcrusher1, 0, dacs1, 0);
|
||||
AudioConnection patchCord7(bitcrusher1, 0, dacs1, 1);
|
||||
// GUItool: end automatically generated code
|
||||
#include "USBHost_t36.h"
|
||||
USBHost usbHost1;
|
||||
USBHIDParser usbHid1( usbHost1 );
|
||||
JoystickController stick( usbHost1 );
|
||||
|
||||
void setup( ) {
|
||||
AudioMemory(100);
|
||||
usbHost1.begin();
|
||||
Serial.begin( 115200 );
|
||||
waveform1.begin(WAVEFORM_SAWTOOTH);///////
|
||||
waveform1.amplitude(1);
|
||||
waveform1.frequency(440);
|
||||
waveform1.phase(0);
|
||||
waveform2.begin(WAVEFORM_SAWTOOTH);///////
|
||||
waveform2.amplitude(1);
|
||||
waveform2.frequency(440);
|
||||
waveform2.phase(0);
|
||||
|
||||
filter1.frequency(2000);
|
||||
filter1.resonance(2.2); //0.7 to 5.0
|
||||
filter1.octaveControl(7); // 0 to 7
|
||||
filter2.frequency(2000);
|
||||
filter2.resonance(2.2); //0.7 to 5.0
|
||||
filter2.octaveControl(7); // 0 to 7
|
||||
|
||||
mixer1.gain(0, 0.5); ///////////////////////
|
||||
mixer1.gain(1, 0.5);
|
||||
mixer1.gain(2, 0);
|
||||
mixer1.gain(3, 0);
|
||||
|
||||
bitcrusher1.bits(16); /////////////////
|
||||
bitcrusher1.sampleRate(44100);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
usbHost1.Task();
|
||||
|
||||
int Xjoy = stick.getAxis( 0 );
|
||||
int Yjoy = stick.getAxis( 1 );
|
||||
int Zjoy = stick.getAxis( 5 );
|
||||
int Cross = stick.getAxis( 9 );
|
||||
uint32_t buttons = stick.getButtons();
|
||||
int Ajoy = stick.getAxis( 17 );
|
||||
int Bjoy = stick.getAxis( 18 );
|
||||
int Cjoy = stick.getAxis( 19 );
|
||||
Serial.print(Xjoy);
|
||||
Serial.print("\t");
|
||||
Serial.print(Yjoy);
|
||||
Serial.print("\t");
|
||||
Serial.print(Zjoy);
|
||||
Serial.print("\t");
|
||||
Serial.print(Cross);
|
||||
Serial.print("\t");
|
||||
Serial.println(buttons + 0x1000, BIN);
|
||||
|
||||
|
||||
|
||||
// waveform1.frequency(50 + (Xjoy) / 20 + (128 - Zjoy) / 50);
|
||||
// waveform2.frequency(50 + (Xjoy) / 20 - (128 - Zjoy) / 50);
|
||||
// filter1.frequency((1024 - Yjoy) * 2);
|
||||
// filter2.frequency((1024 - Yjoy) * 2);
|
||||
// if (buttons > 0) {
|
||||
// byte bitc = buttons;
|
||||
// bitcrusher1.bits(bitc);
|
||||
// }
|
||||
// else bitcrusher1.bits(16);
|
||||
// if (Cross < 8) {
|
||||
// int SR = pow(8, Cross)+40;
|
||||
//Serial.print(SR); Serial.println();
|
||||
// bitcrusher1.sampleRate(SR);
|
||||
// }
|
||||
}
|
86
developpement_electronique/t36soundTest/t36soundTest.ino
Normal file
86
developpement_electronique/t36soundTest/t36soundTest.ino
Normal file
|
@ -0,0 +1,86 @@
|
|||
#define bounceTime 20
|
||||
#include <Bounce.h>
|
||||
Bounce bouncer1 = Bounce( 1, bounceTime );
|
||||
Bounce bouncer2 = Bounce( 2, bounceTime );
|
||||
Bounce bouncer3 = Bounce( 3, bounceTime );
|
||||
Bounce bouncer4 = Bounce( 4, bounceTime );
|
||||
#include <Audio.h>
|
||||
#include <Wire.h>
|
||||
#include <SPI.h>
|
||||
#include <SD.h>
|
||||
#include <SerialFlash.h>
|
||||
#define LED 13
|
||||
// GUItool: begin automatically generated code
|
||||
// GUItool: begin automatically generated code
|
||||
AudioSynthWaveformSine sine1; //xy=423,183
|
||||
AudioOutputAnalogStereo dacs1; //xy=581,302
|
||||
AudioConnection patchCord1(sine1, 0, dacs1, 0);
|
||||
AudioConnection patchCord2(sine1, 0, dacs1, 1);
|
||||
// GUItool: end automatically generated code
|
||||
// GUItool: end automatically generated code
|
||||
|
||||
// Use these with the Teensy Audio Shield
|
||||
//#define SDCARD_CS_PIN 10
|
||||
//#define SDCARD_MOSI_PIN 7
|
||||
//#define SDCARD_SCK_PIN 14
|
||||
|
||||
// Use these with the Teensy 3.5 & 3.6 SD card
|
||||
#define SDCARD_CS_PIN BUILTIN_SDCARD
|
||||
#define SDCARD_MOSI_PIN 11 // not actually used
|
||||
#define SDCARD_SCK_PIN 13 // not actually used
|
||||
|
||||
// Use these for the SD+Wiz820 or other adaptors
|
||||
//#define SDCARD_CS_PIN 4
|
||||
//#define SDCARD_MOSI_PIN 11
|
||||
//#define SDCARD_SCK_PIN 13
|
||||
int freq=110;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
AudioMemory(10);
|
||||
pinMode(13, OUTPUT);
|
||||
pinMode(1, INPUT_PULLUP);
|
||||
pinMode(2, INPUT_PULLUP);
|
||||
pinMode(3, INPUT_PULLUP);
|
||||
pinMode(4, INPUT_PULLUP);
|
||||
// SPI.setMOSI(SDCARD_MOSI_PIN);
|
||||
// SPI.setSCK(SDCARD_SCK_PIN);
|
||||
// while (!(SD.begin(SDCARD_CS_PIN))) {
|
||||
// digitalWrite(13, LOW);
|
||||
// delay (100);
|
||||
// digitalWrite(13, HIGH);
|
||||
// delay (100);
|
||||
// }
|
||||
digitalWrite(13, HIGH);
|
||||
delay(100);
|
||||
sine1.amplitude(1.0);
|
||||
|
||||
sine1.frequency(freq);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
bouncer1.update ( );
|
||||
bouncer2.update ( );
|
||||
bouncer3.update ( );
|
||||
bouncer4.update ( );
|
||||
// sine1.amplitude(0.0);
|
||||
// delay(120);
|
||||
sine1.amplitude(1.0);
|
||||
delay(200);
|
||||
freq=3*freq/2;
|
||||
if(freq>3000)freq=110;
|
||||
sine1.frequency(freq);
|
||||
// if ( bouncer1.fallingEdge()) {
|
||||
// playSdRaw1.play("s1.raw");
|
||||
// }
|
||||
// if ( bouncer2.fallingEdge()) {
|
||||
// playSdRaw2.play("s2.raw");
|
||||
// }
|
||||
// if ( bouncer3.fallingEdge()) {
|
||||
// Serial.println("Start playing");
|
||||
// playSdRaw3.play("s3.raw");
|
||||
// }
|
||||
// if ( bouncer4.fallingEdge()) {
|
||||
// playSdRaw4.play("s4.raw");
|
||||
// }
|
||||
}
|
Loading…
Reference in New Issue
Block a user