Sketch to Make Songs With Custom Duty Cycle?

I have found libraries/programs but none that enable me to change the duty cycle (seems like most leave that out). Anyone know of any sketches that I can modify so that I can play lower frequency monophonic songs at a specified duty cycle?

It would be cool to add a keyboard to this so that the arduino would play the tone (at the specified duty cycle) corresponding to the key, but I have no idea how to do that.

Any ideas?

Take a look at the toneAC v1.2 library, it uses changes in the duty cycle for volume control. Check the toneAC.cpp file in the library for a better understanding.

Take a look at what I did here

Add some arrays in PROGMEM to playback the notes you want for the time duration you want.