I was taught that when comping along with a bass player, I should (generally) avoid playing the same note as the bass. Are there times when this is desirable, recommended, or even necessary? If yes, in what contexts?
I agree with the answer and ideas provided by @Tim and would like to add a few of my own.
The thing about group accompanying is unless the music is completely arranged you can’t predict what the other person is going to do so how could one play the same notes as the bass player? Held root notes will clash with anything linear the bass might play. The same general principles of composed and arranged music apply to improvised music, try and avoid clashes and adjacent notes in the low register.
That being said, there are many times when doubling the bass (or the bass doubling something else) is very desirable and that is mostly within the context of an arrangement or composition. Some examples are the rubato intro to “So What?”, the first chorus of “Song for My Father”, Wayne Shorter’s Blue Note recording of “Footprints” and also unison melodies and soli sections like “Tricrotism”, “Sir Duke” (kudos, Tim) and tunes like “Spain”.
Here are some links to the tunes as requested:
Song For My Father:
There are MANY versions of Tricrotism. This is the original and my personal favorite:
Whether comping on piano or guitar, most times it's better to keep off the bass player's toes.
There can be times, though, where it's a pleasant change to play in unison with the bass - either the same notes, or an octave out. Obviously, it needs a bit of rehearsal, so they're both exactly together, in fact, everyone can be together. Think 'Sir Duke', for example.
There may also be times when, say, bass plays arco - long sustained notes - and that's an opportunity for a different bass line on, say, piano (guitar isn't easy to play bass lines on...).
Maybe you can play a harmony line with the bassist - a 10th above sounds good - again rehearsed. It's not easy to spontaneously produce something like this, unless you know each other's playing well. So, yes, if you call that sort of thing doubling.
Another good example of this effect used purposefully is Marc Cary’s Focus Trio ‘12 Stories.’ There are a lot of possibilities, where rehearsed, to use the bass line across two instruments and double up for sections before ‘passing’ it over. The effect can be similar to some of the ‘call and response’ type themes in North African Gnawa music generally played on the guembri which is similar in tone and pitch to a double bass.
As set out above it is generally good practice for each instrumentalist to try to play in a different register from others unless they are specifically doubling up rehearsed lines. This stops the sound from becoming muddy and can stop the unpleasant sound of certain chord or colour tones played in a low register together that, if one is played an octave two above, are pleasant.
Clearly instruments with an easier ability to play a wide range of pitches that are comping (piano, electric organ, guitar etc.) should aim to avoid the register of other instrumentalists.
Brendon Lowe’s jazz piano podcast has an early episode with Samuel Griffith that explains this well - 21:12 onwards - https://podcasts.apple.com/gb/podcast/jazz-piano-school/id959961760?i=1000333000504