How to mis-represent your data OR Why I hate spider plots.

Introduction

Before I start my little rant, let’s do some basic grade-school geometry.

The area of a rectangle is equal to its length multiplied by its width. For example, if you have rectangle with sides of lengths 2 cm and 4 cm, then its area is 8 square centimeters (2 * 4 = 8). This means that if you have a square, then its area is the length of its side squared. For example, if you have a square with sides of a length 3 m, then its area is 9 square metres (3 * 3 = 3^2 = 9). In other words, for rectangles,
A = L * W
where A is Area, L is Length and W is Width. The only thing that makes a square special is that L = W.

The area of a circle is equal to π multiplied by its radius (the distance from the centre of the circle to its edge) squared. In other words, A = π * r^2 (say “pie are squared”) where A is area, π is roughly equal to 3.14 and r is the radius. So, if you have a circle with a radius of 4 mm then its area is approximately 28.27 square millimeters.

In the case of the square and the circle, if you double the width (or diameter, or radius), you quadruple the area. If you increase the width by a factor of 3, you increase the area by a factor of 9 (3 x 3). Stated generally, the area is proportional to the square of the width.

Representing your data with a bar graph

Now, let’s pretend that we have some data to show to people. We’ll start with something simple – we’ll display the total annual sales of widgets over 3 years. Let’s say that, in the first year, you sold 10 widgets; 20 widgets the second year and 30 widgets the third year. Your competitor, by comparison, only sold 10 widgets in each of the three years.

How do we plot these data? Of course, there are lots of ways, but one way that makes sense is to use a bar graph. A bar graph shows a single bar for each value (in our case, widget sales in each year), side by side, where all of the bars have the same width. The value is represented by the height of the bar. An example of a bar graph of our widget sales is shown below.

simple_linear_bar

For the purposes of my little rant, there’s something important in that last paragraph. I said that the height of the bars shows the data, but the width of all of the bars are the same. This means that the data are not only shown by the heights of the bars, but also their areas.

Mis-representing your data with a weird bar graph

What if we were to get creative and say that the data are not only represented by the height of the bars, but also their widths? On the one hand, you could make the argument that this is fair, since you could look at either the relative heights OR the widths to see the data comparions. However, if you take a look at the example shown below where I’ve plotted such a graph, you’ll see that this might not be a fair representation. Why not? Well, if your eyes are like my eyes, you don’t see the heights of the bars, you see the areas of the bars. And, since I’ve doubled the height and the width of the bar with double the value, the area is 4 times. In other words, I’m exaggerating the difference in the values by doing this (to be precise, I’m squaring the difference).

simple_area_bar

But I hear you cry, “Of course no one would ever do this! I’ve never see such a plot! Or, at least, I can’t make one in Excel…(although I can in Tableau…)” Read on!

Getting to the point… bit by bit

Let’s say that we did some kind of test where we want to represent a bunch of data points for various categories. For example, a listening test comparing four loudspeakers, where each loudspeaker was rated on 15 attributes. We’ll assume for the purposes of this discussion that the test was designed and conducted correctly, and that we can trust the data. We’ll also assume that the test subjects that produced the data (our listening panel) are experts and can rate things perfectly linearly. In other words, for a given attribute, if the listening panel says that one loudspeaker gets a score of 30 and the other one gets a score of 60, then the second one is twice as good as the former. We’ll also say that, for the purposes of this test, each attribute was scored on a range from 0 to 100. Finally, we’ll assume (for the purposes of keeping this discussion clear) that a higher score for any attribute means “better”.

So, we did our test and we got some strange results. (Note that these data are not from a real listening test. I made up everything to illustrate my point.) One loudspeaker got a score of 100 (out of 100) on every attribute. Another loudspeaker got a score of 50 on every attribute. The other two loudspeakers were a little more realistic (but still faked, don’t forget…)

stupid_bar

So, as you can see in the above bar graph, one loudspeaker got a score that was only half as good as the other in all categories. This is easily seen in the bar graph. If you squint just right, you can also imagine two rectangles, one big black one and one big red one. Since those two rectangles have the same width, their areas also represent the data accurately.

But, what would happen if we plotted exactly the same data using a spider plot? That would look like the figure below.

stupid_spider

Notice that the same data is plotted as before, but the message your eyes see is slightly different. You see the black circle and how it compares to the red circle. Since the red circle has twice the radius of the black circle, it has four times the area. If you’re like me, you see the comparison of the areas of the circles – not their radii. So, if you don’t force your brain to do a little sqare-rooting on the fly, the plot appears to say that the second loudspeaker is four times better overall, which is not what the data says. This is basically where I’m headed…

Now let’s look at the “results” for the other two loudspeakers, whose data was a little more varied. These are displayed in the bar graph and spider plots below.

big_bar
spider

This time, at first glance, things look a little more “normal” but look carefully, particularly at the results for categories 9 and 10. The same problem (of a spider plot showing the square of the results) happens again here. The big area between the red points and the black points for 9 and 10 exaggerates the difference in the actual data, which are better displayed in the bar graph. One way to think of this is that the “slice of the pie” gets bigger in area as you go further out  from the centre of the circle. The figure below shows the way my brain interprets the plot.

spider_area

Of course, if the data were for the same for all attributes for both speakers except for one attribute where one loudspeaker got a score of 100 and the other got a 50 (so you would just see a spike at one angle on the plot), then the spider plot would come very close to representing the data correctly. But this is because, with those weird collection of numbers, you come close to eliminating area in the plot – and it just becomes what most people call a “compass plot” which is something different.

The conclusion

As the title says, my conclusion is that a spider plot mis-represents differences in data because they show us something that it more like the square of the difference rather than the difference itself. To be fair, its representation approaches the square of the difference as all of the values for a given product become more equal (as I showed in the first spider plot with the two circles, above).

