Dynamic but controllable bassline

Good morning
This may end up sounding a little vague so sincere apologies in advance, but I am struggling to write code for a dynamically variable bassline (or any pattern/riff). I’m exploring (scale), (chord), (ring), [n,n,n,n,] and “x.y.x.y.”, in tandem with .choose, .shuffle, .tick and if spread( ) etc, which are amazing tools. But everything I write comes out very repetitive. Cos we’re using loops, right?

What I’m aiming for is something that starts on and around the root/tonic, with a sparse pattern, to which the user can gradually add increasingly varied rhythmic and harmonic patterns, vary that pattern and then bring it back to a simpler state.

I’m certainly not asking for you to write the code for me but I would really like to know if there are other functions or methods I should be looking at, beyond those I have mentioned.

ps, we’re having HOURS of endless fun with if spread() btw <3
Many thanks
Brendan

thanks Google

https://www.geeksforgeeks.org/add-array-elements-in-ruby/

and

https://ruby-doc.org/core-2.7.0/Array.html

These sites explain how to add to, delete from, change, append and prepend elements and indices in an array.