Continuing…
So, I added100-thisComp.layer("note").transform.opacityto the musical note’s opacity, and it kind of worked. The only problem I now have is that the keyframes generated from the MIDI data do not fall exactly on whole frames. I increased my comp’s frame rate to 99 (the max. value), altered my Echo Time to -1/99 and it sort of works, but the echo effect is causing some weird ghosting of the notes. I suspect the notes are not on screen for long enough.
Aha!
I found that the script had added two keyframes, a tiny fraction of a frame apart. Maybe it was trying to cram two notes into one slider. I changed the comp’s frame rate back to 25fps, deleted these second notes’ KFs, slid the remaining keyframes to snap to whole frames, adjusted the Echo Time back to -1/25, and lo and behold, it’s all sorted!