I've been playing guitar for more years than I care to remember and most of that time has been spent learning songs. Over the years I've learned some quite challenging solos, but all I've really learned is where to put my fingers and when. What I'd really like to be able to do is just put on a random jam track or join a jam, and simply improvise. I've started trying to do this, but I think I'm hitting a way. I Know my 5 Pentatonic shapes, I can add the notes from the minor scale, I can move around the neck reasonably well, and I know a few nice licks in each position, but when I improvise, it largely just sounds like mindless noodling in a scale. It strikes me that what I'm really missing is melody, but I can't find an obvious way of getting that into my playing. I've heard people say 'follow the chords' but if I put on a random jam track or simply join a jam, I only really know what key I'm in, not the chords.
Are there some general rules I should be following for incorporating melody? Are there things I can focus on and practice with this?
My 'model' for the approach I want to take is Adrian Smith as everything he does seems to be based on melody and then he throws in a few flashy licks to keep things interesting and impressive. It seems to me that if I can get more melody into my playing, this would be a very workable approach as I already have the basic scale shapes and some licks. I can't find any courses that I can buy that covers this, so any help and advice would be gratefully received.