Is is correct to say "all the types of music"?

You use the definite article "the" when you are referring to something specific, for example:

The children need feeding.

You might use this to refer to your own children or some other specific set of children already referred to; but:

Children need feeding.

This is a much more inclusive statement with a global scope. It means all children need feeding, which of course they do!

So "all the types of music" sounds like you are referring to a specific set of music genres. Even if you mean it in a very broad sense to mean literally all music types, it suggests or at least infers that there are a limited or finite number of genres. New types of music emerge all the time though, so such a statement could at least become dated - someone who claimed to like all the kinds of music around in 1970 may not say the same today.

On the other hand, "all types of music" without the definite article is as broad as you can be and does not suggest any limits. If a radio station said "we play all types of music" it would suggest they are not limited to a certain genre.

However, there is also a secondary, idiomatic use of "all types", which can simply mean "varied". For example, someone who says "I like all types of music" may simply mean that they have varied tastes, such as rock, pop and classical which are very distinct from one another, yet they may dislike rap. In this kind of context, it is not understood to mean that they like literally everything.