I always curious how could the computer able to play music, and how could one implemented an audio player, in a GUI app, or in a termial process like mpsyt.
Let's assume we already have an audio file (in
ogg,... format), and we want to build a program to read the file, play it on our computer's speakers, the process would be:
For decoding, there's a lot of decoders available so we can use, each format need a different decoder. More about this later.
To actually play these decoded data on the device, we need to communicate with the device via the OS's audio device interface. There are different interface depends on the OS you're using, for example:
There are some cross platform implementation to provide an easier to use API across platforms, one of which is Rust's cpal.
Welcome! Look like you've found my personal notebook. This is the place where you can take a peek into my mind to see what I've been…
If you think this note resonated, be it positive or negative, please feel free to send me an email and we can talk.