Showing posts with label Bass Management. Show all posts
Showing posts with label Bass Management. Show all posts

Sunday, March 5, 2017

Clipping Distortion and Digital Bass Management

This is your audio on bass management. (source)

I recently posted a discussion of my experience with digital bass management somehow introducing distortion when listening to music. It was determined that enabling the receiver's bass management process reliably led to audible distortion with some recordings. I had been listening to music with bass management for years without any trouble. But when listening to Landscape In Portrait by Marihiko Hara, it was immediately apparent that something was extremely wrong. Now I know why.

An audio signal processor's bass management system is a set of digital filters with selectable crossover points. This means that instead of sending the main speaker channels the full bandwidth signal, the receiver filters out the bass that is sent to the speakers (high-pass filter) and redirects the bass signal to the subwoofer (low-pass filter). This is not a brickwall filter where all content below the crossover point is redirected to the subwoofer; instead, the bass is gently "rolled off" on a slope to allow for a smooth transition between the speakers and sub.

Crudely drawn illustration of a crossover filter slope by the author

In the last few months, I have been applying high-pass filters to digital audio recordings in order to properly compare them to vinyl rips (i.e. needledrops). It was immediately apparent that I needed to attenuate the signal before applying the filter. The whole point of comparing vinyl rips with filtered versions of retail digital releases was to demonstrate the "false peaks" that resulted in more dynamic-looking waveforms. So if I ran the filter without first creating headroom, those newly created "peaks" with run up against the -0dBFS ceiling and be clipped.

While listening to an album in Direct mode (no bass management) last night, it occurred to me that the very same "peaks" I encountered in my filtering tests could be the source of the bass management distortion problem. After all, the bass management process is not unlike what I was doing in the digital audio workstation, except that the receiver isn't compensating for the potential clipping issues that may result in filtering.

As soon as I thought this could be the issue I was experiencing, I was certain it was indeed the case. But a hunch will not suffice: A good pretend scientist must make an experiment! Using the track "Yoru Ga Mita Keshiki" from Landscape In Portrait, let's take a look at some waveforms.

"Yoru Ga Mita Keshiki"
As we can see, this minimalist piano music is mastered in such a way that it often peaks near the digital maximum. Played in Direct mode or through headphones, it sounds perfectly clean. It is only when the bass management filter is applied that distortion becomes an issue.

"Yoru Ga Mita Keshiki" high-pass filter applied at 80Hz
Those alarming red lines are Audacity's way of telling me that the software is detecting clipped samples. This is effectively what is being routed to the amplifiers for the main stereo channels during bass management (another signal that is low-pass filtered is routed to the sub at line level). When I play this file with my receiver in Direct mode, I hear the exact same 'tearing' distortion sound that I encountered with bass management. Problem: Identified! But before going further, let's take a look at what the filtering looks like for this song if I "turn it down" first:

Same song, attenuated by 4dB

High-pass filter at 80Hz after attenuation

We can see now that the filtering results in peaks higher than what was represented in the attenuated file. These were clipped in the version above with all the red lines. This clipping is precisely what is happening when the "full volume" digital audio is hitting the receiver's processor and the bass management filters are being applied. When I listen to my filtered version in Direct mode, the distortion is audible during the same passages as when listening to the unaltered file with bass management enabled.

Let's zoom in to see what's happening in a little more detail:

Before filtering...

...after filtering

When we apply the filter to the unaltered file, we can clearly see the red lines indicating clipping. We now have square waveform tops in place of smooth curves. Squares do not sound very good when your speakers try to reproduce them. Some recordings are intentionally clipped, but this one wasn't.

Attenuated before filtering...
...after filtering
If we lower the volume of the file before applying the filter, we are creating enough headroom to allow for the peaks to resolve. There are no square wave tops or red lines in the filtered version above, and thus no distortion. 

Update: Listen for yourself with the clips below. They were recorded from my Oppo UDP-203 playing the FLAC file of "Yoru Ga Mita Keshiki" using the stereo analog outputs of the player. I've bypassed the receiver, but the results are the same. One clip is the audio played full range, and the other is with the players bass management system enabled (front left/right channels set to "Small"; crossover at 80Hz).

Merely by using the bass management ubiquitous in home theatre receivers, we are potentially adding a not insignificant amount of audible clipping distortion. This will potentially occur in any digital recording without sufficient headroom for peaks to resolve after filtering. In reality, this is happening all the time. It just took this special case with minimalist piano music mastered in such a way that some peaks ran into the digital ceiling after bass management filters were applied. There were a few times in other recordings where I thought I'd heard something similar, but couldn't be sure. Whenever I went looking for the offending sections monitoring carefully in headphones, I couldn't find them. Now I know why: No filters are applied with the headphone output.

