M4A is lossy compression meaning some information used to create the music is lost in the interest of smaller file size.
These may still sound fine or good enough but for best sound quality possible re-rip is needed to a lossless format.
Compression is fine as long as it is lossless as is typically the case with FLAC format. That is what I use. It provides a lossless format with smaller files that also has good ability to allow files be tagged with other relevant information that can be used to make for a richer user experience (depending on software used to stream and its ability to leverage the tags/metadata). The best of everything in essence.
I rip to flac using dbpoweramp which is a very good tool for assuring best quality results both in terms of sound quality and automatic tagging during the rip process.
WAV format is also lossless and closest to the format used on a CD. Problem is files are bigger and tagging ability limited.
I started with .wav and moved to FLAC. With good quality software used to stream either should sound similarly good in the end. It did for me.
Good luck.