Mu0n
Well-known member
I assembled a small breaboard midi-in circuit, powered by a bench supply providing 5V, according to this well known circuit:
which looks like this (I had optoisolator H11 chips from previous projects)
and just to prove it works, I plugged my pocketmac midi out cable to this breadboard while cubase was playing a tune, and I checked an oscilloscope set to decode RS232*, 31250 bps, 1 stop bit and I was able to single shot capture a bunch of midi commands, here's a Note On set of three bytes on channel 9, but since its velocity is 00, it's probably interpreted as a Note Off:
(*I know the mac serial or midi isn't RS232, but it's the closest setting on my scope I can use, and you can modify it to oblivion with the other parameters anyway)
For the time being, I'm going through the myriads of suggestions and I've tested a bunch, nothing was conclusive yet. I'm trying to be careful not going into many rabbit holes of technical knowledge that I barely understand, so my first real step is keeping the C code I posted above, but doing small incremental changes. Here's what happened since I last posted it:
1) I added a scanf routine so that I can control when to send a note to the serial (modem) port, it's an ANSI console application, so I'm getting easy text feedback on error messages and whatnot, and can let myself control when to do what so I can be ready with my oscilloscope and prep it for single shot captures.
2) I tried to modify the MyConfigurePort to take in value '1' in its parameters, since it'd get me to 38,400 bps. I don't get anything on the scope that's valid.
3) Right after the MyConfigurePort function, I added another one which uses Control and csCode 16 and I've mainly played with 0x40 as the parameter to send, which sets bit 6 to 1, supposedly to enable external clock. Is there anything else that has to be done? It doesn't seem to be enough, because this is what I get on the scope - not large enough for 3 bytes that I send (0x90, 0x3C, 0x64; each byte has to be 320 us) and the decoding fails to pick anything:
4) that same step 3 can now be activated with my typing - I type 2 hex characters and that's the hex value that'll be sent with a Control, as such:
which looks like this (I had optoisolator H11 chips from previous projects)
and just to prove it works, I plugged my pocketmac midi out cable to this breadboard while cubase was playing a tune, and I checked an oscilloscope set to decode RS232*, 31250 bps, 1 stop bit and I was able to single shot capture a bunch of midi commands, here's a Note On set of three bytes on channel 9, but since its velocity is 00, it's probably interpreted as a Note Off:
(*I know the mac serial or midi isn't RS232, but it's the closest setting on my scope I can use, and you can modify it to oblivion with the other parameters anyway)
For the time being, I'm going through the myriads of suggestions and I've tested a bunch, nothing was conclusive yet. I'm trying to be careful not going into many rabbit holes of technical knowledge that I barely understand, so my first real step is keeping the C code I posted above, but doing small incremental changes. Here's what happened since I last posted it:
1) I added a scanf routine so that I can control when to send a note to the serial (modem) port, it's an ANSI console application, so I'm getting easy text feedback on error messages and whatnot, and can let myself control when to do what so I can be ready with my oscilloscope and prep it for single shot captures.
2) I tried to modify the MyConfigurePort to take in value '1' in its parameters, since it'd get me to 38,400 bps. I don't get anything on the scope that's valid.
C:
void MyConfigureThePort(void)
{
const int kConfigParam = 1+data8+noParity+stop10;
char myParam = 0x40;
gOSErr = SerReset(gOutputRefNum, kConfigParam);
if(gOSErr == noErr)
{
printf("port configuration successful\n");
}
else printf("port configuration unsuccesful, code=%d \n",gOSErr);
}
3) Right after the MyConfigurePort function, I added another one which uses Control and csCode 16 and I've mainly played with 0x40 as the parameter to send, which sets bit 6 to 1, supposedly to enable external clock. Is there anything else that has to be done? It doesn't seem to be enough, because this is what I get on the scope - not large enough for 3 bytes that I send (0x90, 0x3C, 0x64; each byte has to be 320 us) and the decoding fails to pick anything:
4) that same step 3 can now be activated with my typing - I type 2 hex characters and that's the hex value that'll be sent with a Control, as such:
C:
void TweakClock(char param)
{
//Tie the clock to external control
gOSErr = Control(gOutputRefNum, 16, ¶m);
if(gOSErr == noErr)
{
printf("external clock control successful\n");
}
else printf("external clock control unsuccesful, code=%d \n",gOSErr);
}