When a song is playing, what the bass is doing is called harmony.
But what if you mute all the other tracks: would the bass alone be called a melody?
the bass alone would be called a melody?
Melody: ... a succession of notes of varying pitch, which form a recognizable musical shape; A parade of notes, one following the other meaningfully; An organized succession of pitches.
(Tried to find Grove's definition online, no luck - this site seems to use reliable sources.)
A typical bass-line certainly qualifies as melody, according to these definitions.
There is no qualification that melody be worthy to serve as a theme: An predominant melodic idea that characterizes a particular piece of music - call it the tune in the context of a modern song.
A melody can serve simply as a mundane time-keeper or embellishment on a theme or other melodies, and not be particularly interesting or pleasing on its own - it's still a melody.
Kind of, but the first part is not quite accurate. Harmony isn't just "what the bass is doing". Harmony is when two or more parts interact to create something more than either is doing alone.
So, yes, you could call the bass line a melody when played solo. But it's probably more pragmatic to focus on the intent rather than the technical semantics. For example a melody part may have been written with a given harmonic context in mind and so even when the melody is played solo you may hear or feel that implied harmony. Similarly, a bass line that merely outlines a harmony via roots and chord tones may still sound more like just a bass line rather than a melody part simply because of the intent when writing it.
To put it another way, some bass lines would make for pretty boring melodies. Or the bass line could be the interesting part and the other parts support it. They could all be interesting melodic parts that busily intertwine or they could all be simple parts that only give then intended effect when played together. It really depends. But the study of this, how they work together, that's what harmony is.
a bassline is all about defining the rhythm and the harmony—the chords—of the song. A bassline is the foundation on which the melody rides. With the sturdy foundation of the bass and other rhythm section instruments, the melody is free to do all sorts of things. Melodies have few constraints note-wise or rhythmically.
A melody just needs to sound good.
Good-sounding melodies do have some common characteristics, and their qualities are very different from basslines.
For example, basslines highly emphasize the root note of the chord. Melodies usually don't until the final note where they resolve. Instead, melodies often stress the higher chord tones (3rd, 5th, 7th) or scale tones in-between them.
Basslines often stress beat 1 of each bar. Melodies have no rhythmic obligation. A melody can start or end anywhere, and often their rhythmic stress is elsewhere and even skip beat 1.
Basslines and melodies are a world apart.