What can be done if all notes are correct but their duration and that of the pauses are wrong?

(I mention that I am unable to play a musical instrument.)
In Cubase 5, I recorded a melody, played by me using the mouse, one note at a time. The notes and their order are correct but the duration of each note and that of the pauses between them are wrong. I am simply unable to play the song correctly and I will never be capable to do so.

Is it possible to replay this melody with only one key of the computer keyboard, more precisely each time I press that key the next already recorded note is played and rerecorded for the duration the key is pressed and when I release the key the next pause will be rerecorded for a duration that lasts till I press the key again?

(Note: Years ago I wrote a small Matlab program that took out from a stack prerecorded notes but with no duration and pauses between them and played them one after the other each time a pressed a key, not necessarily the same).