My car is in the shop for a repair, and they gave me a loaner. It's a Chevy Cruze Diesel. Sitting on the driveway, my wife said, "It sounds like a truck". It does. So what exactly it is about diesel or diesel engines that make them sound different than gasoline?
As already stated, the ignition source between gasoline/gas engines and diesel engines are different and this is the primary reason for the difference in sound. I will try to explain those differences so you you'll understand why the sound is there with one, rather than the other.
NOTE 1: There is a diatribe here, but bear with me as I attempt to answer the question as I believe the OP is requesting. I need to explain the differences for one to understand why a diesel engine sounds like it does.
Fuel: Diesel v. Gasoline (Petrol) -
As a fuel, diesel has a higher density than does gasoline. It is about 12% denser than non-ethanol gasoline (with ethanol based gasoline, the density is even higher, depending on the mix). Diesel offers a higher volumetric energy density at 35.86 MJ/L (128,700 BTU/US gal) v. 32.18 MJ/L (115,500 BTU/US gal) for gasoline, some 11% higher, which should be considered when comparing the fuel efficiency by volume.
Engine Mechanical Differences: Diesel v. Gasoline - Three major differences
First difference - Compression
Fuel, whether gasoline or diesel can burn with or without the help of compressed air, but the more the air is compressed, the greater the efficiency from the burning fuel. With this in mind, understand that when someone refers to compression in an engine, they are talking about the ratio at which the air (or air/fuel mixture in gas engines) is squeezed before ignition occurs. In a gasoline engine, a rule of thumb is the engine will see a 3% increase in efficiency for each point of compression introduced (all other engine components staying the same). I will assume this is probably about true for diesel engines as well. The static compression ratio of regular gasoline engines runs about 8.0:1 up to around 11.5:1 (with high performance engines reaching over 14.0:1 - EDIT: It has been brought to my attention that the Mazda Skyactiv-G engine comes with 14:1 CR outside the US and 13:1 CR in the US. Mazda uses other technology to help reduce knocking, but this high of CR is not the norm for gasoline internal combustion engines). An automotive diesel engine will run around 14.0:1 up to the 18.0:1 arena.
NOTE 2: I differentiate between static and dynamic compression ratio here, because there is a huge difference in numbers and how they are figured. I won't go into the difference, just know there is a difference.
NOTE 3: I differentiate between automotive and non-automotive diesel engines, because while all diesel engines basically run the same, there are some huge differences between automotive and large marine diesel engines.
Second Difference - Fuel Delivery
It used to be the primary fuel delivery method for gasoline engines was a carburetor. This was true up until the mid to late 80's, at which point many car manufacturers started realizing the benefits of fuel injection. This type of fuel injection is indirect fuel injection, meaning the injector which meters the fuel going into the engine sits outside of the combustion chamber and inside the air intake tract. It relies on the movement of air through the intake tract to help atomize the fuel and get it into the cylinder. Very recently (around 2010), auto manufacturers started utilizing direct injection, which disperses fuel directly into the combustion chamber.
Diesel engines also utilize direct injection. They have used this method since about 1891 when Herbert Akroyd Stuart invents the first internal combustion engine to use a pressurised fuel injection system.
Third Difference - Ignition Source
Easily put, diesel engines utilize heat to ignite the fuel, while gasoline uses electricity (yes, the spark is hot, but hopefully you see the difference). Gas using electricity to create combustion is pretty easy to figure out. Spark plug goes zap, the air/fuel goes boom. The air/fuel mixture has to be just right in order to do it and the spark has to come at just the right point (timing). The spark works just fine for a gasoline engine because the fuel will atomize and evaporate within the air, which makes it very easy to burn. The small ignition source which is the spark is more than enough to start the burn of fuel and allow it to continue to burn until the mixture is completely exhausted.
Since diesel is so much heavier than gasoline (it is technically considered an oil, much like kerosene and heating oil), it will not evaporate very well in the air. In order to get it to burn fast enough, there has to be an ignition source of sufficient heat. To accomplish this heat, the piston compresses the air inside the cylinder to such an extent, it heats it up to over 1000degF. Let me quote the Wiki article on Diesel Engines to finish this:
At about the top of the compression stroke, fuel is injected directly into the compressed air in the combustion chamber. This may be into a (typically toroidal) void in the top of the piston or a pre-chamber depending upon the design of the engine. The fuel injector ensures that the fuel is broken down into small droplets, and that the fuel is distributed evenly. The heat of the compressed air vaporizes fuel from the surface of the droplets. The vapor is then ignited by the heat from the compressed air in the combustion chamber, the droplets continue to vaporize from their surfaces and burn, getting smaller, until all the fuel in the droplets has been burnt. The start of vaporization causes a delay period during ignition and the characteristic diesel knocking sound as the vapor reaches ignition temperature and causes an abrupt increase in pressure above the piston. The rapid expansion of combustion gases then drives the piston downward, supplying power to the crankshaft.
NOTE 4: I want to point out, newer truck diesel engines (and I assume autos as well), have started using injections systems which, instead of injecting all the diesel at once, pump several smaller amounts of diesel into the engine, which quiets the "diesel noise" you hear from them by a large amount. This also provides better fuel economy as well.
NOTE 5: Diesel engines typically have better fuel economy than gasoline engines, mainly due to them have a better thermal efficiency.
NOTE 6: If you have read this far, you must truly be insane.
The biggest factors that makes a diesel sound the way it does is the method by which the diesel is injected into the cylinder prior to/during compression and the fact that their compression ratio is so much higher than a gasoline/petrol engine. This is a roundabout way of saying that the compression-ignition causes the characteristic sound. Secondary factors include engine design, intake and exhaust manifold shape.
UPDATE: I'm sorry but there's not much more to say. The clacking sound is the diesel igniting under high pressure and high (piston) velocity and the loud roar is caused by the velocity of the exhaust gas and the shape of the exhaust manifold.
The components which make up the exhaust note are the air, fuel, compression ratio, valve timing, exhaust, turbocharging, and displacement.
The engine in the Cruze Diesel has a compression ratio around 16:1.
The fuel is important, because diesel and petrol burn differently.
The combination of all these factors is what results in the different exhaust notes. You might be looking for a more complex answer than "it sounds different because it is different," but there really isn't one.
also Diesel engines have a longer stroke than ordinary petrol engines. which means pistons travel a longer distance that it does in petrol engines. And turbo/super/ram air intake systems have completely different timings than naturally aspirated petrol engines.
The clatter usually associated with diesel motors is a result of the much higher forces of combustion in a diesel motor which at or about TDC (top dead center) "slaps" the moving assembly. Some of the newer motors are much quieter by virtue of having a pilot injection as well as (in the case of piezo injectors) up to 7 injection events per combustion cycle.
The Diesel engine noise is largely a result of the pressure needed to inject fuel into the cylinder, this pressure also resulting in atomisation of the fuel.They squeeze the air/fuel together and it ignites. That create the noise.