That can't be. Suppose the music file is larger then the memory?
That is actually a very good question. First of all, the CPU can only process data that is in memory. So everything that is going to be processed is ending up in Memory. That is how Operating System Kernels and Memory Management works.
For deeper details i recommend "Modern Operating Sytsems" from Andrew S. Tannenbaum. For an even deeper look, its "Design and Implementation of Modern Operating Systems" from the same person
But good question, what happens if the file is too big. Well that depends on a lot of factors. Android runs on an JVM on the Linux Kernel, so there are a lot of factors, memory management and garbage collecting involved.
I checked with smaller files, they get loaded into memory, but get scrapped from the memory pretty fast too but what does happen if a file is larger than the system memory.
The WM1ZM2 has 4GB of RAM so i created an 8 hour long white noise (which ended up being 3.7GB) which is too large for the RAM as the OS needs RAM too.
But no surprise here. It loads a small fraction of the file into the memory and if you skip to a position that is outside, it will have to load this part into memory to process it and unti its done, the song is like paused. The slower your storage, the longer the break you have to wait before music continues.
So my statement was over simplified. If the file is small enough and/or the memory big enough, it will be loaded completely into memory.
But this is still simplified as the memory is not just one thing. You have several types of memory. First you have the RAM, but then you have the L3, L2 and L1 caches of the CPU and the registers too. They have different sizes and speeds and are used different depending on CPU architecture. One possible solution is for example that L3 Cache is used for all cores in an CPU, while L2 cache is shared by two Integer Unit and one FPU (as you do less floating point calculations than integer) and the l1 cache is for an single Integer Unit.
The caches get smaller and smaller, but faster. For further reading i recommend Structured Computer Organisation, also from Andrew S. Tannenbaum.
But long story short --> Everything that gets touched by the CPU (which is everything that gets touched by any application) have to be in Memory but Memory Management is a whole world for itself. What storage you use before the memory is irrelevant as long as it is able to provide the data fast enough into memory where the CPU needs it. If your storage is not fast enough, you can either increase the storage speed or increase the memory size.
An average FLAC is 950kbps, so 118kbyte/s. So every SD Card that can transfer data faster than 118kbyte/s is sufficient (such slow SD Cards never existed. Even the slowest SD Cards easily handle 10+mbyte/s