Analogue to digital conversion
If we have an analogue signal, we can convert it into a digital signal using a process called analogue to digital conversion - or ADC.
This basically converts an analogue signal into a digital signal by sampling the analogue signal at regular intervals. Because an analogue signal can take on infinitely many values, we can’t get an exact representation of the analogue signal, but we can get a close approximation as a digital wave.
See: digital sampling
That’s why, when you listen to music or speak into a microphone, the sound isn’t exactly the same as the original sound. That, as well as compression.