Hacker News new | comments | show | ask | jobs | submit login

As the main developer of VLC, we know about this story since a long time, and this is just Dell putting crap components on their machine and blaming others. Any discussion was impossible with them. So let me explain a bit...

In this case, VLC just uses the Windows APIs (DirectSound), and sends signed integers of 16bits (s16) to the Windows Kernel.

VLC allows amplification of the INPUT above the sound that was decoded. This is just like replay gain, broken codecs, badly recorded files or post-amplification and can lead to saturation.

But this is exactly the same if you put your mp3 file through Audacity and increase it and play with WMP, or if you put a DirectShow filter that amplifies the volume after your codec output. For example, for a long time, VLC ac3 and mp3 codecs were too low (-6dB) compared to the reference output.

At worse, this will reduce the dynamics and saturate a lot, but this is not going to break your hardware.

VLC does not (and cannot) modify the OUTPUT volume to destroy the speakers. VLC is a Software using the OFFICIAL platforms APIs.

The issue here is that Dell sound cards output power (that can be approached by a factor of the quadratic of the amplitude) that Dell speakers cannot handle. Simply said, the sound card outputs at max 10W, and the speakers only can take 6W in, and neither their BIOS or drivers block this.

And as VLC is present on a lot of machines, it's simple to blame VLC. "Correlation does not mean causation" is something that seems too complex for cheap Dell support...

Maybe Dell should advise against playing Metal music and should only allow Céline Dion music, because Metal saturates more...

EDIT: more details...

PS: they even provide a BIOS update for the fix... So, of course, VLC was the issue... http://www.dell.com/support/troubleshooting/us/en/04/KCS/Kcs...




Low quality speakers and a poor hardware design. It isn't even a challenge to match amplifier output to speakers in such a way that the amplifier can't break the speaker. There are easily a dozen cheap ways to make this work properly that don't rely upon a probably non-existent WMP based solution.

>VLC does not, and cannot modify the OUTPUT volume to destroy the speakers.

That would be remarkable.

>And as VLC is present on a lot of machines, it's simple to blame VLC. "Correlation does not mean causation" is something that seems too complex for cheap Dell support...

It sounds like a #BOFH excuse.


Dell may be using poor quality parts. VLC can also make the sound louder than any other media player that I've used while generating destructive square clipping.

The problem is it's too easy to set the volume above 100%. I've done so with the mouse wheel. And I now have a $2000 out-of-warranty laptop with blown speakers.

Fixes could include:

* Not remember settings above 100% between sessions unless an advanced option is checked that warns the user.

* Require a double click on volume slider to go above 100%.

VLC's high volume is a wonderful feature when you're listening to DTS or AAC movies encoded with the volume too low. It's just too easy to be accidentally abused.


The problem is, repeating the article and the GP, that it can not be abused.

Your computer was defective, and Dell is refusing to comply with the warranty. It's impossible for VLC to harm the speakers on a computer that is not defective.

Ok, I like it being hard to set volume bigger than 100% at mplayer, it'll probably be a nice feature at VLC. But that's only because I don't like clipping, not because of any hardware issue.


For $2000, you could afford to buy a laptop from someone who understands how to pick the right $5 speaker or update its bios accordingly.

That makes a lot more sense than force software to not do something it can and should do "just in case Dell failed at their job".


Audio is generally handed over to the OS via a format called Pulse Code Modulation. This is a series of audio "samples", which in the Windows case are individual signed 16-bit integers. Typically each second of audio is broken into about 44,100 of these integers. Each integer represents the sound amplitude during a particular 1/44,100th of a second, with a large negative number (-32,768) being a small amplitude and a large positive number (32,767) being a big amplitude.

You can view PCM sample amplitude as telling the sound card how much power to apply to the circuit driving the speaker. A large amplitude means the speaker cone should move a lot, and small amplitude means it should stay nearly at rest.

So that means that the sound card has to interpret each of the signed 16-bit values and determine what kind of electrical signal it should output to the speakers to get the desired effect (sound). A sample with the highest signed 16-bit value (32,767) tells the sound card to produce its most powerful signal.

Now, in a laptop, the sound card and speakers are chosen by the manufacturer. Different sound cards can produce varying amounts of output power, and different speakers can handle varying amounts of input power. Obviously the speakers need to be chosen such that the sound card cannot produce more power than the speakers are rated to handle. (It sounds like Dell made a design error here.)

If the sound card and speaker choice is such that the speakers cannot handle the sound card's output power, then any audio software that produces signed 16 bit samples above some threshold (let's say 32,000) could damage the speakers.

So what audio software could produce such large amplitudes? ANY SOFTWARE AT ALL. Not just VLC. I could create a .wav file that was just a bunch of loud noise with amplitudes above 32,000, and it would destroy your speakers.

In fact, most well-mixed sound files will have at least one sample at the maximum amplitude. This is called normalization -- to provide the highest fidelity sound, you want to use the entire dynamic range of the PCM sound format, and thus ideally the loudest bit of the track should be exactly at 32,767. Lots of modern music uses a technique called compression ("dynamic compression," not to be confused with data compression) to make good use of the full dynamic range of PCM, which results in LOTS of samples at or near the maximum level.

On a correctly designed audio system, this is great! You get to hear audio with the fullest dynamic range that your equipment can produce. If your system has been designed incorrectly, though, you'll blow out your speakers. But that could happen due to ANY SOFTWARE AT ALL, not just VLC.

If you really want to buy crappy Dell hardware and not blow out the incorrectly designed audio system, you should permanently decrease your global Windows volume level. That will put a hard cap on the PCM amplitude levels sent to the sound card, and thus will cap how much power is sent to the speakers.

Blame Dell. VLC has exactly nothing to do with your problems. The "volume above 100%" feature is not dangerous on a properly designed audio system (like 99.99% of computers out there).


I do blame Dell for my blown speakers. I also do like VLC's feature to boost audio in quiet movies. What I don't like is is the sound of digital clipping, how VLC makes it easy to clip, and how VLC remembers these terrible settings.


It's exactly as easy to decrease VLC's audio level back to normal as it is to increase it.

