Sunday, December 4, 2016

Explaining How Bass Boost in CMoyBB Works

Having JDS Labs CMoyBB DIY assembled, I decided to understand how the bass boost feature works, and also learn how to use CircuitLab for circuits simulation.

Below is the right channel amplification schematic from the original CMoyBB schematic with my annotations (the left channel works the same way):
There are 3 main stages in this pipeline:
  1. The input signal goes through the Volume Control which attenuates it if needed.
  2. The resulting signal goes through the operational amplifier (a.k.a. "op amp"--the triangle symbol) and gets amplified.
  3. The Bass Boost Filter, when enabled alters the frequency spectrum of the signal. Note that the filter is inserted into the negative feedback loop of the op amp (more on this later).
The output signal is collected from the output of the op amp.

Op Amp Circuit

For understanding how op amps work, I highly recommend watching the educational video on EEVblog:


After watching it, it's easy to understand that in CMoyBB, the op amp is used in non-inverting configuration and employs negative feedback. And it's also easy to calculate the amplifier gain when the bass boost is disabled:

A = Rf(eedback) / Rg(round) + 1

For CMoyBB, this becomes:

A = R4_R / R3_R + 1 = 10.2k / 2.05k + 1 = 5 + 1 = 6

Which means, the output voltage is 6 times the input voltage.

As for the purpose of the other components of the input chain--capacitor C2_R is used to block DC from the input signal. Resistor R2_R is used for limiting current that is routed to the ground (since current can't go into the op amp).

Bass Boost Filter

So far, we have covered the purpose of all the components on the input path and the amplification stage. Now let's consider how the bass boost works.

First of all, note that the bass boost can be switched off. The key components of the bass boost are CB_R capacitor and RB_R resistor. If we bypass them, the signal will remain unaltered. From this we can conclude that the labels on switch C are swapped--because when the switch is in the state labeled "ON", current will bypass CB_R and RB_R, thus it's actually "bass boost off" position. OK, not a big issue, since on the PCB it's labelled correctly.

For checking out how this filter actually works, I've replicated it in CircuitLab (here is the link):
Note that I've replaced the op amp with a sine wave generator. I've placed a virtual probe called "Filter" to the joint that was originally connected to the negative input pin of the op amp.

Then I ran frequency domain sweep simulation in CircuitLab, and here is what it looks like:
Note that it looks very much similar to my actual measurements of the bass boost feature frequency spectrum from the previous post:
The shape of the curve is the same, the delta in dBV between the peaks is almost the same (8 dBV actual, 9 dBV simulated), and the frequency where the effect os the filter is negligible is close to 1000 Hz in both cases.

The only difference is the "sign" of the curve--on the filter simulation we see attenuation of low frequencies, thus it's a high-pass shelf filter, while the CMoyBB amplifier actually amplifies low frequency signals more than high frequencies for achieving the bass boost effect. Why is the difference?

The answer is that the high-pass filter we see is inserted into the negative feedback loop of the op amp. Since the op amp tries to match the voltage on both inputs, "seeing" lower voltage for low frequencies due to the filter action causes it to raise the output voltage for them, resulting in a boost.

Active vs. Passive

After figuring out the principle of the bass boost in CMoyBB, I started wondering why the filter has been inserted into the feedback loop and not anywhere else. Obviously, it's also possible to put the filter before the op amp or after it. Note that in this case, we would need to use low-pass shelf filter as we would be altering the direct signal. But why the feedback loop insertion point has been chosen instead?

While researching this topic, I've found "Application Report SLOA042" by Texas Instruments which describes "Audio Tone Control Using The TLC074 Operational Amplifier". The report says that negative feedback tone controls were known since 1952 as Baxandall circuits, and that
An active filter design was chosen over a passive filter circuit because active filters have the frequency-response adjusting components located in the feedback loop of the filter amplifiers, providing much lower THD, little or no insertion loss, [...] compared with most passive designs.
Sounds like a good explanation to me!

Wednesday, November 23, 2016

JDS Labs CMoyBB DIY


As an exercise in soldering, I decided to make a CMoyBB from a DIY kit offered by JDS Labs. And I'm pretty much happy with the result! Not only the completed device can actually be used, but it also offers quite a good sound.

I tried using the amp both with a mobile phone and with a DAC (ObjectiveDAC also built by JDS Labs). I've found that with a DAC, since it outputs at line level, the resulting gain is quite high and isn't very comfortable with low-impedance headphones (I used Beyerdynamic T5p that have an impedance of 32 Ohms)--playing any pop music with compressed dynamic range required the volume on the amplifier to be set quite low. Though with a mobile phone as a source the resulting volume is acceptable.

CMoyBB also offers bass boost setting which I enjoyed when using it with AKG K240 headphones that are very neutral by design.

I was also interested whether my assembly has any flaws from electrical point of view. I couldn't detect any issues "by ear", so I decided to try to measure the device. I have a spare Creative / E-MU Tracker Pre sound interface which unfortunately only has outdated drivers that do not work with the latest versions of Mac OS and Windows. But it is happily supported by Linux. The only problem was to find any software for performing tests. After looking for RightMark equivalents, I've found LXsndtest. The app is a bit outdated, too--it relies on legacy OSS sound API, and only supports measurements in 16/48 resolution, but for my humble purpose this was fine.

First I set up a rig to test performance of the sound card itself--connected inputs to outputs directly using unbalanced TRS to RCA transformers. What I've learned is that sound input must be turned off in the system sound mixer, otherwise a feedback loop is created. Then I connected my CMoyBB and adjusted its volume level to match what I've had with loopback.

Below are frequency spectrum graphs for pink noise ("Noise" measurement mode of LXsndtest), on top is loopback, below is CMoyBB (with bass boost turned off):



Not a big difference! The response is pretty much the same. Left / right balance has become a bit worse--because the amp had to be set at moderately low level. While finding the right volume setting I've noticed that the balance becomes pretty much skewed at very low volume level of CMoyBB (that's normal for inexpensive headphone amps). Noise levels (bar graphs that LXsndtest displays under the spectrum graph) are pretty much the same, too.

