[sdiy] MIDI Clock sync advice
Roman Sowa
modular at go2.pl
Fri Mar 15 16:45:02 CET 2024
W dniu 2024-03-15 o 13:57, René Schmitz pisze:
>
>
> The speed of processors roughly keeps up with programmers ability to
> waste it.
Yes, that's my feeling exactly
>
> My gripe is that, for beginner programmer, it does not necessarily teach
> good practices, and even for a seasoned one it proliferates some bad
> habits. (How often is everything in loop()...)
>
> It's like giveing you a nice sugar coated piece of cake, so you might
> never be motivated to learn how to bake a better one.
hell yeah!
If I may just add - maybe it's just my impression, but I think that new
generations of programmers educated today have absolutely no idea how
microprocessor works.
> Back to MIDI: generally, when using the serial interrupt you have two
> choices:
>
> Either make the ISR short, and for example just throw the data into a
> buffer.
>
> Or do all the processing (which could take some time) there. Risk is
> that you might block other ISRs, such as timers, which is of course bad.
If I need a buffer, I usually process only MIDI clock inside ISR and put
all other messages into the buffer. Less than 20 cycles worst case. But
for example in my MIDI note decoder there's no buffer at all. The work
is done before next byte comes in, so there's no chance of cluttering or
missing a message.
Roman
More information about the Synth-diy
mailing list