Anyway if you don't like it remembering the last audio level, go to Tools > Preferences > Audio, check the "Always reset audio start level to" box, and set it to 100%. Voila!


No, VLC should remember the last audio level, just not when it's over 100%. If I leave it at 50%. On next restart it should be 50%. If I'm watching a movie and finish on 200%, on next restart it should be 100%.

Clipping sucks. VLC shouldn't remember these options unless the user changes an optional setting.


I have to be honest, setting "do not remember audio" sounds like a decent compromise between not getting anything that you want and getting exactly what you want. It is especially appealing since you get VLC and this compromise solution for free. However if you are still not satisfied:

  $ git clone git://git.videolan.org/vlc.git
  $ cd vlc
  $ ack-grep -r  resetVolumeCheckbox ./
  $ emacs modules/gui/qt4/components/simple_preferences.cpp 
  $ git format-patch -o patches origin
  $ git send-email --to vlc-devel@videolan.org patches


Jeez, start VLC with an alias if it bothers you that much.


It is not that simple. The speaker is a dynamic system whose response to signals is not memoryless. A speaker that can easily handle a pure 4kHz tone at the maximum amplitude cannot necessarily also handle a 4kHz square wave at the maximum amplitude (a square wave distributes much of its power into harmonics). It is well known that you can destroy speakers just as easily by overdriving the output stage of the power amplifier (which leads to clipping) than by overdriving the speakers themselves.

Of course, Dell could include analogue filtering circuitry to filter out the excess power in inaudible frequencies if they wanted to.


>Of course, Dell could include analogue filtering circuitry to filter out the excess power in inaudible frequencies if they wanted to.

It likely isn't necessary as it is probably built into the output amplifier. I have no clue what audio amplifier dell used but here is an example of a typical headphone amplifier IC http://www.ti.com/lit/ds/symlink/lm4881.pdf

If you look on page 9 of the datasheet you'll see its frequency response. The attenuation is > -20dB past 15kHz at best. You aren't going to get much of a square wave above 1.5 kHz, and probably not below if you look at the response of the speaker.


The lack of response of the speaker is the problem. If the power at those frequencies isn't being efficiently converted into sound, it's being converted into heat instead.


But those frequencies don't get to the speaker 'cause the amplifier doesn't send them...


While any software that accesses an audio interface using integer formats, VLC is to my knowledge the only average user-oriented program that can end up in such situations.

I would suggest VLC disables this feature for new installs and move it to an easily discoverable preference.

Or if they really care enough to allow their users to boost the volume levels of quiet movies to replace the gain multiplication with a proper dynamic range compressor activated when the volume goes above 100%.


If Dell isn't going to honor the warranty if I listen to my favorite square-wave music, they should state "ONLY SINE WAVES ALLOWED" clearly in the advertising material.


Well physically speaking, sine waves ARE the only thing you can put through dell speakers, or any speakers.

Dell would have to set an upper limit on the wave superposition, or set a top frequency.


> VLC is to my knowledge the only average user-oriented program that can end up in such situations

Windows Media Player, Firefox, iTunes, ...

VLC makes it easier (you can boost a quiet song or movie until it fills the OS-defined dynamic range) but a loud song in any other piece of music playing software would have the same effect. Depending on the genres of music you listen to, it's not uncommon to come across songs that have been boosted until they clip.

As for hiding the option in preferences, volume boosting is one of VLC's key value propositions to laypeople (in my experience). Making it undiscoverable would be a disaster. Maybe add a 1-off warning dialog for users on Dell computers?


>Windows Media Player, Firefox, iTunes, ...

None of these drive the signal to digital clipping.


Yes they can if you play the right "music".


Actually it's not that a simple matter as simple output voltage clipping. Most audio amplifiers are AC coupled and only the AC parts of a signal actually carry power. So it would be perfectly possible to have a sine signal with its samples all between 32000 and 32767 that would do no damage at all to the speakers, because the AC power it carries is low (-38.63dB(FS) to be specific in your case).

But it's not just the total AC power that matters, it's also the power density that matters. So for example a sine has a very high power density (in fact if you do the math, the power density for a pure sine is infinite). This is turn means, that whatever resonances the system has, that overlap with the frequency of the sine, they will get excited and can resonate toward mechanical breakdown (damaged speaker). A low power density signal, like noise, where the total output power is spread over the whole spectrum (or the spectral response of the system in question) and below the maximum rated power of the speaker is much less likely to do damage.

Now we have to look at clipping. Analog clipping is not just some random noise, it's in fact a harmonic distortion. And as such it can redistribute the power in the spectrum. And digital clipping actually causes an integer overflow, which in fact adds further power to the signal.

But it goes further: The output of a DAC is a voltage. A voltage by itself does not carry power, you need an amplifier to do that. So the first step after the DAC and after the reconstruction filter (which also acts as a DC block) is a transimpedance amplifier that turns the voltage into a power signal; what this means is, that for a signal of a certain power that's going into a certain load it gives rise to a specific RMS voltage on the load terminals. In audio the reference power level is usually 0dB(m), i.e. 1mW – on the typical load impedance of 1kOhm this corresponds to a RMS voltage of 1V at the load (and higher voltage at higher impedance, lower voltage on lower impedance loads).

In a perfect amplifier the impedance is independent from the input signal and its output load. In a real amplifier though the impedance can vary depending on the signal and the output load. And the impedance usually also depends on the frequency of the signal.The effect is, that an amplifier introduces further harmonic distortions, if the signal puts too much power onto its input. If this happens in the preamplifier stage this can drive an output stage outside the specifications of the connected loads.

You see, because distortion happens mostly if you drive an amplifier close to it's maximum capabilities the usual approach is to design the amplifier some comfortable margin to the needs for the connected load; typically you use a margin around 6dB, so for a 6W load you'd choose a 12W amplifier, so that no matter what input signal the amp gets, the total harmonic distortion stays within safe limits. To protect the load you then choose the amplification factor so, that for a reference power input signal the output power is lower than or equal to the power for which the load is rated.

