3 ms·
I have been playing with making a player to learn a few audio decoding libraries. Using dr_flac, LAME, and nuklear for the gui I made a simple player. It turned
by gens 9y ago
I have been playing with making a player to learn a few audio decoding libraries. Using dr_flac, LAME, and nuklear for the gui I made a simple player. It turned out to be extremely efficient (cpu-wise, memory is the next step).
Nuklear, the gui part, I know to be extremely inefficient. Due to it not being called that much (refresh every 10ms, IIRC) it uses an insignificant amount of cpu time.
dr_flac and LAME are efficient enough, especially considering the work they do.
Note that LAME can do fixed-point, while dr_flac uses floats. This is very important when talking about power efficiency, as floats use much more power.
Sending the PCM data to the sound card (using ALSA) takes an insignificant amount of cpu time (memcpy to fill the buffer, that is ~172kB per second (44100 * 2 * 2 / 1024 ; 2 channels of 2byte samples at 44.1kHz)). Though ALSA (speex) resampling 44100Hz to 48000Hz does take a significant amount of cpu time (IMO best to resample while decoding).
On "modern" linux there is also Pulse Audio, that takes that resampling overhead from the program onto itself. Note that PA (idk if still) uses floats to resample, making it very inefficient.
Floats on modern x86/amd64 cpus are fast, as fast as integers (although float operations have a delay so it turns out slower). More important is that floats use much more power to compute. Another thing with power efficiency is that modern cpu cores go to sleep to save power, so one should not wake them up every milisecond to check on something.
As for the article;
>After downloading hundreds upon hundreds of kilobytes of zip file, fire up a shell, run mpg123, and wowzers. It plays MP3s smoothly and efficiently. A remarkable feat of engineering, especially considering it’s all written in plain old C without leveraging the synergies of dozens of frameworks. One wonders how they managed.
I want to say "no shit".. so... No shit. For multiple reasons.
>Time for an old standby? What’s Winamp up to these days? Oh, great, looks like more internet radio nonsense. And the website has the modern flat square design I’ve recognized as a harbinger of impending disaster. Sigh.
Winamp doesn't even get the chance because the website looks signals an "impending disaster" ?
- soundwave106 9y agoYeah, that was a strange remark. Winamp's website looks like it does because development on the program is kind of in a state of flux / suspension, with nothing happening since a few years ago when AOL sold Nullsoft and the latest version (5.666) was released. I find Winamp to be pretty efficient these days to be honest.