So what's the solution? I mostly play music directly from my computer via optical cable connected to my Onkyo TX-SR706. Given that all is required here is a bit of headroom in the recording before it hits the receiver's processor, I should be able to create it by adjusting the output volume in my music playback software. Sure enough, by turning down the volume in foobar the recording sounds perfectly clean in a bass managed configuration. It doesn't take much, -6dB should be plenty if you want to play it safe. It's that simple. (Of course, this means you are sacrificing 1 bit of resolution. Given this filtering-causing-clipping thing is only an issue because digital audio is mastered at such high levels, I wouldn't worry too much about effectively elevating the noise floor from -96dB to -90dB.)

But what about playing a disc or file from a non-personal computer source? I have a standalone Pioneer CD/DVD-Audio/SACD player for playing various music discs. To my knowledge, there is no way to adjust the volume of the the digital output before it reaches the receiver. Therefore, any audio signals that peak near -0dBFS will potentially be subject to clipping distortion due to bass management filtering. The same goes for bitstreaming Dolby or DTS-encoded audio (lossless or otherwise) from Blu-rays via my Playstation 4. I think the PS4 has a volume option, though it would require decoding everything to LPCM before sending it to the receiver digitally for bass management. Though movies tend to be mastered with plenty of headroom compared to most music, so the likelihood of encountering clipping due to bass management filtering is much lower.

There is also the option of some players like those available from Oppo which have volume controls on their analog outputs. They also feature bass management on their analog outputs, which could be sent to a capable receiver and run in Analog Direct mode. However, there's no guarantee the Oppo's filters wouldn't clip the audio. (Update: I have since purchased the Oppo UDP-203 and yes, using the player's bass management system for analog output also results in distortion.) One might choose to send use the Oppo's analog output without bass management and lower the volume before it hits the receiver for bass management, but the receiver would then need to do an analog-to-digital conversion before its processor could apply the filter. It wouldn't be an ideal solution, but it's a workable one if you don't mind the extra conversion.

It must be so obvious to the engineers designing this equipment that bass management is a source of potential distortion. Ideally, the receiver would have an option for lowering the level of a given digital input prior to processing the signal. My receiver doesn't have this option, though I'm not sure if more recent models have some equivalent feature for avoiding the issue.

Given how loud modern recordings are, it's a wonder why this problem never required my attention sooner. The simple reason for this is that the distortion is masked by the music and would only be noticeable during quiet passages. But quiet passages don't usually contain peaks near -0dBFS... unless all the music is quiet and is therefore allowed to be mastered that way. A quick Google search about this issue doesn't seem to come back with many discussions of the problem, and what few results there are tend to specifically deal with subwoofer clipping. That's not the issue I encountered: The distortion is present in the main channels. Hopefully this post will be helpful those those who like to listen to their music in a "2.1" bass managed stereo configuration like me:

If you are encountering clipping distortion when using digital bass management, the solution is to lower the volume of the player's output before it reaches the receiver's processor for filtering.

Sunday, February 26, 2017

Stereo Bass Management & A Distortion Dilemma: Toward An Acceptable Compromise (Update: [SOLVED])

Image by Big Daddy

 Update: Solved*


A few nights ago, I turned out the lights and turned up the volume on my Onkyo TX-SR706 to listen to Landscape In Portrait by Marihiko Hana. As you can tell from the video below the style is mainly solo piano, and a fair minimal one at that:



Very soon after starting up the album, I was greeted by some rather non-musical distortion emanating from my speakers. It sounded like brief tearing noises that were produced when a piano note was played loudly with some attack. Initially I thought it may just be an issue with the recording, perhaps it was clipped and was meant to sound that way. However, the distortion kept returning and was terribly non-musical. I switched over to listen via my pair of Audio Technica ATH-M50x headhones and the distortion disappeared.

That's odd, I thought, what was going on here. Were the headphones not revealing enough? Are my speakers blown? Is there an issue with the amp? Needless to say I was worried and that some investigation was surely in order.

Googling "distortion" and "piano music" I came across some forum threads where users argued that piano music is notoriously difficult to capture and reproduce. The instrument is capable of tremendous dynamic range and can easily overload an improperly configured microphone. The dynamic range can also cause issues with amplifiers that are not up to the task of delivering clean wattage for the highest peaks. To me, the recording seemed fine (no issues in the waveform that I could detect) and I was still hearing the distortion at low volumes. This suggested to me that it wasn't a problem with driving the amp or speakers too hard.

Still, I was concerned. I was able to quickly test the same files on a wholly different receiver/speaker setup and lo and behold: distortion! Now I could be reasonably sure my speakers aren't damaged (phew). Was the amp the culprit? Why did it sound fine in my headphones?

A little more deep googling alerted me to another thread where an audio enthusiast was having trouble with his signal processor.  Their distortion issues went away after replacing it. I have no other means of using another processor with my A/V receiver. Then I got the idea to try the "Pure Audio" mode, which passes the signal from the input stage to the amplifiers with as little processing as possible.

It worked. The music was crystal clear with no audible distortion. Everything sounded as it should. Except... no subwoofer.

