Assuming you are asking about an Arduino Uno, the Arduino Uno is playing the sound and the project is not using a sound shield.
I was wondering if the first part, playing and looping the music on
the computer is possible
The standard sampling rate of telephony (usually consider the lowest quality mono audio) is 8KHz. The ATmega328 found on the Arduino Uno has 32 KB of memory. This means, if all this memory were available, it would only hold 4 seconds of sound. Of course you need some of this memory to hold programming. So the time you have for the recording would be less.
You might conceive of compression techniques that double or triple the length of the recording. But it is not likely you will be able to implement a complex decompression algorithm such as mp3.
This project uses milliseconds long sound samples and a looping technique to recreate the sound of a Scottish Chanter.
second part of controlling the volume with the light sensor
If a short recording is acceptable, most sound generating programs use one of the PWM ATmega328 pins. As the previously linked to Arduino project does. Usually the magnitude of the sample is written into the PWM duty cycle register. This makes the average voltage of the PWM output roughly similar to the magnitude of the stored value.
To control volume, divide this value by various numbers making it smaller before writing it to the PWM duty cycle register.
There are several common light sensor technologies available. I would recommend a photo resistor because they have a slow reaction time which has a tendency to remove noise. And are, in general, easier to use then, say, a photo diode.