This is somewhat inspired by the DOEPFER A-198 Ribbon Controller but I added the feature that it uses two different quantizers depending on whether the melody is rising or falling.
Look for instructions in the patch’s NOTES module. The patch, as saved, is ready to auto-generate a C Major scale melody.

Oops! I just noticed that the FM-OP is tuned up a minor third … so Eb Major instead of C. To correct the tuning, just set the FM-OP frequency to 0.25.