Personally, I prefer to have graphs that show me the results – not a weird scaling of the results – which is why I hate looking at spider plots.

Mostly, however, it’s because I’m too lazy to do square roots in my head.

What I learned from Facebook this month. Or: Computers are for boys, vacuum cleaners are for girls.

Last week was interesting to say the least.

My wife made a posting on Bilka’s (a Danish big-box store) Facebook site complaining that they had a display where Boys’ Toys and Girls’ Toys were displayed – computers and cars for the boys, vacuum cleaners and play dish sets for the girls. (see here for the original posting). The original photo is below.

Screen Shot 2013-03-24 at 12.24.36 PM

Her comment on the site was two-fold. Firstly, that there was no need to display segregated toys, categorising them specifically for girls or boys. The second, more important issue was the message that computers are for boys and vacuum cleaners are for girls.

Her complaint makes sense to me. It certainly doesn’t take a degree in developmental psychology to realise that children learn from the world around them. And when, from a very early age, the world says “this is for you, and that is not”, you have some serious imprinting to overcome if you want to disagree. I work in what is best classified as an engineering department, and women are few and far between in the building I work in. Why is that? Is it because girls and women are not good at math by nature, or is it because they are taught from a very early age (even in a modern, first-world society) that computers are not for them? Personally, I am more likely to believe that it’s the latter – that gender roles are learned in childhood during playtime. It seems that I might not be alone in this opinion.

Personally, I would much rather see our sons playing with dolls and kitchen sets than shooting each other with toy guns. They’ll be better prepared for adulthood if they pretend to bake than kill. And I can’t understand why Lego has to make pink and purple “Friends” sets to appeal to “the other 50 percent of the world’s children.”

However, what was truly amazing was the response that ensued from other people on the Facebook page. These responses can be divided into five basic categories, which I’ve listed below with examples.:

 Typical Response #1: Relax! – i.e. “Hold nu op…. find noget vigtigere at gå op i…. suk” (trans: “Come on… Find something more important to get upset about. Sigh.”)

Typical Response #2: I don’t get it. i.e. “Undskyld men hvad er problemet her?” (trans: “Sorry, but what is the problem here?”)

Typical Response #3: Heading not required. i.e. “Hahahahahahahahahaha!!!” (trans: “Hahahahahahahahahaha!!!”)

Typical Response #4: I’m a raving misogynist who still lives in the 1950’s. i.e. “Kvinder og teknik er som pindsvin og trafik! Hold jer til støvsugeren.” (trans: “Women and technical things are like hedgehogs and traffic! Stick with your vacuum cleaner.”) or “Går også ind for ligestilling bare i kvinder bliver ind i køkkenet og holder kæft ha ha” (trans: “I’m also for equality as long as women stay in the kitchen and shut up ha ha”)

Typical Response #5: I agree! i.e. “Rigtig god pointe! Cassia. Bilka, for pokker! Vi skriver 2013 – ikke 1953!!!” (trans: “Really good point, Cassia. For goodness’ sake, Bilka! This is 2013, not 1953!!! “)

The Typical Response #1 group may be considered to have a point. In a world where people are dying of hunger and war, a toy display in a big box store in Denmark is not the most pressing matter on the face of the earth. Fair enough. However, that doesn’t necessarily mean that it’s not a problem that should not be addressed. Also, it doesn’t take much to either NOT put signs up that say “These are for boys” and “These are for girls” (in fact, it’s cheaper for the store to not put up the signs). Or, if you really think that the signs should be there (one line of reasoning was that the labelling was beneficial for grandparents who are shopping for presents), then just distribute the toys with some sense of equality – put a computer on the girls’ shelf as well.

The Typical Response #2 group was comprised primarily of men, although there were some women there as well. They were also in the “it’s helpful for grandparents” camp (just how dumb are grandparents in Denmark, anyway?). The typical argument here was “but boys and girls are different – the store is just putting on a display that reflects society” or “the kids can’t read, so what difference does it make?” or “I don’t buy what the store tells me to buy – I buy what I want”. It’s interesting that none of these people can see that there might be an impact on children by sending the message that boys and girls should play with different toys.

Personally, I think that the Typical Response #3 group can be ignored. For many (me included) Facebook is pure fluff – everything in there is as intellectually challenging as a video of cats. Certainly, if I didn’t have children, I would probably have been in this group as well.

Now we come to Typical Response #4. This astonished me. The number of responses that, with the help of threats of violence and expletives, said “shut your face you b!#¢h and mind your own f&¢%!@g business” (no, I’m not exaggerating) was worrisome. Part of me is sad that the store decided to remove these postings. I understand why they did it, since they have a policy of editing hateful messages on their Facebook page. However,  the quantity and content of these postings revealed that equal rights for women isn’t held in ubiquitous regard – even in a very socially-egalitarian country like Denmark. I’m sad that these postings are not still on display so that the rest of the population can be made aware of an ugly side of the society.

Finally, the Typical Response #5 – which is what we expected to the the overwhelming  response – was rather underwhelming. Yes, there were supporters – and these numbers grew in response as the more abusive comments started coming in. However, I think that these people were more prone to just hit the “Like” button and not leave a comment, which left the comments generally presenting the opposing opinion.

Finally, there were some people who got the message, loud and clear

“Når man som jeg underviser i datalogi og har et hold med 103 mandlige studerende og 2 kvinder, er det ikke så positivt at se budskabet “computere er for drenge” på legetøjsplan.” (trans: “When I teach computer science and I see a class with 103 males students and two women, it isn’t so encouraging to see the message ‘computers are for boys’ in the toy display.”) This was exactly the point in the first place – and it was reassuring to see that someone out there got it.

The wrap-up of the story is that the Dansk Kvindesamfund (Danish Women’s Society) picked up the posting and rallied people to bombard the store’s Facebook page with complaints asking to remove the gender segregation of toys. Eventually, 4 days after the original posting was made, the store changed its policy, country-wide and will no longer present toys with a gender bias.

