IR Remote Piano

I wanted to do piano using IR remote, number 1-7 will play Do-Ti, and as long as I press the button the tone will continue, once I release it it will stop. But I don't know how to do the loop, I tried to use if loop, and switch, but I didn't get the result I wanted. There is one important note that when I hold any button it will send the same frequency for all buttons.
any suggestions how to get that?

Post the code you have that plays the basic notes and at least tries to hold on to the notes for the right time, even if it doesn't work. Also some idea of what IR remote you're using and what codes it sends when would be useful.

Some remotes will send a fixed repeat code when you keep pressing the same button. If you that is what you mean then you may just need to remember what the last real code was before you started getting repeat codes.

Steve