Know the right notes to play and you can jam, improvise, compose bass lines, as well as figure them out by ear.
You're about to learn how in this bass tutorial.
Scroll down for the free notation/TAB and backing track.
The following lessons will give some good background if you're unsure of some of the finer points: