I want to write a bassline for a musical piece. Any ideas about how to write it along with the chord flow. For Example, the chord progression was
Music: Practice & Theory Stack Exchange is a question and answer site for musicians, students, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
A few ideas (assuming the song it's on 4/4):
Playing with the chord's 3rd, 5th and octave will help you find different "working" patterns for the bass, as these notes are fundamental and will most likely sound proper against the harmony.
A walking bass is a good idea. It goes up and down the scale notes, often just in ascending/descending order, one note per beat. So in 4/4 time, there's going to be 4 notes per bar.
On Em, you could play E F# G A, leading to the Am bar. But this gets you to an A note too early! Instead, you could play E F# G E, then go to the A. Or, for a bit of spice, go a semitone above the A - E F# G Bb, then A.
This idea can be repeated throughout. You saw the problem of arriving at the target in the next bar too soon, so try going down instead of up. E D C B uses all of the Em bar, then A G F E can come back to F for the F bar. Experiment.
Some styles of music lend themselves to a syncopated bassline. If you're using a sequencer you can lay down a bar of sixteenth notes on a single pitch, and then experiment by deleting some of the notes. If you delete some or all of the notes on the four strong beats it will sound funkier (and add accents on other notes too). You can also experiment with your bass and drums so they deliberately avoid each other (bass drum and bass line occur on different sixteenth notes) or reinforce each other (playing the same rhythm).
The effect of this can build a compelling groove.
The other answers suggest ways to add tonal variety. To these I'd suggest thinking about using the bass line to suggest a reharmonization - the play-out section of lots of songs has the bass player varying the bass line. For instance, the rest of the band can be playing a C Major chord, but if the bass player puts an A underneath it all, it sounds like an A minor 7 tonality instead.
Another thing to try is to pick your favourite tracks and use your ears to deconstruct them to see how they work. Then you can use what you've learned when you write new material.