Depends on the solo. If you take a solo like Seize The Day – that is completely melody driven. The solo on Afterlife would be much more scale/arpeggio based. The key is to make it fit the song. The notes obviously need to fit the key, but the emotion of the solo is also important. What’s the song about? Is is sad song? A love song? A song about war? The solo should reflect that.
I always find it easier to add notes to a solo rather than take notes out. So start with the least amount of notes you can to make it work. Then work on making it interesting. Play the same notes in different ways. Try bending into a note you normally wouldn’t. Slide up or down into a note. That might be enough. If not, you can always add scales, speed, and flash to make it more aggressive or exciting.
My last word of advice is that humans respond and, more importantly, REMEMBER great melodies. They might be impressed with speed – but they don’t remember the notes you played. They only remember you played fast. When they walk away from your show humming a solo you played – that’s magical! And if it’s fast, aggressive song – by all means – shred! But if it’s not absolutely necessary, make your solo about three things.
Melody! Melody! Melody!
If all else fails, just take the notes of the chorus or the verse, etc and add to it. Make it so it’s recognizable, but not a blatant copy of the chorus/verse. A prime example of this is Smells Like Teen Spirit. Kurt just guitar-ized the verse, and it worked really well with the song. I did the same thing to one of my band’s songs, but turned single, Long notes into arpeggios to spice it up. Get creative with it.
If I know what key I’m in then I’ll automatically go to the familiar pentatonic boxes and noodle away over the backing riff. Been done a million times and sounds OK.
If nobody’s listening then I’ll hum or whistle a solo over the riff or chords. You’ll come up with some great melodies really quickly, not limited by your own playing ability. Get an idea in your head then try to play it on guitar. If you aim for certain target notes, maybe throw in some faster runs between them to add some interest.
What Papa Gates said is true! Shredding is fun and all but melody is definitely super important! Scales, pentatonics, and arpeggios are great “jumping off points” but you can’t really rely 100% on them when it comes to writing melodic solos. If you do, you’ll write stuff that sounds too “linear” going up and down patterns that your fingers have memorized and learned. What I recommend is placing limits on yourself. For example say you can only write a solo using the high e and b strings. It’ll force creativity out of you and will make you learn the fretboard more fluently! Good luck!