The Pure Audio mode (and Direct mode on this particular receiver) disables the bass management filters and processors. I am quite fond of listening to stereo music in a 2.1 configuration with a subwoofer appropriately crossed over with the speakers (I actually use a 5.1 setup, though I rarely choose to upmix stereo to surround using built-in Dolby or DTS algorithms). I like my subwoofer and I like hearing (er, feeling) the lowest frequencies of the program material. Engaging the receiver's crossover filter immediately introduced the awful distortion, and bypassing it instantly solved the issue. But what about the subwoofer?

Fortunately, this receiver has a Double Bass feature. This means in Stereo mode, which is usually used to engage crossover and other settings, I can run my front left and right speakers in Full Range mode and have to receiver also send bass information to the subwoofer via the LFE output. Instead of some bass being routed to the sub away from the main channels, the speakers get the full bandwidth signal and the sub gets some love too. And there is no distortion!

I have no idea why this distortion is introduced in Stereo mode with bass management engaged. It does not distort with bass management engaged when I'm using Dolby Pro Logic II or All Channel Stereo modes. This is bizarre.

Whatever the cause, I was on my way to a solution. I had been using the receiver's bass management system to control information routed to the subwoofer and the settings I used performed really well. Using Room EQ Wizard, I performed low frequency sweep tests to measure the response from the listening position. Here's what I'd be using all along:

Bass management on receiver, crossed over at 80Hz
Using the built in microphone on a laptop (I know, not an ideal measurement tool), I can get a good idea of how the system is performing. These graph is useful for confirming what I'm hearing when I do the bass tests. It's fairly smooth in the prime listening position, which is more than can be said for elsewhere in the room...

But if I want to avoid the distortion caused by the stereo bass management in the receiver, I must deviate from this setup. First, here are some other measurements to provide context for performance and settings:

Running the two main front speakers full range; no subwoofer or bass management
Bass management on receiver, crossed over at 50Hz

As you can see, running my SVS Ultra Towers at full range leaves a little to be desired when it comes to achieving flat response in my somewhat large room. The speakers are rated at 28 Hz-32 kHz (+/-3 dB), so they are certainly capable of delivering serious low end response. However, the laws of science be a harsh mistress. The SVS PB-1000 subwoofer helps pick up the slack when it comes to exciting the room in the lowest frequency ranges. Crossed over at 50Hz, the sub helps bring up the levels and results in a flatter curve; but the 80Hz point is really tough to beat, though some may deem it a little high for use with these particular speakers.

Now it is time to dial in the Double Bass settings to see if I can get a roughly comparable curve. The subwoofer has it's own dial for setting the crossover point. The filter can be set anywhere between 50-160Hz. For the first test, I ran the front stereo speakers at full bandwidth with Double Bass engaged and the filter on the subwoofer set to it's maximum height (160Hz, or "disable/LFE").

Stereo speakers full bandwidth, double bass active, highest crossover setting on subwoofer (160Hz/disable)
It's a start, but that's a nasty trough at 60Hz. There's a slight peak beyond that, but nothing to be overly concerned about. Let's keep trying...

Stereo speakers full bandwidth, double bass active, lowest crossover setting on subwoofer (50Hz)
Turning the crossover dial all the way down to 50Hz yields a nice curve. There's still a dip between 50-60Hz, but it's not nearly as dramatic as the previous setting. I think we can do better than this. After all, we already have a good idea of what the appropriate setting might be given the positions of the speakers/subwoofers haven't changed, nor have I adjusted any gain levels.

Stereo speakers full bandwidth, double bass active, crossover at ~80Hz on subwoofer
Now this is much better. It ain't perfect, nor quite as smooth as the original setting with the receiver's bass management enabled, but it's fairly close. We still have the slight dip and peak in response in the 50-80Hz range, which could probably be targeted if I were so inclined to use some precision equalization. But let's not get carried away here.

Just for fun, Room EQ wizard can overlay all the response measurements for comparison:


The two outliers are the Full Range with no subwoofer active and the Double Bass with the highest crossover setting on the subwoofer curves. The other graphs are actually fairly similar, especially beyond the 60Hz point. Judging by these measurements, it seems that enabling Double Bass and running the speakers full range with the subwoofer's crossover setting at about 80Hz is a perfectly acceptable compromise. It's not ideal; I'd much rather have a true crossover between the main channels and the subwoofer, and hopefully this configuration is only temporary. I certainly do not want to hear that distortion ever again, and I certainly do want to continue using my subwoofer with stereo music. I mean, have you heard the new Dirty Projectors record!?

Update 

Upon further consideration and some general listening, the Double Bass option is untenable. While the graphs look good as far as room response is concerned, the sound is just too muddy. I guess I'll just run everything in Direct mode until I find another solution, or go back to the original bass management settings and switch it off if I begin to notice distortion. The full bandwidth option with no bass management is fine for piano music, and I've only noticed the distortion once or twice before on albums with full band arrangements (though I originally thought the recording was at fault, I have since confirmed Direct mode clears up the trouble spots I'd heard elsewhere prior to this glaring issue).

Update The Second