In this study, the music-inspired Harmony Search (HS) algorithm is modified for the optimization of active tuned mass dampers (ATMDs). The modification of HS includes the consideration of the best solution with a defined probability and updating of algorithm parameters such as harmony memory, considering rate and pitch adjusting rate. The design variables include all the mechanical properties of ATMD, such as the mass, stiffness and damping coefficient, and the active controller parameters of the proposed proportional-integral-derivative (PID) type controllers. In the optimization process, the analysis of an ATMD implemented structure is done using the generated Matlab Simulink block diagram. The PID controllers were optimized for velocity feedback control, and the objective of the optimization is the minimization of the top story displacement by using the limitation of the stroke capacity of ATMD. The optimum results are presented for different cases of the stroke capacity limit of ATMD. According to the results, the method is effective in reducing the maximum displacement of the structure by 53.71%, while a passive TMD can only reduce it by 31.22%.