How to know when to counterpoint a melody?

Nov 6, 2019

And if there are any rule of how many voices to write?I write a "fugue" in which three voices imitates literally to the 4th (the first that introduce the subject),but sound dissonant in all the piece.The first voice is in f minor,the second in bb minor,the 3rd in f minor and the 4th in bb minor,if someone have time for help me i will upload that.Thanks for read!