I also tried "Distortion" mode of LXsndtest for 1 kHz sine wave signal, and didn't find much difference between loopback and CMoyBB as well (loopback results are on the left, CMoyBB is on the right):


The actual figures don't make much sense by itself--as I've already mentioned, LXsndtest only measures in 16-bit mode, and since Tracker Pre has analog input level controls, it's quite hard to adjust the signal level to use the entire 16-bit range. As one can see, I've only managed to achieve effective 13/14-bit signal level. But again, the main result is that there is no measurable difference with this kind of testing equipment.

What about the bass boost mode of CMoyBB? Definitely, we have a boost:


There is a +8 dB bump here (JDS labs spec says it's +9 dB), which results in more than a 2x perceptual bass volume increase.

The conclusion here is that CMoy headphone amp, and especially the JDS Labs version of it is a great DIY project for a beginner electronic hobbyist.

(JDS Labs is not a sponsor of this post and did not endorse it.)

Saturday, November 19, 2016

Headphone Dummy Load Power Calculations

After I've shown my Headphone Dummy Load post to Warren, he kindly noted that using 35W power resistors for this project is probably an overkill and suggested to do calculations on the power rating of the PCB I used.

I looked at Sparkfun's product page for board specs, but unfortunately there are none. So I downloaded board design files and opened them in Eagle. After examining the board layout, I've figured out that the trace width used on the board is 0.032". Using EEWeb online PCB trace max current calculator, I've obtained the following estimation:


Max current that this PCB can hold is 1A (I used 1 oz/ft2 as trace thickness as suggested on the PCB basics Sparkfun page).

What is a typical headphone signal current? I've conducted a little experiment playing a 1kHz sine wave through a Mayflower O2 headphone amp / DAC connected to my dummy headphone load set at 33 Ohm and obtained the following figures using a "True RMS" multimeter:

At "low gain" setting and volume set to maximum: 220 mV,  0.7 mA;
At "high gain" setting and volume set to maximum: 580 mV,  1.8 mA.

From P = I * V formula, it seems that a 35W resistor can withstand up to 35A at 1V. That's a lot more that I would ever need and 35 times more than the PCB itself can handle. I could just use a 3W resistors instead which cost less than $1 each instead of $5 that I paid for these power resistors. Good to know!

Sunday, November 13, 2016

My Take on Headphone Dummy Load


Following the idea of Headphone Dummy Load by Warren Young, I've made my take on implementing it. I noticed that Sparkfun's Mini Solderable Board fits neatly into Hammond box 1590A recommended by Warren, and decided to use it as a base for the assembly. Here is how the soldered board looks like:
Note that the breadboard has internal connections (two groups of vertical stripes), thus wires are only needed for connecting these two groups together and for making horizontal connections.

The wires of the load impedance switch are soldered to the board, while the input cable will be connected via the blue terminal. I think there is an advantage in using the terminal: first, one can change the cable without desoldering; and second, it's possible to attach probes of a multimeter to the screws of the terminal, which can be useful if the amplifier under test is not disassembled.

This is how I prepared the enclosure box for fitting the board assembly inside:
The mounting holes of the breadboard are isolated, but nevertheless I decided to use nylon screws for mounting it. Nuts not only hold the screws but also support the board in the air, preventing the contacts on the bottom of the board from touching the enclosure.

After mounting the board inside and screwing the resistors to the enclosure I ensured that the board sits very firmly. There wasn't even a need to put a second pair of nylon nuts on top of the board--the latter is held in place by the resistors:
I used Phobya NanoGrease Extreme thermal paste (leftover from other project) with the resistors.

Overall, this was an interesting and useful project, although not very cheap. But the box is definitely more compact that 2 pairs of headphones, and also the device should be more reliable in withstanding accidental high voltages or currents from amplifiers under test.

Below is almost complete list of Mouser parts I used:

Enclosure: Hammond 1590AGY (546-1590A-GY);
Rubber grommet: Heyco G1019 (836-G1019);
Breadboard: Sparkfun Mini PRT-12702 (474-PRT-12702);
33 Ohm resistors (pair): Ohmite TCH35P33R0JE (588-TCH35P-33E);
330 Ohm resistors (pair): Ohmite TCH35P330RJE (588-TCH35P-330E);
Switch: E-Switch 100DP3T1B1M1QEH (612-100-H1111);
3-pin terminal: Sparkfun PRT-08433 (474-PRT-08433);
4-40 screws (0.25" for resistors, 0.75" nylon for the board) and nuts.