It is worth noting that, in Norway, gender bias in toy advertisements is illegal. In Sweden, it is also normal to see gender-neutral toy advertisements as you can see in this flyer for Toys R Us. Nice to see a girl with the gun and boys playing with dolls and the stove for a change. What should not be odd is how strange it looks.

Why is it that we cannot see how we teach our children antiquated gender roles from a  very early age? Colin Stokes makes an interesting point in his TED talk about how the movies our children watch regularly teach them that life rarely contains more than one female – and that, when there are two or more girls in the same place at the same time, the only thing that they talk about are boys. Some people are protesting, but too few, I think.

 

Some additional sites about this

If you can read Danish, or understand the output from Google Translate:

Article in bt.dk – where, interestingly, the headline reads “Bilka bends to angry feminists” – an interesting spin on categorisation of the complainant…

Debate on Politiken.dk

 

 

Any port in a storm?

So, you want to build a loudspeaker…

One of the questions you’ll probably be asking yourself is whether you want to build a ported loudspeaker (sometimes called a “bass reflex” loudspeaker) or one with a sealed enclosure. If you want to know the general reasons why most people think that you should choose one or the other, go somewhere else for information – or maybe come back here later (maybe I’ll talk about it in a later posting).

For this posting, I want to look at a couple of things that I haven’t seen elsewhere – mostly because it helps me to understand the difference between ported and sealed loudspeaker enclosures a little better.

Let’s take a loudspeaker driver and put it in a box. For the purposes of this discussion, we’ll simulate a 10″ driver with mostly-real Thiele-Small parameters in a simulated sealed box. The box has a volume, but we’ll leave out any possible internal modes to keep things simple for now. We’ll also ignore additional effects such as diffraction – we’re just looking at the how the enclosure’s volume and the port dimensions affect the response of the system.

If we sweep a sine wave into the driver, keeping the voltage constant, and we measure the sound pressure level in front of the driver, we’ll see that the total system (the loudspeaker in a sealed box) acts as a minimum phase, second-order high pass filter. Therefore it has a rising slope of 12 dB/octave in the low end. The Q of that high-pass filter will be dependent on the relationship of the driver’s parameters and the size of the box.

Magnitude responses of a loudspeaker driver in a sealed cabinet. Each curve is for a different cabinet volume.

In the plots above, you can see the results on the magnitude response of changing the enclosure volume. The blue curve on the far left is the response you’d get from putting the driver in an infinite baffle (actually, I simulated an enclosure of about a cubic kilometre or so… So not quite infinite, but pretty big for a woofer cabinet…). Notice that it has the highest output at the lowest frequency, but you don’t get as much output around the knee as you do with the other curves. As the enclosure volume is made smaller (The green curve is 1000 litres, and each curve after that, moving left to right, is for a volume of one-half the previous one, so, 500 l, 250 l, 125 l, 62.5 l, 31.25 l, and 15.625 l. Remember – the driver that we’re simulating here isn’t real, so don’t worry about the actual volumes – we’re just worried about the differences in magnitude response as the volumes get smaller.)

You can see in the plots that, by making the volume behind the driver smaller, we do a couple of things at the same time.

  1. One is that, the smaller the enclosure, the higher the cutoff frequency of the resulting high pass filter. This is because the “spring” supplied by the air in the enclosure gets stiffer (or less compliant) as the box gets smaller, so it rings at a higher frequency.
  2. Secondly, you’ll notice that the Q of the high pass filter increases as the enclosure gets smaller. This is because the damping factor of the total system (which is, in turn inversely related to the Q – the lower the damping, the higher the Q) decreases as the spring gets stiffer ( and the compliance goes down), if neither the mass nor the losses in the system change.

Both of these are basically the same as having a series RLC circuit and decreasing the capacitor value. The resonant frequency will go up, and the damping factor will go down.

Now, what happens if we wanted to build a ported loudspeaker instead? For now, let’s just use the same loudspeaker driver, a 1000 litre enclosure and we’ll add a port. We’re keeping it simple, so we will just add the port as a pipe sitting outside the enclosure so it doesn’t take away from the enclosure’s volume. Also we will not include the port’s volume as part of the enclosure volume. Also, because this isn’t the real world, we’ll make the port’s output in the same physical location as the loudspeaker driver to avoid any problems with propagation delay and interference at the microphone location.

Magnitude responses of a loudspeaker driver in a ported enclosure. Each curve is for a different port length.

The above plots show the result of this imaginary ported box with different port lengths, keeping all other parameters constant. I’ve made the losses in the port low so that the port has a bigger contribution to the total magnitude response, and therefore is easier to see. Remember – we’re not simulating the real world – we’re intentionally making the simulation produce curves that show patterns to better understand what’s going on. The ports that I’ve simulated are 10 cm in diameter, and have a length of (again from left-to-right) 1.6 m, 800 cm, 400 cm, 200 cm, 100 cm, 50 cm, 25 cm, and 12.5 cm.

What can we see in these plots?

  1. Firstly, you can see that the slope of the high pass filter is now steeper than it was with the closed cabinet. This is because a ported loudspeaker enclosure results in a fourth-order high-pass system, so we have a slope of 24 dB/octave. This means that, in the very low end, we have a LOT less output from the ported system than the sealed system.
  2. Secondly, you can see that, in this case, changing the port length has an puts a bump in the output’s magnitude response around a frequency that is dependent on the port length. The longer the port, the lower the centre frequency of the bump. This isn’t a surprise, since making the port longer lowers the resonant frequency of the Helmholtz resonator. In real life, the bump probably wouldn’t be as prominent – I made it obvious by simulating a port with very low losses (Those losses are the result of things like turbulence around the ends of the port and friction where the air “plug” in the port is rubbing against the sides of the port and the energy is converted to heat.)
  3. Thirdly, you will see that the cutoff frequency of the system doesn’t change as much as it did when I was changing the volume of the sealed enclosure.

