A system is developed that can generate counterpoint pieces in each of the five species as presented by Johann Joseph Fux in 1725. Existing rules of counterpoint from Fux, supplemented by Jeppesen in 1930, are formalized and quantified as a set of constraints. These constraints form the basis of the proposed constraint optimization problem (COP), for which an algorithm is designed to ensure a satisfactory melody generation. The algorithm developed is a guided local search metaheuristic. The search strategy iteratively improves a given counterpoint melody by always picking and improving upon the note in the melody that leads to the most accumulated penalty. The search algorithm is generalized and applicable to each of the five different species. The user provides input parameters such as key, scale type, vocal range, and type of species. The generated results are exported symbolically in midi-format, which can be further handled by programs such as musescore.