Now say, you're a cheapskate engineer, maybe with little analogue electronic design experience. So you see your speakers have a maximum rating of 6W. So you do a parametric search and come up with amplifier ICs from the usual suspects (Maxim, TI, ST); they're rated a 5W, 10W, 15W...; obviously cannot drive those 6W speakers at maximum power (it will badly distort), but 10W should do the trick, right?

Well, now, because you forgot the total harmonic distortion: Which means that if you raise the input signal power by 6dB (i.e. double the power) the output of an amplifier may rise well over 6dB. So lets say you had first a signal output power of 2.5W for a -6dB(FS) signal, then you raise it to 0dB(FS) (which would be your volume slider in the control applet at 100%), theoretically the output signal should now be 5W. But because of the underrated amplifier the output distorts and the actual power going into the load rises well above their maximum 6W rating.

TL:DR; Dell did mess up their amplifier design, but not by overrating the amplifier, but by underrating it. If they had chosen a properly rated with margin (so that THD stays low) amplifier and chosen the gain so that a 0dB(m) line signal would have produced 6W output power (about 15dB gain) the speakers would have been safe.


Uninstall VLC = your warranty is back.


While it is likely true that most laptop speakers are crap, overdriving the power amp or any condition that causes clipping even at lower volumes can lead to cracked voicecoils which in turn produce distorted sound. In the old days we just used to push in on a driver and you could easily feel the broken voicecoil. clipping = death


Someone should upload video to YouTube with high gain and call it: "This video will void your Dell laptop speaker warranty" :)


I can see it now...

"Be aware that just having Youtube in your browser history is enough to deny your warranty."



Void your dell speaker warranty with this weird deprecated firefox-only javascript http://ge.tt/7Qln5fJ1/v/0

Porting it to Web Audio API is left as an exercise for the reader.


While I don't support Dell's decisions, digital (and analog) clipping can easily damage speakers driven at what is normally their maximum power they can handle, since the resulting clipped waveform carries a lot more energy than an unclipped one.


Nobody prevents the manufacturing to put some electronic bits before the speakers to cap the maximum power. Even better, teach the sound card to do that.


A square wave has twice the power of a sine wave of identical amplitude.

This is why distorting the amplifiers (especially digital clipping) is so much worse for speakers than overpowering the speakers. This is a very well known fact in audio circles.

Playing metal at full volume is not as damaging as playing anything intensely digitally clipped at full volume.

Yes, Dell is putting on shitty speakers on their laptops, (what else is new), but VLC should be amplifying the output using level-limiting (hard-limiting), which would effectively bring all the quiet parts to be just as loud as the loud parts, instead of just digitally clipping the output.


>A square wave has twice the power of a sine wave of identical amplitude.

1.41 x

>Playing metal at full volume is not as damaging as playing anything intensely digitally clipped at full volume.

The output of the amplifier really ought to be bandwidth limited either as a natural consequence of the components used or explicitly with a filter. It is silly to spend power on things that can't be heard.


Assuming the parent is talking about equal maximum amplitude of the sine and square waves, the square wave RMS voltage will be sqrt(2), or 1.4, times the sine wave RMS voltage. And since power is proportional to voltage squared, the square wave will carry sqrt(2)^2, or 2, times the sine wave power.


Actually, if we look at two half-cycle waveforms, one sine and one square, like this:

http://i.imgur.com/oE5NFZ9.png

(Just the left 1/2 of the graph for this example)

The integral of the sine waveform with a peak value of 1, on the interval 0 x < pi, is :

http://www.wolframalpha.com/input/?i=integrate%28sin%28x%29%...

= 2

The integral of the square wave on the same interval is = pi

So the ratio increase in average voltage at the speaker (comparing the sine to the square) is pi/2 = 1.57. The increase in speaker power is (pi/2)^2 = 2.46.


It also assumes a speaker's reactance is purely resistive. It's not.


Derp, thanks to both for the correction.


>> A square wave has twice the power of a sine wave of identical amplitude.

> 1.41 x

Yes, for a voltage of x, but remember that the speaker is a resistance, for which the power varies as x^2/r (Ohm's law: p = e^2/r), So the original claim is correct.


Most metal released these days is digitally clipped. Even classic old 80s "remastered" records are digitally clipping all over the place. The loudness wars has ruined most metal through remasters.


Ah yes, the death of dynamics in music! One horrendous offender that I own is Paul McCartney's Memory Almost Full. I think he remastered it and rereleased it but there isn't a chance that I'm spending my money on it again! I think the mastering engineer discovered the joys of gain and hard knee in compressors.


Its well known if you are over pumping your speakers.

You shouldn't be able to blow up your speakers if your amp, speakers and limiters are setup correctly.

After all, if you're busting out £20k on a set of decent speakers, you don't want to burn them out because your idiot producer "turned it up to 11"


>but VLC should be amplifying the output using level-limiting (hard-limiting), which would effectively bring all the quiet parts to be just as loud as the loud parts, instead of just digitally clipping the output.

That's compression, not hard-limiting. Hard limiting would leave the quiet parts quiet relative to the loud parts. It would only crush them if they were not enough dynamics in the first place.


So would compression. The implication is that after you hard limit, you also increase the overall volume, such that the limit threshold of -Xdb is now 0db. Otherwise, there is no point to hard limit.


I actually never seen VLC clip sound that much on volumes > 100%.

Maybe if your speakers are very quiet and crappy and you have to get every control to 100% (hardware, system, vlc) in order to hear anything - maybe in this case it will.

Hard clipping is very noticeable for the listener so not many people will set it to the maximum if they have choice.

Anyway, you can protect from this either in hardware or in the driver.


Analog limiter ICs (that I know of) limit the signal according to input voltage, something that does not catch this issue. Furthermore, limiting power at the audio codec level would require for the codec to have that feature and I don't know of audio codecs with that capability.


Cheap shit. Seriously, cheap shit. There are several ways to solve this, all of which boil down to "use more chips" or "use better speakers", thus increasing the price of already incredibly shitty speakers. Source: I'm involved in designing consumer electronic products and the only corners that don't get cut are those that, if cut, result in certifications not being granted and therefore in products you're unable to sell. Everyone, Apple included, does it.

The easiest way to solve this is use stronger materials for the speaker construction. This does, yes, affect the quality of the sound, which is already somewhere between catastrophic and abysmal on a laptop. The frequency response is likely to be worse, on a set of speakers that already has a frequency response that makes them quite useless for music.

You can also do it in electronics, as measuring the power delivered to speakers is not exactly rocket science. The response time wouldn't be great, but it's continuously shredding the speakers with square signals that damages them, not a couple of pulses every once in a while. You can also detect heavy slopes. You can even detect heavy slopes in software.

But no, seriously, this is a problem that can be solved. The mere fact that a lot of manufacturers manage to come up with speakers that don't break should be a testimony to this. I have (granted, desktop) speakers that have gone through a decade of heavy metal, grindcore and fucking SIDs and MODs, on bad ALSA drivers that I could barely get to work for years. They're fine. This is just Dell selling cheap shit.


This is great information - and I'd love to know which speaker manufacturers you approve of. I'd rather own an expensive set of desktop speakers that lasts ten years than deal with Dell parts breaking all the time.


Get a pair of these. Don't pay more than $40 for the pair. They are quite decent, especially at this (retail) price point. Dayton Audio B652 6-1/2"


> I'd love to know which speaker manufacturers you approve of

I have no idea how things go in the laptop market, so I can't say there's one I approve of in particular. The fact that the ones on the laptops are crap can, however, be assessed quite easily by ear :).