So, how do these systems compare? You’ll often hear people say “I chose to make a bass reflex loudspeaker so that I would get more bass out of the system.” The question is, does this sentence make sense? Is this really a good reason to choose a ported enclosure over a sealed one when you’re building a loudspeaker? Let’s look at what magical wonders adding a port had brought to our pretend loudspeaker…

The difference in the magnitude responses of a loudspeaker driver in a ported vs. a sealed enclosure (where all loudspeaker cabinets have the same volume). Each curve is for a different port length and the colours correspond to the previous plot. Positive values mean that the ported system is louder than the sealed system. Negative values mean the opposite.

The above plots show the difference in the output of the systems, showing the relative outputs of the ported systems (the colours are arranged to be the same as the ones in the previous plot so you know which port is which length) compared with the same enclosure without a port (in other words, the green curve from the top plot). Basically, all I’ve done here is subtracted the green curve from the top plot from all the curves in the second plot. If the result is 0 dB (as it is in the high frequency region for all of the curves, then this means that the two systems have the same output. If the value for a given frequency is positive, then this means that the ported system is louder than the sealed system. If the value is negative, then it means that the ported system is quieter by that amount.

As can be seen in that plot, there is a frequency region for all ported systems where you get more output for the same voltage. In the high end, both systems give the same output (because that’s so far above the port resonance that it’s basically not a part of the system, so they both behave the same way). In the low end, the ported system gives much less output because it’s a 4th-order high pass instead of a 2nd-order high pass like the sealed enclosure system.

So far, we can see that a ported system does appear to give you more bass for the same input voltage, assuming that you’ve tuned the port to give you more output in a band that you call bass – however, below that band, you get less. So you might be “robbing Peter to pay Paul” – which might not necessarily be a good idea.

Some people (who might know a little more about what they’re talking about than the last people I mentioned) say “I’m going to build a bass reflex loudspeaker instead of a sealed system to reduce distortion in the driver at the port resonance.” Now why on earth would they say that? Well, a little more digging (not much more digging, admittedly) will turn up an extra little piece of information: the driver moves less at frequencies around the port resonance. For example, at the resonant frequency of the port, the Helmholtz resonator acts against the driver, pushing it out when it tries to move in and pulling it in when it tries to move out. As a result, the excursion of the driver drops. In an extreme (non-real-world) case, if there are no losses in the port or the enclosure, then the driver’s excursion would be 0 at the port resonance. The greater the losses, the less this will be true.

So, let’s check out our two systems again, this time, looking at the driver excursion (peak excursion, to be precise) by frequency.

The peak excursion of the loudspeaker driver in a sealed cabinet. The different curves are for different cabinet volumes and correspond to the first plot.

The above plot shows the peak excursion of the driver in the sealed cabinet. The colours correspond directly to the curves in the first plot at the top of the posting so that you can see the kind of magnitude response you get for the excursion. As you can see, in all cases, the excursion of the driver in the high frequency region is nearly 0 mm – the higher we get, the closer we get to 0 mm. You can also see that, in the low end, the excursion levels out. The more level the excursion plot, the closer the slope of the magnitude response is to a “perfect” 12 dB/octave. This is because the sounds pressure only comes from the air moved by the driver, and because the sound pressure level is proportional to the acceleration of the driver. As the frequency drops and the excursion stays the same, the acceleration drops by 12 dB per halving of frequency because it’s the derivative of the velocity which drops by 6 dB per halving of frequency, because it’s the derivative of the excursion in time.

Of course, if your driver can’t handle the excursions we see here (for example, the one I’m using for this simulation can only move 8 mm before it starts to get unhappy) then you might have something to worry about here. How you deal with that problem, however, is your problem.

So, what would the excursion look like for the same driver in a ported cabinet? Let’s have a look!

The peak excursion of the loudspeaker driver in a ported cabinet. The different curves are for different port lengths and correspond to the second plot.

The plot shown above has the peak excursion curves for the same driver in the ported cabinet for the port lengths listed high above… As you can see, starting at the top end, the excursion of the driver is nearly 0 mm, just as in the case of the sealed cabinet. As the frequency drops, the excursion starts to increase. However, then something weird happens. Going lower in frequency, we can see that the driver excursion levels out and starts to drop, with a minimum value at the resonance of the port. If you’re very attentive, you’ll notice that this frequency isn’t exactly the same as the frequency of the bump in the total system’s magnitude response. That’s not a big surprise, since there is some other frequency (in this weird, non-real-life system) where the summed outputs of the driver and port give you more output than they do at the port resonance (actual results may vary). Anyway, going below the port resonance, you can see that the excursion of the driver really takes off and becomes much greater than it was with the sealed system. That’s because there’s nothing there to stop it. At frequencies that are much lower than the port resonance, the system behaves as if the driver wasn’t in a box at all, so it’s free to move as far as it wants to go. (remember that our non-real-life system isn’t limited by things like the maximum excursion of the suspension… The values in the plot show the excursion that the driver “wants” to hit – it’s just held back by real life.)

So, you may be asking yourself a question at this point: “Why is it that, at very low frequencies, the driver’s excursion is much higher in the ported system than in the sealed system, but you get less output?” Good question! The reason is that, at frequencies far below port resonance, you get almost as much output from the port as the driver. The only problem is that the port is just delivering the pressure at the back of the driver to the outside world. So, when the front of the driver goes positive, the back of the driver (and therefore the port) goes negative, and the two cancel each other at the listening position. Putting the port opening at the back of the loudspeaker won’t help much. It will just make the propagation distance a little longer, therefore a little later, but they’ll still cancel each other. This is why the total output of the ported system drops faster as you go lower in frequency – the lower you go, the more the driver and the port cancel each other. They’re both working really hard (and therefore, so is your amplifier), but you get next-to-nothing.

However, let’s back up a bit. There is that issue of the lower driver excursion around the port resonance. This is true. So, if you have a loudspeaker driver that doesn’t like excursion (maybe, say, it distorts when it moves to far) in a particular frequency band, then maybe a port could alleviate the problem. However, beware of frequencies below! Danger danger! (In other words, you might want to put a high pass filter in your system to keep things running smoothly below the port resonance…)

The difference in the peak excursion of a loudspeaker driver in a ported vs. a sealed enclosure (where all loudspeaker cabinets have the same volume). Each curve is for a different port length and the colours correspond to the previous plot. Positive values mean that the loudspeaker driver in the ported system moves further than that in the sealed system. Negative values mean the opposite.

A couple of plots ago, we did some subtraction to compare the magnitude responses of the ported systems to a sealed system. Let’s do the same for the excursion plots. The above figure shows the difference between the peak excursion of the driver in the ported systems, and that of the driver in a sealed enclosure of the same volume. Negative values mean that the ported cabinet driver moves less than the sealed cabinet one. Positive values mean that the ported cabinet driver moves further than the sealed cabinet one.

As you can see in those curves, in the high frequencies, the driver will have the same excursion in both cases. Secondly, there is some region in all cases where the driver moves less in a ported system than in a sealed cabinet of the same volume. At low frequencies, the ported cabinet driver moves further than the sealed cabinet equivalent (yet has less total output, remember!). An interesting detail to note here is to look carefully at this plot with the magnitude difference plot. For example, take a look at the left-most blue curve. The ported system driver has a lower (or equal) excursion than the sealed system driver from about 6.5 Hz and up. Looking at the magnitude response difference curve for the same system, we can see that we get about 6 or 7 dB more output from the ported system at 6.5 Hz, with less and less benefit as we go higher in frequency. Below 6.5 Hz, although we get more output from the ported system for about an octave, it comes at the cost of a much greater excursion, which would probably not be good for our driver.

So what?

Okay, let’s be honest here. I’ve made two very simulated systems, and only changed one variable in each system to see what happens. And, I can absolutely guarantee that (1) no loudspeaker driver in the world has the parameters of the one I’ve simulated and (2) if you built the system I’ve simulated, it wouldn’t behave as I’ve shown here. This is a very isolated, idealised simulation, intentionally designed to make the changes I was making obvious. However, the issues that I’ve made obvious are basically true – I’ve just done a little exaggeration…

What’s the moral of the story? Well, I’m not really sure of all of them. One moral is certainly “sticking a port on a loudspeaker enclosure is not a free ticket to more bass”. Another moral is “people who use ports to reduce driver excursion might not know what they’re talking about”. Probably the most important moral is “don’t trust everything you read” – even the stuff you read here.

Post Script

If you REALLY want to learn this stuff correctly, go read the following:

Closed Box Loudspeaker Systems – Part 1: Analysis

Closed Box Loudspeaker Systems – Part 2: Synthesis

Vented Box Loudspeaker Systems – Part 1: Small Signal Analysis

Vented Box Loudspeaker Systems – Part 2: Large Signal Analysis

Vented Box Loudspeaker Systems – Part 3: Synthesis

Vented Box Loudspeaker Systems – Part 4: Appendices

When you’re done with those, please explain them to me.

It’s impossible to build a good loudspeaker. Part 1: Crossovers

So, you want to build a loudspeaker…

One of the first things you’ll find out is that, if you’re building a loudspeaker with moving coil drivers, and unless you want a loudspeaker with very limited capabilities, you’ll probably need to use more than one driver. Starting small, you’ll at least need a bigger driver to produce the lower frequencies and a smaller driver to produce the higher ones. No surprise so far – many people lead meaningful lives with just a tweeter and a woofer.

However, you’ll probably need to ensure that the tweeter doesn’t get too much signal at low frequencies, and the woofer doesn’t get too many highs. In order to do this, you’ll need a crossover. Still no surprises. Most people who build a loudspeaker already know that they’ll need a crossover to keep their drivers happier.

Now for some new stuff – at least for some people. When you make a crossover, you must remember to keep the driver’s characteristics in mind. You can’t just slap a high pass filter on the tweeter and a low pass filter on the woofer and expect things to work. The tweeter is already behaving as a high pass filter all by itself. If the characteristics of the tweeter’s inherent high pass are what you want, then you don’t want to duplicate that filter in the electronics. So, design your filters wisely. I will probably come back to some examples of this some time in a future posting.

However, that is not the topic for today. For today, we will assume that we are building a loudspeaker using two very special drivers. They are:

  1. infinitely small
  2. have bandwidths that go from DC to infinity
  3. have “perfect” impulse responses
  4. and therefore have completely flat phase responses

In other words, we will pretend that each of our drivers is a perfect point source. We’ll also assume that they are not mounted on a baffle (a fancy way of saying “on the front of a box” – usually…). Instead, they’re just floating in space, arbitrarily 25 cm apart (one directly above the other). We’ll arbitrarily make the crossover frequency 500 Hz. Finally, let’s say that we’re arbitrarily 2 m away from the loudspeaker.

The reason for all of these assumptions is that, for the purposes of this posting, we’re only interested in the effects of the crossover on the signal, so I’m making everything else in the system either perfect or non-existent. Of course, this has nothing to do with the real world, but I don’t really care today.

So, if you’ve done a little research, you’ll know that there are a plethora of options to chose from when it comes to crossovers. I’ll assume that we’re building an active loudspeaker with a DSP so we can do whatever we want.

Linkwitz Riley, 4th Order

Let’s start with Old Faithful: a 4th-order Linkwitz-Riley crossover. This is implemented by putting two 12 dB/oct Butterworth filters in series, each with a cutoff frequency equal to the intended crossover frequency. (If you’re using biquads, set your Q to 1/sqrt(2) on each filter). The total low pass section will have a gain of -6.02 dB at the crossover frequency (so will the total high pass section). Since the two sections are 360° out of phase with each other at all frequencies, they’ll add up to give you a total of 0 dB when they sum together at any frequency. However, you must remember that the filter sections used in the crossover have an effect on the phase response of the re-combined signal. As a result, when the two are added back together (at the listening position) the total will also have a modified phase response – even when you are on-axis to the loudspeakers, (and equidistant to the two loudspeaker drivers).

It is also important to remember that the phase relationship of the two sections (coming from the tweeter and the woofer) is only correct when those two drivers are the same distance from the listener. If the tweeter is a little closer to you (say, because the tweeter is on top and you stood up) then its signal will arrive too early relative to the woofer’s and the phase relationship of the two signals will be screwed up, resulting in an incorrect summing of the two signals.

How much the total is screwed up depends on a bunch of factors including

  1. the relative phase responses of the filters in the crossover
  2. the phase responses of the drivers (we’re assuming for this posting that this is not an issue, remember?)
  3. the deviation in those phase responses caused by the mis-alignment of distances to the drivers

The result of this is a deviation in the vertical off-axis response of the loudspeaker. How bad is this? Let’s look!

This figure shows 4 plots. The top one shows the magnitude responses of the two individual sections. As you can see, the crossover frequency is 1 kHz, and both sections are 6 dB down at that frequency.

The second plot shows the total magnitude responses at 5 different vertical angles of incidence to the loudspeaker: -30°, -15°, 0°, 15°, and 30°. So, we’re going from below the loudspeaker to above the loudspeaker. It’s not obvious which plot is for which angle because, for the purposes of this discussion, it doesn’t matter. I’m only interested in talking about how different the loudspeaker sounds at different angles – not the specifics of how it sounds different.

The third plot shows the total phase response of the system, at a position that is on axis to the loudspeaker (and therefore equidistant to both drivers). As you can see there, a perfect 2-way loudspeaker with a 4th order Linkwitz-Riley crossover behaves as a 4th-order allpass filter. In other words, at low frequencies, the output is in phase with the input. At the crossover frequency, the output is 180° out of phase with the input. At high frequencies, the output is 360° out of phase with the input.

The fourth plot shows the step response of the total system, at a position that is on axis to the loudspeaker (and therefore equidistant to both drivers). As you can see there, a perfect 2-way loudspeaker with a 4th order Linkwitz-Riley crossover does not give you a “perfect” step response – it can’t, since it acts an allpass filter. The weird shape you see there is cause by the fact that the high frequencies are not “in phase” with the low frequencies. (I know, I know… different frequencies cannot be “in phase”.) Since different frequencies are delayed differently by the total system, they do not add up correctly in the time domain. Thus, although the total output in terms of magnitude is flat (hence the flat on-axis frrequency response) the time response will be weird.

Looking in detail at the step response plot, you can see that it takes about 1.5 ms for the total output to settle to a value of 1. The actual time that it takes is dependent on the crossover frequency. The lower the frequency, the longer it will take. It’s the shape of the step response that’s determined by the crossover’s phase response. What can be seen from the shape is that the high-frequency spike hits first (as we would expect), then the step response drops back to a negative value before heading upwards. It overshoots, peaking at a value of 1.0558 before coming back down, undershooting slightly (to a value of 0.9976)  and finally settling at a value of 1. Note that these values won’t change with changes in crossover frequency – they’ll just happen at a different time. The higher the frequency, the faster the response.

Whether or not this modified time response is worth worrying about (i.e. can you hear it) is also outside of the scope of today’s discussion. All we’re going to say for today is that this temporal distortion exists, and it is different for different crossover strategies as we’ll see below.

Linkwitz-Riley 2nd Order

A second possible crossover strategy is to use a 2nd-order Linkwitz Riley. This is similar to a 4th-order, except that instead of putting two 12 dB/octave Butterworth filters in series to make each section, you put two 6 dB/octave Butterworth filters in series.

Since the total filters applied to make the high pass and low pass sections of this crossover are each made with only two first-order filters (instead of two second-order filters), the high pass and low pass sections are only 180 degrees out of phase with each other (at all frequencies). Consequently, in order to get them to add back together without cancelling completely at the crossover frequency, you have to invert the polarity of one of the sections. (We’ll do this to the high pass section, just in case you can hear your woofers pulling when they ought to push when a kick drum hits). On the plus side, since they’re 180 degrees out of phase at all frequencies, if you DO flip the polarity of your high pass section, they’ll add back together (on axis) to give you a flat magnitude response.

As you can see in the above plots, the slopes of the high pass and low pass sections in this crossover type are more gentle than in the 4th order Linkwitz Riley. This should be obvious, since they have a lower order. In the second plot, you can see that, on-axis, the magnitude response is flat, just as we would expect. However, there are implications on the off-axis response. The deviation from “flat” is greater with the 2nd-order LR than it is with the 4th-order version. Not by much, admittedly, but it is greater. So, if you’re concerned about deviations in your off-axis response in the vertical plane, you might prefer the 4th-order LR over the 2nd-order variant.

If, however, you lay awake at night worring about phase response (you know who you are – yes – I’m talking you YOU) then you might prefer the 2nd-order Linkwitz Riley, since, as you can see in the third plot, the total output is only 180° out of phase with its input in the worst case – only half that of the 4th-order variant. On the other hand, since it’s 180° out of phase, that means that a high voltage going into the system (at high frequencies) will come out as a low pressure. So, if you’re the kind of person who lays awake at night worrying about “absolute phase” (you know who you are – yes – I’m talking to YOU) then this might not be your first choice.

Finally, take a look at the step response in the final plot. You’ll notice immediately that the high frequencies are 180° out iof phase, since the initial transient of the step goes down instead of up. You’ll also notice that the step “recovers” to a value of 1 a little faster than the 4th order Linkwitz Riley. Note that, a 2nd order LR, doesn’t have the overshoot that we saw in the 4th order version.

Butterworth, 12 db/octave

Possibly the most common passive crossover type (and therefore, possibly the most common crossover  type, period!) is the 12 dB/octave Butterworth crossover. This is made by using a 2nd-order Butterworth filter for each section (the high pass and the low pass).

 

You’ll notice in the top plot that this means that the filter sections are only 3 dB down at the crossover frequency. This has some implications on the on-axis response. Since the two filter sections are 180° out of phase with each other (at all frequencies – just like the 2nd-order LR crossover) then we have to flip the polarity of one of the sections (the high-pass section again, for all the same reasons) to prevent them from cancelling each other at the crossover frequency when they’re added back together. However, now we have a problem. Since the two sections are in-phase (due to the 180° phase shift plus the polarity flip) and since they’re only 3 dB down at the crossover frequency, when they get added back together, you get more out than you put into the system. This can be seen in the second plot, where the total magnitude response has a bump at the crossover frequency – even when on-axis.

Of course, a 3 dB bump in the magnitude response will be audible, at the very least as a change in timbre (3 dB is, after all, twice the power). We can also see that there is a small, but visible change in the overall magnitude response as you change the vertical angle to the listener.

The third plot shows that a 12 dB/Octave Butterworth crossover, when all other issues are ignored, acts as a 2nd-order allpass filter with a worst-case phase distortion of 180°.

Finally, the fourth plot shows that its step response is similar, but not identical to, the 2nd-order LR crossover. The initial transient goes negative because we have inverted the polarity of the high pass section. Unlike the 2nd-order LR (but similar to the 4th-order LR), however, there is an overshoot and undershoot before the response settles at a value of 1. That overshoot reaches a maximum of 1.1340, and the subsequent undershoot goes down to 0.9942.

 

Butterworth, 18 db/oct

Sometimes, you’ll also hear of people using an 18 dB/octave Butterworth crossover instead of the 12 dB/octave version. These are a little more complicated to implement, but not uncommon.
The responses of this crossover type are plotted below.
The top plot shows that, although the order of the Butterworth high pass and low pass sections are higher (and therefore have steeper slopes), they are still only 3 dB down at the crossover frequency. However, since the two sections are now 270° out of phase, they add together to give you a magnitude of 0 dB – the same as the input – but only when you’re on-axis. As can be seen in the second plot, the off-axis response of an 18 dB/Octave Butterworth crossover is MUCH worse than all of the other crossover types we’ve seen so far. So, if you’re the type of person who worries about off-axis response, or the magnitude response of your ceiling and floor reflections, or the power response of your loudspeaker, then you probably wouldn’t choose this crossover over the previous ones.
The phase response of the total output of this crossover seems a bit strange initially, since you have two filters that are 270° apart at all frequencies, but the summed output has the phase response of a 4th-order allpass. However, what is not seen in this plot are the individual phase responses of the two sections. The low pass section has a phase response that starts at 0° in the low end and drops to -270° in the high end. The high pass section’s phase response starts at -90° in the low end and ends at -360° in the high end. So, although the two sections, individually, have phase response curves that have a similar shape to a third-order allpass, their combined outputs result in a 4th order allpass.
Finally, let’s come to the step response. This one is the busiest one yet, since, after the initial transient and drop, it overshoots (to a value of 1.178), then undershoots (0.971), then overshoots again (1.005) and finally undershoots (0.9994) before finally settling at a value of 1.

Constant Voltage, (using a Butterworth, 18 db/oct high pass)

There is a group of persons who believe that the step response (or the shape of a square wave through the system) is the be-all-and-end-all for determining the quality of a system. The logic goes that, if a square wave goes in, and a square wave comes out, then the system is perfect. This is true – if you mean “perfect at reproducing square waves” – which may or may not be important.
Following this logic, the idea is that, if you take your initial input and make a filtered version, then all you need to do is to subtract that filtered version from the input to get the remainder. If you then add the remainder and the filtered section, you get out what you put in, so the system is perfect. At least, that’s the idea. Let’s see how well that works out, shall we?
(By the way, the name for this classification of crossovers is “constant voltage” crossovers, and there are lots of different ways to implement them. Richard Small wrote some good stuff about them in some AES papers once-upon-a-time, if you’re curious.)
So, let’s look at one fairly-common implementation of a constant voltage crossover. We’ll take the input, filter it with an 18 dB / Octave Butterworth filter and use that for the high pass section. The low pass section is created by subtracting the high pass section from the input, and we just take what we get.
As you can see in the top plot, the result of this is that the low pass section is a little weird. It has a rather large bump in its magnitude response around the crossover frequency. In addition, the slope of the high pass roll-off is not very steep. This all might be okay, if your lower driver is able to handle it, but it might not. (Note that, if we had made a Butterworth low pass and used the subtraction trick to get the high pass section, the bump would have appeared in the high pass section, which would result in too much low-frequency energy in the tweeter, thus likely making it unhappy… That’s why we used a Butterworth high pass to start.)
Let’s skip the next plot and look at the third and fourth. As you can see in both of these, the constant voltage crossover is unique in that it has no phase distortion, and the step response is perfect. This is to be expected, since these are the primary criteria behind the design of this type of crossover.
Now, let’s look at the second plot. As you can see there, the off-axis response of a constant voltage crossover is a complete disaster. So, if you’re the kind of person who thinks that off-axis response is important – or at least worth considering, you should probably stay away from this crossover. However, if you have an acoustically absorptive floor and an acoustically absorptive ceiling (so no vertical reflections) and you never stand up, and you’re inside the room’s critical distance with respect to the loudspeaker, then this little problem might not be an issue for you.
Concluding comments
The thing that you have to remember for all of the stuff I’ve said here is that it’s only applicable within the limitations of the parameters I stated at the beginning. If your drivers are imperfect, or if you have a high pass in series with your low pass section because your loudspeaker driver exists in real life (it does), or if you have a symmetrical driver arrangement (sometimes called a D’Appolito design, named after the first person to be smart enough to publish a paper about it), then all of these results will be different.
Also, the other important thing to remember is that I’m making no claims about whether these “problems” are audible. They might be – and they might not be. But don’t just jump to conclusions all willy-nilly and assume that, because you can see a difference in these plots, you’ll be able to hear the difference in your loudspeakers. Then again, that doesn’t mean that I’m saying “you can’t!” What I’m saying is “I don’t know whether you can hear these issues or not – any of them.”
P.S .
Happy New Year.

Never trust a THD+N measurement: v2

In the last post, I talked about why a THD+N measurement is useless if you don’t know about the type of distortion that you’re measuring. Let’s now talk about another reason why it’s useless in isolation.

Once again, let’s assume that we’re doing a THD+N measurement the old-fahsioned way where we put a sine wave into a device, and apply a notch filter to the output at the same frequency of the sine wave and find the ratio of the level of the sine wave to the output of the notch filter.

This time, instead of taking a signal and distorting it, I’ll do some additive synthesis. In other words, I’ll build a final signal that contains four components (although they’re not entirely independent…):

  1. a “signal” consisting of a 100 Hz sine wave which we’ll call “the fundamental”
  2. sine tones at frequencies that are multiples of the fundamental frequency (in other words, they are harmonically related to the fundamental).
  3. sine tones at frequencies that are not multiples of the fundamental frequency (in other words, they are not harmonically related to the fundamental).
  4. wide-band noise
Version 1: No artefacts

Let’s start by listening to the original 100 Hz sine wave with a level of -10 dB FS without any other additional components. If you hear any distortion or noise, then this is a problem in your playback system (unless your system is so good that you can hear the quantisation error caused by the fact that I didn’t dither the signal).

Update Required
To play the media you will need to either update your browser to a recent version or update your Flash plugin.

Version 2: Wide-band noise

Now let’s add noise. I’ve added noise with a white spectrum and a level such that a THD+N measurement will tell us that we have 10% THD+N (relative to the level of the 100 Hz sine tone signal). In other words, I have a sine wave with a level of -10 dB FS and I have added white noise with a long-term RMS level of  -30 dB FS.

Update Required
To play the media you will need to either update your browser to a recent version or update your Flash plugin.

 It should be pretty obvious, even with poor playback equipment, that I have added noise to the 100 Hz tone. This should not be surprising, since a 10% THD+N is pretty bad.
Version 3: 2nd harmonic
For this version, I’ll add a 200 Hz sine tone to the 100 Hz tone. The fundamental (100 Hz) has a level of -10 dB FS. The level of its second harmonic (200 Hz) is -30 dB FS. This means that, again, I get a THD+N value of 10%.

Update Required
To play the media you will need to either update your browser to a recent version or update your Flash plugin.

Version 4: 3rd harmonic
For this version, I’ll add a 300 Hz sine tone to the 100 Hz tone. The fundamental (100 Hz) has a level of -10 dB FS. The level of its third harmonic (300 Hz) is -30 dB FS. This means that, again, I get a THD+N value of 10%.

Update Required
To play the media you will need to either update your browser to a recent version or update your Flash plugin.

Version 5: 2nd to 5th harmonics
For this version, I’ll add a four additional sine tones to the 100 Hz tone. The fundamental (100 Hz) has a level of -10 dB FS. I have added tones at 200 Hz, 300 Hz, 400 Hz and 500 Hz (the 2nd through to the 5th harmonics, inclusive) with a spectral pattern where each successive tone is half the amplitude of the previous. In other words, 500 Hz is half the amplitude of 400 Hz which, in turn, is half the amplitude of the 300 Hz tone, which is half the amplitude of the 200 Hz tone.
I have adjusted the overall level of the harmonics so that we get a THD+N value of 10%. In other words, the RMS level of the signal comprised of the 200 Hz to 500 Hz sine tones (inclusive) is -30 dB FS.
Update Required
To play the media you will need to either update your browser to a recent version or update your Flash plugin.
Version 6: 5 kHz
For this version, I’ll add a 5 kHz sine tone to the 100 Hz tone. The fundamental (100 Hz) has a level of -10 dB FS. The level of the 5 kHz tone is -30 dB FS. This means that, again, I get a THD+N value of 10%.

Update Required
To play the media you will need to either update your browser to a recent version or update your Flash plugin.

Version 7: Noise plus five sine tones with random frequencies
For this version, I’ll add a mess to the 100 Hz tone. The fundamental (100 Hz) has a level of -10 dB FS. To this I added a signal that is comprised of wide-band white noise and 5 sine tones at random frequencies between 0 Hz and 20 kHz (no, I don’t know what they are – but it doesn’t matter for the purposes of this discussion). The levels of the noise and 5 sine tones are random.
I have adjusted the overall level of the signal comprised of the noise and 5 random sine tones so that we get a THD+N value of 10%. In other words, the RMS level of the signal comprised of the noise and 5 random sine tone is -30 dB FS.

Update Required
To play the media you will need to either update your browser to a recent version or update your Flash plugin.

The punch line!

Each of the six signals I’ve presented above in Versions 2 through 7 (inclusive) is a “distorted” version of the original 100 Hz sine tone in Version 1. Each of those six signals will have a measurable THD+N of 10%. However, it is quite obvious that they have very different spectral patterns, and therefore they sound quite different.

This isn’t really revolutionary – it’s jut another reminder that a THD value, in the absence of any other information, isn’t terribly useful – or at least, it doesn’t tell you much about how the signal sounds.