Inject notes to a synthesiser

Ok, I tried the code posted here (since the topic is very similar to my task): https://forum.juce.com/t/midi-generator-creation/12912/15, but the insertion of code inside the processBlock does not produce any sound.