Why Apple included?


Then one should figure out why nobody needed this feature.

I'm no expert but maybe it's actually possible to create speaker that doesn't go bad.

(I could code the protection into the sound driver in half a day probably)


> I'm no expert but maybe it's actually possible to create speaker that doesn't go bad.

Of course it is, but nobody wants to do that; it's not profitable. * sigh * .

I sometimes wonder how difficult would it be to create, say, a brand of kettles with lifetime warranty, designed to last 50+ years instead of 50+ weeks the ones we have do. How hard would it be to sell them and to what ends would the competition go to stop you from killing their market?


Over on this side of the pond we generally use "coffee makers" instead of "kettles". But the problem is the same. They fail after a few years. It's all cheap consumer crap made in China.

We've given up trying to buy "good" coffee makers. We just buy something cheap that's on sale and throw it away when it breaks. There should be the equivalent of "Gresham's Law" for consumer goods (the bad eliminates the good). But I don't know the name of that. Perhaps "China's Law" would be appropriate.


We have coffee makers as well, but you can't make a cup of tea with a coffee machine.

Nor make a cup-a-soup, pot/instant noodles, pre-boil water for cooking veg, hot water bottle, etc.


I used to boil water in a stovetop kettle. But that takes too long. So now I just use the microwave. Take a teabag, pour cold water over it, nuke for 90 seconds, DONE!

Of course it doesn't taste nearly as good as pouring hot water from a kettle onto a teabag, but it's so fast and convenient.

And I don't think anyone in the USA buys loose tea. It's all teabags here (i.e. probably 99% of the market).


The microwave trick not only tastes bad, but it also doesn't heat evenly as you get patches of boiling water and patches of cold water.

Modern kettles boil in about 2 minutes anyway. So I don't really see them as any more inconvenient than using the microwave. The real inconvenience is having to get up to switch the device on; what I really want is a networked kettle so I can boil it from the comfort of my seat hehe


Microwave just the water, then put the teabag in after. Then it will taste the same.


I never had either failing speaker or failing* kettle in my life so it's hard for me to say anything. Maybe there just so much you can get from laptop speakers so it makes sense to cap their power hard?

* Some no loger turn off automatically, tho


> * Some no loger turn off automatically, tho

And you don't think a kettle burning its way through your kitchen is a fail !


Kettle: I had one with the same problem. That's a terminal failure to me...


Dell isn't winning much on this. The service calls and now the reputation hit cost them more than they could make repairing laptops.


True, but VLC actually applies soft limiting when set to above 100%, so that hard clipping never occurs. I use this feature alot, it's great for taking down the usually thunderous sound effects in hollywood movies a few notches, while keeping quiet scenes at hearable levels.


> ... the resulting clipped waveform carries a lot more energy than an unclipped one.

Is this claim actually true?

My understanding is that if you take a waveform and clip it, the resulting waveform actually carries less energy (think of the corresponding integral), but more of that energy is pushed into the higher frequencies. It's this – the unexpectedly large amount of high-frequency energy – that kills speakers because their crossover networks push it into the tiny, tiny tweeters, and they are utterly unprepared for it.


>> ... the resulting clipped waveform carries a lot more energy than an unclipped one.

> Is this claim actually true?

Yes, it is -- but it depends on how we define "clipped".

> My understanding is that if you take a waveform and clip it, the resulting waveform actually carries less energy (think of the corresponding integral)

Only if the clipping reduces the peak value. If you compare a sinewave with a peak value of 1, and a square wave with a peak value of 1, the square wave has a substantially higher average level (with a ratio of pi / 2).

> It's this – the unexpectedly large amount of high-frequency energy – that kills speakers because their crossover networks push it into the tiny, tiny tweeters, and they are utterly unprepared for it.

Yes -- the rate at which the speaker cones are required to move is an additional factor. But for a "clipping" definition that clips by means of trying to exceed the available voltage, these two effects add.

http://i.imgur.com/oE5NFZ9.png

