Check out the attached application note on polyphonic piano. This is a very old application note written for the very first family of PSoC. But I think you should be able to migrate to the present devices without any problem.
AN20242.zip 271.5 K
Many thanks for your help, I hope to do as you suggest