Surprisingly good output in under 200 lines of Python. Uses rising tension to manipulate rhythms and notes generated using a fractal pattern. Tempo is still an issue and sometimes you might need to play around with it based on the scale and style you're targetting.
"Spanish"
"Arab"
"Pentatonic"
Take the output. Layer it over octaves and use it drive some arps and pads , add a beat and enjoy.
You might need to adjust the temp and arp speed.
Just run pip install midiutil and then run the script.
Play output.mid on a nice instrument on your synth or DAW.