[sdiy] Techniques for Multiplying MIDI Clock frequency?
Spiros Makris
spirosmakris92 at gmail.com
Tue Dec 21 08:38:01 CET 2021
I think the biggest drawback of usb is that you can connect only one device
to each port. 5 DIN midi can be buffered and spread around the studio to 16
instruments, and there is no additional overhead for your master computer
in doing so. If you dare connect 16 USB MIDI devices...yeah, that would be
ugly.
MIDI specifies how real time messages are interleaved with the rest, and
there's some care required when making the state machine in order to fully
comply with the last version. AFAIK arduino MIDI.h handles that properly,
even without using the interrupts.
After writing the above, I decided to have a deeper look into the teensy
3.2 interrupts. Turns out you can hack an ISR in the teensyduino core.
Here's my fix:
usb_isr is the interrupt routine for USB, and is defined under
teensy3>usb_dev.c. In there you will notice a few #ifdef statements, for
the various USB device modes. We will create a function pointer, that is
called by the teensy usb_isr, and expose it to our arduino main.cpp so we
can attach whatever we need to it.
1. in teensy3>usb_dev.h add:
void (*usbMIDI_isr)(void);
void usbMIDI_attach_interrupt(void (*fptr)());
2. in teensy3>usb_dev.c find usb_isr and add above it:
void usbMIDI_attach_interrupt(void (*fptr)())
{
usbMIDI_isr = fptr;
}
3.right before the end of usb_isr() add:
if (usbMIDI_isr)
{
(*usbMIDI_isr)();
}
4. in kinetis.h locate the list of _isr functions, around line 5800. At the
end of the list, add:
extern void usbMIDI_attach_interrupt(void (*fptr)());
in my main scetch I just call usbMIDI_attach_interrupt(&readMIDI);, and run
the MIDI.h read code without any changes. It seems to work.
There is some overhead in the MIDI library that by the looks of it would be
manageable. It could do with some optimization, but I wouldn't worry too
much about it, for now.
On Mon, 20 Dec 2021 at 21:26, mars <mars at pingdynasty.com> wrote:
> Well in USB MIDI everything is packaged into 4 byte packets so you don't
> get interspersed clocks. Or running status.
>
> Martin
>
>
> -------- Original message --------
> From: MTG <grant at musictechnologiesgroup.com>
> Date: 20/12/2021 18:34 (GMT+01:00)
> To: synth-diy at synth-diy.org
> Subject: Re: [sdiy] Techniques for Multiplying MIDI Clock frequency?
>
> USB-MIDI is another layer (of hell). I don't think it's going to solve
> any issues that 5-pin DIN has. Maybe because the microcontrollers that
> have USB are typically many, many times faster than an old 8-bit one
> though. OTOH, some USB stacks are very poorly written.
>
>
> On 12/20/2021 8:55 AM, Benjamin Tremblay via Synth-diy wrote:
> > I finally bought a mini scope. I have no excuse not to use it.
> > I agree, this is not a hard limitation on 5 pin MIDI, but it’s too easy
> > for developers interested in performance to abandon it and move to USB.
> >
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy
> Selling or trading? Use marketplace at synth-diy.org
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy
> Selling or trading? Use marketplace at synth-diy.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://synth-diy.org/pipermail/synth-diy/attachments/20211221/245ae973/attachment.htm>
More information about the Synth-diy
mailing list