In the above linked image, the red trace is sin(x), the integral for the interval 0 < x < pi is 2. The green trace produces an integral of pi. The ratio of the two is pi/2, and the speaker power difference is (pi/2)^2 = 2.46 (because the speaker's power is the square of the applied voltage).

The green trace is what you would get if you simply turned up the volume beyond any reasonable setting -- the amplifier produces a clipped version of the sine wave and the peak value is equal to the supply voltage.


> Only if the clipping reduces the peak value...

I don't know of any widely used definition of "clipping", nor any definition that fits the context of this discussion, that allows for a signal's peak value not to be reduced. It's called clipping because the extreme values look to have been clipped away, as if by scissors. The parts that have been clipped away contain energy, don't they? So won't the clipped signal will carry less energy than the original?

When you take a sine wave of peak value 1 and clip it, what you get is not a square wave with a peak value of 1. Rather, you get a peak-truncated sine wave in which values in excess of the clipping threshold V are replaced with the clipping threshold. There's less power in this clipped sine wave than in the original because min(V, |sin t|) <= |sin t| for all t.


> I don't know of any widely used definition of "clipping",

But there is one. In electrical engineering, it's any process that arbitrarily limits a signal's amplitude. By far the most common meaning is a signal that exceeds the voltage range of an amplifier or signal pathway.

> nor any definition that fits the context of this discussion, that allows for a signal's peak value not to be reduced.

See above.

> It's called clipping because the extreme values look to have been clipped away, as if by scissors.

Yes, but this can result from trying to pass a signal too large for the circuit, or it can mean an intentional scheme in which a fixed signal amplitude is truncated, the meaning you're discussing.

In the present discussion, in which a volume setting is increased until the speakers are jeopardized, the meaning is clear -- it's an increase in signal amplitude that the amplifier cannot support, resulting in the waveform being clipped at the maximum available amplifier voltage.

> The parts that have been clipped away contain energy, don't they? So won't the clipped signal will carry less energy than the original?

Not if the signal amplitude is increased. In the present discussion, the problem is being caused by raising the volume level too high, which causes the signal to exceed the available amplifier voltage. My diagram shows this case:

http://i.imgur.com/oE5NFZ9.png

The red trace is the maximum volume setting that the amplifier can support without distorting the signal. The green trace is a much higher volume setting that essentially reduced the output to a square wave. In both cases, the peak voltage is the same.

> When you take a sine wave of peak value 1 and clip it, what you get is not a square wave with a peak value of 1.

That depends on how you define "clip". If you increase the size of the sinewave, clipping takes place at the maximum voltage. If you clip by reducing the possible range of voltages, the sinewave remains the same size but maximum amplitude goes down. The present discussion revolves around the first of these choices.


We must be talking past one another. I thought I was speaking in the electrical-engineering sense of clipping (my undergrad studies were in EE).

In any case, to make sure we're talking about the same things, I'll be more formal. Let y(t) by a time varying signal. Now define a maximum amplitude V > 0. Let us say that clipping occurs at time t if |y(t)| > |V|. Define the clipped version of y to be w(t) = max(–V, min(V, y(t))).

Now:

Claim 1: |w(t)| <= |y(t)| for all t. That is, the clipped version of the signal is contained within the unclipped version. Proof: Follows from the definition of min, max, and V.

Claim 2: The clipped version carries less energy than the unclipped. Proof: Follows from Claim 1 and integration.

Now, here's where you lose me. The claim you made that sparked this conversation was this: "the resulting clipped waveform carries a lot more energy than an unclipped one." But this claim seems to contradict my Claim 2.

Can you show me how to reconcile these seemingly contradictory claims?

Edited to add: I'm not claiming that these claims can't be reconciled. Rather, I'm hopeful that thinking about the exercise will help us to see how we're talking past one another.


I think he or she's saying that the speakers were designed with the expectation that the largest signal it would handle is a sine waveform with amplitude = the dynamic range. So when a square waveform comes along (as a result of clipping a higher amplitude waveform) it drives the speaker with 2.4x more power than expected.


Here's the first crossroad, where we diverge:

> Now define a maximum amplitude V > 0.

The problem being discussed is one in which the user cranks up the volume such that the maximum volume level is far exceeded, and the amplifier circuit, which cannot reproduce the higher level, instead clips the waveform at the supply voltage.

> The claim you made that sparked this conversation was this: "the resulting clipped waveform carries a lot more energy than an unclipped one."

And it does, as you can see from this diagram:

http://i.imgur.com/oE5NFZ9.png

The red trace is the 100% volume level for the system, and it is not clipped. The green, "clipped" trace is far above 100%. It's really very simple.

> But this claim seems to contradict my Claim 2.

Yes. Your claim 2 doesn't apply to a case in which the maximum output voltage of the amplifier cannot reproduce the input waveform. So instead the amplifier clips its input signal at its voltage limits, as the above diagram shows.

The interesting thing about this analysis is that two ways to analyze it produce the same result.

If we use a simple integration of the unclipped and clipped cases, we see a power increase of 2.46, as discussed earlier.

If instead we use Fourier analysis to examine the harmonics of a sine wave and a square wave, the square wave's higher harmonic energies sum to 2.46 of the original sine wave's energy level in the speaker (but pi/2 above the sinewave voltage levels):

Sine wave harmonic lines = 1f

Square wave harmonic lines = (4/pi) sum(sin(2 pi f t (2k-1) / (2k-1),k,1,oo) (http://en.wikipedia.org/wiki/Square_wave#Examining_the_squar...)

The outcomes obviously have to come out the same. The above shows how they do it.


OK. I think I see where our signals are getting crossed. I look at your diagram and think, The green signal g is not what you get when you try to output the red signal r but the output stage clips it at the supply voltage (my V). Rather, the green signal g is what you get when you take the red signal r, amplify it by A = Infinity, and then try to output that new signal rA, which the output stage then clips.

For all A > 1, |rA| > |r|. Therefore, I have no problem agreeing that a clipped rA carries more energy than the original r. (In fact, this is just saying that bigger signals carry more energy, regardless of clipping.)

To me, your original statement read as though it made the following claim: If your amplifier tries to output a signal r but clips off the peaks, what you get out is a signal that carries more energy than r. (This is the claim I found hard to believe.)

But what you really meant (I think) was that, if you take a sine wave as input and, as a human controlling the volume knob, keep turning up the volume until the sine wave's maximum amplitude so far exceeds what the amplifier can reproduce that it comes out looking like a square wave, then that square wave carries more energy than the original, un-volume-adjusted sine wave. Is that what you meant?

If that's what you meant, I have no problem believing your claim. It's just that I wouldn't call turning up the volume knob to be part of the "clipping" process, but rather amplifying. When you turn up the volume knob, what you get out is always a "bigger" signal, even if it's clipped.


> It's just that I wouldn't call turning up the volume knob to be part of the "clipping" process, but rather amplifying.

But it is, indeed it's the most common example of clipping in engineering practice. Consider two alternatives -- one in which the amplifier is able to accommodate a great increase in volume without any distortion, and another in which it cannot.

In this image:

http://i.imgur.com/g8txTmC.png

The blue trace represents maximum normal volume (100%). The green trace represents a system in which the amplifier can accommodate a great increase in volume setting (200% of normal), simply because its power supply voltage is at least twice as high as that required for 100% volume. The red trace represents a system that cannot tolerate any volume settings greater than 100%.

In this diagram, the 200%-volume green trace has a higher subjective volume level than the 100%-volume blue trace (i.e. twice as high in voltage, four times as high in speaker power). The red trace, which would sound very distorted to the user, also has a higher power level than the 100% trace, but less than the green trace. The red trace is typical of systems that are limited to 100% volume by power supply voltage.

The red trace represents the most common example of "clipping" as it takes place in actual equipment and in engineering practice. Its output has more energy than the blue trace, and less than the green trace.

-- former NASA engineer


I agree with everything you wrote. Again, however, I think we're talking past one another. When you talk about clipping, you seem to mean turning up the volume until a signal clips. This both amplifies the signal and clips off its extremes. What I mean by clipping is to take a signal and clip off its extremes.

That sole difference explains our entire conversation. In your view, clipping involves making the signal bigger. That bigger signals carry more energy naturally leads to your claim. In my view, clipping a signal makes it smaller, leading to the opposite claim.

Thanks for sticking with me through the conversation.


Consider it in the frequency domain: clipping adds odd harmonics.

The fundamental frequency is reduced in energy a little bit, but the higher frequency harmonics end up containing relatively large amounts of energy.


VLC allows amplification of the INPUT above the sound that was decoded. This is just like replay gain, broken codecs, badly recorded files or post-amplification and can lead to saturation.

I have to say, there may be a UI issue here as well. I blare my speakers with VLC playback something like 5X times more often than QuickTime player or mplayer. I use all 3 with about equal frequency.


> I have to say, there may be a UI issue here as well.

I think this is fixed in the latest releases...


How? Has the non-OSX VLC UI changed recently without my noticing, or is it a change in max volume or something?


> The issue here is that Dell sound cards output power (that can be approached by a factor of the quadratic of the amplitude)

This is correct, and for those who want to know the technical reason, we can look at the Dell speakers (any speakers) as a resistive load (only approximately true). For a resistive load, the power increases as the square of the applied voltage, because the power in a resistor is equal to the voltage times the current, and both the voltage and current are increasing as the audio output level is increased.

In terms of Ohm's Law: P = E^2/R.


Any other manufacturer do that? (someone mentioned HP below)

I am a VLC fan (thanks! I wish I was skilled enough to contribute to the project) and right now using a ASUS laptop, I want to know what manufacturers I should NOT buy from next time (I bought this ASUS because I tried to buy from DELL and their site was buggy and did not closed the transaction... good to me their site was buggy!)


> Any other manufacturer do that?

We heard about HP and Dell doing that, and ONLY in the version they shipped to India or South-East Asia (Do they ship worse components there?)

> I wish I was skilled enough to contribute to the project

There is a very high chance that you are skilled enough, to be honest.


Even if you don't know much, there's always grunt work to be done to get to know a project.


> (Do they ship worse components there?)

There is actually a chance that they might be, considering not all models are available in all regions, thus there are models that are marked for South-East Asia. So as a manufacturer, it's relatively easy for them to be biased.

That said, vendors in South-East Asia have a history of being scammers and taking out original parts and replacing them with cheaper hardware, so that could be a cause too, and HP might be innocent.


Back when I worked for a company that supplied crapware for preinstallation, I was given the impression that Dell and the other hardware supplies do lots of testing of their hardware/software configuration but in the most dumb-shit kind of way. The whole configuration is more or less treated like bucket chemistry - if you can get the desired combination to work, that's what you specify and exactly why it works or doesn't work won't be investigated.

The thing about this is that such behavior makes sense when the suppliers are integrators of the product of twenty or fifty or however many suppliers spread around the globe all relentless trying to cut costs (including cutting corners in implementing whatever spec their chips are supposed to satisfy). The integration itself naturally involves putting together the cheapest stuff and seeing-if/hoping-that it will work. So when you have such a fragile chain of elements, just blank-refusing to allow substitutes makes sense in this rather twisted view. Maybe Windows Media Player fails to call the parts of the API that are "bad" and not documented as bad.

Obviously, I'm not saying this approach is justified, simply that sometimes the irrationality is "sincere".


How about detecting Dell Speakers and automatically setting the max volume to 100%, with a notification so the user can give an a-ok if they want to go higher. That way, at least users know and can make a decision. Similar to the Android warning if you set your volume too high that it could cause hearing damage.

I'd prefer to be warned rather than surprised by this!


That's impractical. VLC is just using the standard OS API to send some sound to speakers. Can you imagine every piece of software checking for every piece of esoteric hardware and having some special behavior?

Maybe Microsoft could regulate the output for junk speakers, but really, Dell is the one to blame here.


> Can you imagine every piece of software checking for every piece of esoteric hardware and having some special behavior?

This is what MS Office does. A Microsoft engineer told me once that because many printers lie to the OS about their capabilities, they built a giant lookup table into the Office, that basically consists of "if printer model X, vendor Y and firmware Z, then don't trust it about the fonts onboard, render the text before sending instead".


I remember back in the day doing DirectDraw/Direct3D programming, I had to have lots of "if video card type == x, then ignore these capabilities and do this other thing instead" hacks. A much bigger issue back then when we had more than three video card manufacturers. (it's still a minor issue today ... nVidia cards tend to be way more permissive about OpenGL calls than AMD cards. But I can afford two discrete cards and one onboard chipset.)

It's so completely impractical for a hobbyist project to own every possible piece of hardware, or at least a huge majority of it. Yet it's nothing for a Fortune 500 company to do the same.

Really slants the playing field away from independent software developers.


Or, you could crowdsource an open-source abstraction layer; this would level the playing field again.


Impractical and impossible are of course two different things. It's sort of funny to consider a scenario in which a manufacturer adds a thermistor to the speaker coil assembly to measure the temperature & lower the amplifier output via the BIOS as the temperature in the voice coil rises to a dangerous level. I suspect that might cost more than using good speakers in the first place but then again if there's limited room for speakers which would lead to heat buildup in the voice coil such a solution might be practical.


VLC doesn't do anything particularly interesting, though. There are plenty of CDs that already apply this filter to the music, meaning there's no way you can play that CD without damaging their speakers.

The problem is simply that the Dell speakers are piles of shit.


Yeah, this sort of dynamic range compression is standard for the music industry (sadly).


You've missed the point..


> How about detecting Dell Speakers

How would you do that?

And no, this is not specific to VLC.


Pump DC into the speakers at full power, and pop up a dialog asking the user if their speakers have melted yet.


Assuming the speakers are connected through an audio jack, is there a realiable way of detecting specific speaker models?


The problem being discussed is by no means limited to Dell speakers -- it would be a problem for any small laptop speakers connected to an IC that can overdrive them under specific circumstances.


An entire category that I just tough as empty, before reading this article and discovering one element.

Have you heard about this problem in any other laptop before?


> The issue here is that Dell sound cards output power (that can be approached by a factor of the quadratic of the amplitude) that Dell speakers cannot handle. Simply said, the sound card outputs at max 10W, and the speakers only can take 6W in, and neither their BIOS or drivers block this.

In other words, due to increase in amplitude, increasing volume over 100% can break the hardware? I am not trying to blame VLC, just that your statement "At worse, this will reduce the dynamics and saturate a lot, but this is not going to break your hardware" sounds a bit fallacious in the context of your own explanation.


Dell can't agree with this without having to do a hardware recall or refund people. It is much easier to blame your software (and cheaper by a hundred million of dollars in bad press/computer returns/hardware thrown away/call centers dedicated to this issue/etc etc).

Sad to see behavior like this


Aside from Dell's crappy hardware, wouldn't it be possible to just compress the sound more so quieter passages would become louder but those passages already near the maximum wouldn't get clipped? That should definitely sound better...


Just from this comment, it seems like you guys have a pretty interesting problem domain. I'm going to take a look at the VLC repo and see if there's anything I can contribute, thanks for getting me interested!


If you do, I highly recommend The Computer Music Tutorial[0]. It's an older book but provides an excellent overview of how digital audio works.

[0] http://www.amazon.com/gp/product/0262680823


I wasn't aware of this and now the speaker on my 3 year old Dell Studio doesn't work properly. :(

And here in India I hear people say that you shouldn't install VLC on laptops .. (even if its not a Dell laptop) !!


Arh, I remember all sort of speaker problem ages ago. Never got around to figure what was wrong. I suppose this is it.

But does anyone have list of Manufacture that does provide speaker with BIOS Protection?. Does Apple do?


How would that work? Just detect signals with an abnormally high RMS and block them?


With a compressor or limiter. These are solved problems in both analog and digital signal processing.


thanks for clarifying !

well I guess their support people are not engineers, only technicians, hope this blows back into DELL PR instead...


"As the main developer of VLC". Sorry, but no: Rémi Denis-Courmont has contributed 2x more than you did.


> But this is exactly the same if you put your mp3 file through Audacity and increase it and play with WMP, or if you put a DirectShow filter that amplifies the volume after your codec output.

Indeed, and doing that destroys audio equipment just as effectively. It's the reason apps like SoundForge, Audacity and others have clip warnings on their level monitors: so users don't create audio data that destroys listeners' equipment.

The problem is VLC gives consumers (who, like you, don't know better) an exceptionally easy way to create clipped audio. Depending on the characteristics of the source, the degree of clipping VLC can create can destroy even pro equipment. If I were an engineer at Dell, I'd recommend denying warranty claims too.


I thought they warned about clipping because it sounds awful.

There is no excuse, none, nada, zip, zilch, in 2014 for allowing userland software to generate signals powerful enough to damage built-in hardware.


Agreed in principal, however all the ways that could prevent rogue userland software from playing damaging audio (eg. using a limiter of some sort) would either distort or introduce quite a bit of delay to otherwise perfectly safe audio played by responsible software.


How would it distort audio played by responsible software? Pick a limit where "100%" doesn't destroy the hardware. Enforce it. No distortion, done.


It's more complex than that. Let me explain:

Audio is typically passed into a soundcard's digital audio converter (DAC) as integers representing samples of the audio waveform. For example, a full volume sine wave looks something like this[0]. That signal is perfectly safe to play on any hardware. However, if you take that same sine wave and increase the amplitude you end up with values outside the valid range so you have to cap them. You get something that looks like this[1].

Lopping off the tops and bottoms of the waveform is clipping, and the newly created sharp edges in the waveform are what can damage your speaker. They require a ton of energy to play (producing heat) and in some cases can trigger the buildup of high frequency harmonic oscillations in your speaker's voice coil that can eventually crack it. More expensive speakers last longer but virtually all speakers eventually "blow" under such circumstances.

The trouble is playing waveforms like that once in a while is totally ok and short bursts of very similar waveforms exist benignly in lots of stuff you listen to every day. And while it's trivial to know if you're creating clipped audio, it's very difficult (read: processor intensive) and error-prone to detect it after the fact. When you do detect it, your solutions are to either drastically lower the global volume so the edges have a lot less energy, or distort the waveform to make those edges more smooth. It's really, really hard to avoid false positives though and not end up "enforcing" against audio data that's natural and perfectly ok in moderation.

[0] http://upload.wikimedia.org/wikipedia/commons/thumb/b/bf/Pcm... [1] http://www.st-andrews.ac.uk/~www_pa/Scots_Guide/audio/clippi...


Thanks for the info. I was familiar with most of that, but didn't think the difference would be so big. How much of a "safety factor" are we talking about between the ability to handle normal audio and the ability to handle this sort of catastrophic case? In other words, how much would you have to turn down the maximum volume limit? Is it a factor of 2, or 10, or 100...?

If it's a factor of 2, for example, just take the 3dB volume loss and move on.

I don't see why detecting the situation is so hard, though. Build a simplistic model of the amount of energy dumped into the speaker and the amount dissipated, run the audio through that model, and then limit the volume when the amount still in the speaker gets too high. This would let through small amounts and limit large amounts, just like you'd want. For a really simplistic model, run the signal through a high pass filter, integrate the output, then apply a running average to that. When the running average surpasses a value that indicates the speaker is reaching its limit, cut the volume. I take it that this doesn't work?


It's hard to know. Speakers are insanely complex beasts whose electrical reactance changes depending on the signal. To simplify things we use measures like RMS current ratings for amplifiers because if you put a sine wave through a speaker they tend to approximate a resistive load due to most of the load being air, and we use nominal impedance to describe speakers because while even though for something as simple as a sine wave a speaker's impedance can vary 4x from nominal depending on frequency, it at least gives us something we can reliably measure.

Once the signal is more complex than a sine wave things get crazy. The more frequencies in a signal, the harder it is to model the power draw since different parts of a complex curve cause the speaker to act more like the low resistance inductor it actually is. Discontinuities and areas of constant voltage (both caused by clipping) are the worst, and to make things even more fun the amplifier is part of the system and affects things as well.

But assuming you know a lot about the speaker, the amplifier and the DAC you could probably build a model that works well for simple sinusoidal audio, but that doesn't cause problems anyway. All bets are off for anything more complex.

So instead you're left with a few options: buy reasonable gear and don't play crap audio, play crap audio but massively overbuild your system so you lower the risk of getting into the unknowable danger zone that changes depending on what you're playing, or use a bunch of heuristics on a signal and try to distort it in some way so it's less potentially damaging.

The problem with the latter is since you don't know where the line is it's easy to be overzealous and end up distorting lots of stuff you don't need to. Problem with the middle is you either end up with something much larger and more expensive than you need, or you cripple what you have to give you a wider margin of safety. Problem with the first is apps like VLC make it exceptionally easy to accidentally play crap audio. Pick your poison.

Could Dell spend a couple extra bucks for higher quality components and create a wider margin of safety? Probably yes. But at the same time the VLC developers are being reckless by putting a tool into consumers hands that makes it so easy to play potentially damaging audio signals.

Edit: clarifications


I don't really get this description of mitigations as "overzealous". Sure, there's going to be some margin there, but that's just good engineering. The rev limiter on my car's engine doesn't kick in right at the critical RPM where everything falls apart, but some amount below. My CPU's thermal underclocking doesn't start right at the temperature where the component fails, but some comfortable distance below. You could argue that both of those are "overzealous" protections that cause me to lose out on performance I could potentially have otherwise, and that's true, but good engineering in this case generally means using a safety factor for these things.

I don't understand how you can blame VLC at all. Technically, Dell shipped a tool right on the machine that makes it just as easy to play potentially damaging audio signals. Internet Explorer could just as easily play a WAV file that's been crafted to destroy the computer's speakers. The correct approach is to remove that ability, not blame a tool that accidentally triggers the problem.


Dynamic audio power limiting introduces a whole host of audio distortions that would cause your computer to lie to you by not playing what you told it to. Your computer lying to you is a problem in principal I think, but specifically if you're doing any kind of sound editing/composition it's a huge problem because now you can't know if what you're hearing represents what you're creating or if your os or sound card has messed with it somehow.

As I mentioned, Dell could turn down the input volume to their amp/speakers. It doesn't totally eliminate the ability for a user to damage their speakers but it also doesn't create any distortions. I would guess that's what their bios update does. It just makes everything quieter for everyone.

I appreciate the principal that userland code shouldn't be able to damage hardware, but I'd much prefer my computer not lie to me. Now, I'm also not opposed to dynamic power limiters in general. In fact, that's exactly what VLC should be using if they insist on letting users crank things past levels that would otherwise clip. It just doesn't belong in the os or hardware.


Your computer's already lying to you by piping your audio through crappy speakers. Is the distortion actually going to be worse with a limiter in place?

I really don't understand, why do you think this functionality doesn't belong in the OS or the hardware? To me, you're basically saying that you're OK with giving arbitrary web sites the ability to damage your hardware, since that's effectively what that ends up implying.


For really bad audio, no. For otherwise perfectly fine audio, yes.


Remember that each technical measure you add to a design represents another (a) cost (b) size/weight, and (c) possible failure mode.

> When the running average surpasses a value that indicates the speaker is reaching its limit, cut the volume. I take it that this doesn't work?

No, it might work, but it's really a question of cost, complexity and represents an added failure mode -- something else that can go wrong.


In my opinion, it should be impossible to physically damage a computer from user-space code. I'm surprised that this seems to be such a controversial opinion.

Given that, a computer which allows random audio API clients to destroy the computer's speakers is not correctly designed. Certainly, it may add cost, size, and weight, but if that's what you need for correctness, then that's what you need for correctness.

The brakes on a car add cost, size, and weight, but you can't just leave them out because you don't feel like accepting that penalty.


> In my opinion, it should be impossible to physically damage a computer from user-space code. I'm surprised that this seems to be such a controversial opinion.

I don't find that controversial at all, but as time passes, it seems there are more ways that user activities can bring a computer down. The most obvious way is by sending out-of-bounds signals to storage devices that can erase or even physically damage them, but this example of destroying speakers, even though it should not be allowed to exist, seems plausible also.


In what scenario can userland code send signals that will physically damage storage devices?


Over my long career (approaching 40 years) I've seen any number of peripheral devices that responded to bad instructions by tearing themselves to pieces. One example would be a HDD driver that inadvertently ordered the R/W heads to move to a nonexistent location. That's pretty common, and sometimes results from a bug in the code, not anyone's intention.

Another common error is to allow a system power shutdown without parking the HDD R/W heads in a sacrificial area, so subsequent mechanical shocks won't cause the heads to collide with a legitimate data surface. This problem can be caused by insufficient power supply capacity -- a capacity that must detect the power shutdown and allow the head traversal to complete before the remaining power is used up.

Just examples, there are many similar ones.


I think you may have missed the word "userland", because neither example should be possible outside the kernel.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: