There are many 'make music' tapes about and this is one of the better ones.
Without the use of external hardware you are limited to what the Spectrum can offer and this program makes use of everything the Spectrum has. It turns the Spectrum into a piano keyboard with 34 notes. You can adjust the bar length and the crotchet length, (sounds painful). It gives you a good range of all the sharps and flats, etc and it can also memorise your tune and play it back to you. You can also edit and change your tune and it can hold up to 2,500 notes.
Written for the 48K, it will set you back £5.95.