You could probably do that with a fast microcontroller these days. Some golden-eared audiophool pillock would complain they could hear jitter caused by the pins not being gold-plated or something, but who cares?
It's all about the Shannon Nyquist sampling theorum.
"Strictly speaking, the theorem only applies to a class of mathematical functions having a Fourier transform that is zero outside of a finite region of frequencies. Intuitively we expect that when one reduces a continuous function to a discrete sequence and interpolates back to a continuous function, the fidelity of the result depends on the density (or sample rate) of the original samples. The sampling theorem introduces the concept of a sample rate that is sufficient for perfect fidelity for the class of functions that are band-limited to a given bandwidth, such that no actual information is lost in the sampling process. It expresses the sufficient sample rate in terms of the bandwidth for the class of functions. The theorem also leads to a formula for perfectly reconstructing the original continuous-time function from the samples." [1]
But, HOLD ON: "Practical digital-to-analog converters produce neither scaled and delayed sinc functions, nor ideal Dirac pulses. Instead they produce a piecewise-constant sequence of scaled and delayed rectangular pulses (the zero-order hold), usually followed by a lowpass filter (called an "anti-imaging filter") to remove spurious high-frequency replicas (images) of the original baseband signal." [1]
In case that was too verbose.....
"sample rate that is sufficient for perfect fidelity".... "such that no actual information is lost in the sampling process"... "theorem also leads to a formula for perfectly reconstructing the original continuous-time function from the samples"
PERFECTLY!!! Zero information loss between sampling and reconstruction. Still WTFs me to this day.
So yeah, you can feed bits to a PWM. But that not music.
[1] https://en.m.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_samp...
It does not take a lot of computing power, but it does take a couple of opamps.
"By contrast, the waveform reconstruction process – digital-to-analogue conversion – is not so simple. In an ideal world it would be achieved by generating an impulse of appropriate amplitude for each sampling point and passing the train of regularly spaced impulses through an ideal low-pass filter with its passband upper edge set to half the sampling rate. The impulse response of such a filter is the sinc function, so each impulse would generate a sinc waveform of the necessary amplitude, and the train of sinc functions would sum to recreate the original waveform.
This is illustrated in Fig 2, which shows six successive sinc functions of different amplitude and their sum (the black trace). Each sinc function contributes nothing to the summed signal amplitude at other sampling points, but does contribute to the waveform between the sampling points. It’s a common misunderstanding of sampling to suppose that the waveform between sampling points is unknowable but that is not true – provided that the input signal is bandlimited and sampled at least twice as fast as its highest component frequency, as required by the Shannon sampling process. In that case the waveform between sampling points can be reconstructed unambiguously. Importantly, the wave shape depends not just on the value of nearby samples but, ultimately, on the pattern of samples throughout the sampled signal" [1]
[1] https://drive.google.com/open?id=1QhJo_Rh8sQsItFvJ1g-MnNlg9p...
Or click the link here: https://chordelectronics.co.uk/explained-rob-watts-filter-te...
The good class D amplifiers are closed-loop control systems. They don’t just create a output a fixed sequence of highs and lows for a given piece of music — they determine when to switch based on some combination of the input signal, the observed output voltage and current, and various state variables (for example, for protection). And they operate at frequencies of several megahertz, possibly with rather high precision pulse widths needed.
So one could do this with an ADC, a microcontroller, and a single output bit, but it would need to run the ADC at quite high frequency and possibly have multiple input channels (for current and voltage). This sounds expensive.
A TPA3255 costs $12.50 (qty 1 from Digikey). Add a dollar or two a nice DAC. I don’t think a 20-bit ADC, a DSP running at a couple hundred MHz, and most of the same driver and power circuitry that’s already in the TPA3255 would come out at the same price.
edit: My mistake. When I first read your post I thought you said there were quite few as opposed to quite a few good designs, hence the recommendation.
I think you’ll have more success focusing on them as separate components as the power amp will always be in the analog domain
A good amplifier has better than 100 dB SNR. Your ear may have better than 100 dB dynamic range. Your sound system may have a bit less useful range, since your goal isn’t actual to destroy your ears. But 100 dB is a vaguely credible target.
So somehow you’re supposed to get a preamp and an amp, and you’re supposed to connect them, usually with RCA (unbalanced) cables. You’re supposed to get both devices to agree as to what voltage is full scale. And you’re supposed to get a noise floor, on the interconnect, better than -100dBFS. And you are supposed to do this with at least two separate cables plus whatever ground (or neutral) connections exist to both chassis, and this is all done near 60Hz currents that induce a voltage around every loop in question.
This is a tall order. At least the pros use balanced connections.
Or the industry could move to digital interconnects, where the DAC and the amp are connected by short traces on a PCB with a proper ground plane. And full scale on the DAC could be matched to the amp’s input.
But, IMO quite annoyingly, these things generally have analog inputs. This means you need a good DAC (which exists and isn’t terribly expensive) and a good connection from the DAC to the amp. You can make a good connection out of inexpensive cables, but you still need to worry about ground loops and possibly signal levels.
So why aren’t there comparably good amplifiers with digital inputs and a DAC integrated directly? Fancy preamp features are unnecessary — if the input resolution is 24-bit, then volume control and such can be done digitally with effectively no loss.