oli_lab wrote:what could be great is to check the outputs of the teensy, when sending CC :
on each pin (0,1,2) put a LED with a 180 Ohms resistor in series INSTEAD of the optocoupler
check if they lit OK
or if any, check between 1 and 2 of the optocouplers with a voltmeter.
Hi Oli_Lab,
I have looked for Hack Lab in Toronto with
https://hacklab.to/about.
So yesterday i was to them open office door.
A great peaceful place with lot off geeks who really want to help you.
I have explained everything about my Teensy/Usine/Sampler project and one of the geek has helped me.
So your schematic was good and my capacities to make a circuit is ok.
The Usine patch was good too.
Wherever there wasn't good was the Arduino Code.
We have worked on it together with the HackLab Man and finally it works !!!
I give you the good code here and invite you to put an eye on, it's very interesting:
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
#define channel_opto 1
#define opto1 0 //change to another digital pin to fit your schematics
#define opto2 1 // idem
#define opto3 2 // idem
#define LEDPIN 11 // the LED is on pin 11
#define CCopto1 100 //CC#100 commande opto 1
#define CCopto2 102 //CC#102 commande opto 2
#define CCopto3 103 //CC#103 commande opto 3
#define impulseLength 100 //impulse is 100ms wide
byte token1 = 0;
byte token2 = 0;
byte token3 = 0;
long lastBlink = 0;
byte LEDON = 0; // Set to 1 when the LED is on.
#define MIDI_ON
void setup() {
// put your setup code here, to run once:
pinMode(opto1, OUTPUT);
pinMode(opto2, OUTPUT);
pinMode(opto3, OUTPUT);
pinMode(LEDPIN, OUTPUT); // LED pin
Serial.begin(9600); // initialize the serial port at 9600 baud
Serial.println("Starting up...");
#ifdef MIDI_ON
usbMIDI.setHandleControlChange(OnControlChange); //will handle control change only
#endif
} //end setup
// midi callbacks :
void OnControlChange(byte channel, byte control, byte value) {
//Serial.println("MIDI control change arrived!");
// Every time data is received, blink the LED.
digitalWrite(LEDPIN, HIGH);
LEDON = 255;
if (channel == channel_opto) {
switch (control) {
case CCopto1: //make a impulse
if (value > 64 && token1 == 0) {
digitalWrite(opto1, HIGH);
delay(impulseLength);
digitalWrite(opto1, LOW);
Serial.print("pressing 100");
token1 = 1; // mark that the output is ON -- prevents it from sending more than once.
}
else if (value < 64 && token1 == 1) {
Serial.println("releasing 100");
token1 = 0;
}
break;
case CCopto2: //make a impulse
if (value > 64 && token2 == 0) {
digitalWrite(opto2, HIGH);
delay(impulseLength);
digitalWrite(opto2, LOW);
Serial.println("pressing 101");
token2 = 1;
}
else if (value < 64 && token2 == 1) {
token2 = 0;
Serial.println("releasing 101");
}
break;
case CCopto3: //make a impulse
if (value > 64 && token3 == 0) {
digitalWrite(opto3, HIGH);
delay(impulseLength);
digitalWrite(opto3, LOW);
Serial.println("pressing 102");
token3 = 1;
}
else if (value < 64 && token3 == 1) {
token3 = 0;
Serial.println("releasing 102");
}
break;
default :
break;
}
}
else {}
}
void loop() {
// put your main code here, to run repeatedly:
// Check the USB Midi to see if any messages have been received:
usbMIDI.read();
if (LEDON > 0)
{
// If the LED is on, we want to turn it off.
LEDON--;
if (LEDON == 0) digitalWrite(LEDPIN, LOW);
}
if (millis() - lastBlink > 5000) // has it been 1000ms since our last blink?
{
// Time to blink the LED
lastBlink = millis();
digitalWrite(LEDPIN, HIGH);
LEDON = 255;
}
}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
So it works.
What does it mean it works.
It means when Usine says to the Teensy :
- Put On Mode (1st Optocoupler) : the Sampler immediately undoing and redoing the last recorded overdub
- Put On Down (2nd Optocoupler) : The sampler play the recorded phrase in reverse
- Put On Up (3rd Optocoupler) : the sampler set the tempo of a new loop change the tempo (time stretch) of a stored loop. Playback tempo can be changed even while the loop is playing using this Teensy.
BUT
What i hadn't noticed well when i begun to built everything it is : "The footswitch can be used to set the tempo of a new loop or change the tempo of a stored loop."
- Set the tempo of a new loop means you put the tempo and after you play on it.
- Change the tempo of a stored loop means you already have stored a loop.
!!! But you can't record a loop without have stored it and change the tempo in real time !!!
There is a subtle difference but if you use the hardware this difference is huge.
To Finish,
if i want that Usine put a tempo all the time to the JamMan, i thought i must to make up in Clock Module the original Up Button in the Patch.
But if the module send a clock signal all the time to the Teensy -> Jam Man, the loop can have some weird cracks or jumps.
The interesting thing is that Jam Man know what is the tempo with a minimum of two impulses.
So i have to creat in a patch a clock who give to the Teensy/JamMan two impulses all the 50 or 100 impulses...
I don't know yet i have to try it.
Anyway,
Thank you a lot for your real big help Oli_Lab.
Even we never see each other and the complexity of the Teensy/Usine/JamMan communication project in relation to my skills it is a success !!
So we have the proof of the Power of the Usine Community !
Bye Bye.