Nir has the best answer. Torque ripple can be caused by current loop issues such as offset, imbalance, and lack of resolution in the amplifier or by the magnetic design. (Sine wave motors are much better than trap or 6 step in this area). Velocity ripple is usually caused by inaccuracy of the position
sensor (dp/dt calculation can amplifier the error). Softening gains and adding inertia can hide some of these. Its amazing how the distribution of error on the feedback device affects the dp/dt calculation!!