CyberGene
A single Teensy has 25 analog pin inputs. Well, internally there are only 2 ADC-s, so they will be multiplexed as far as I remember but it doesn't hurt for you to test if you can directly wire multiple CNY70 to the analog inputs and try reading them in sequence. If that works quick enough, then you can use 2 Teensy boards for 50 keys (or three Teensy boards x 18 inputs each = 54 analog inputs) and then just record MIDI in your DAW from multiple MIDI inputs which is certainly possible on a Mac. If that works (because 10mm is a lot and would allow for the slight imprecision introduced through the slow sequential and multiplexed ADC), then your task is just wiring 52 CNY70-s and 52 resistors and you will be good to go.
P.S. My very first POC was using an Arduino with a single CNY70 and a resistor hooked to the analog input:
It wasn't MIDI-ed, just printing duration:
boolean firstActivated = false;
boolean secondActivated = false;
long firstActivatedAt;
void setup() {
Serial.begin(9600);
}
void loop() {
int v = analogRead(A0);
float volts = (v / 1024.0) * 5.0;
long timestamp = micros();
if (volts >= 4.0) {
if (!secondActivated) {
secondActivated = true;
long duration = timestamp - firstActivatedAt;
Serial.println(duration);
}
} else if (volts >= 2.0) {
if (!firstActivated) {
firstActivated = true;
firstActivatedAt = timestamp;
Serial.print("*");
}
} else {
secondActivated = false;
firstActivated = false;
}
//Serial.print("Value: ");
//Serial.print(v);
//Serial.print(" Volts: ");
//Serial.println(volts);
//delay(1);
}




