We use a spark plug in gasoline to ignite a mix of gas and air, so we know exactly when we can control the start of combustion. Diesel engines rely on a mix of diesel and air self combusting, so despite all the advances we’ve made, there is still a bit of variance between the cylinders when that self ignition point happens.
If you look at it on a graph (of pressure rise rate within the cylinder) Gasoline will be the same every cycle (assuming we don’t advance/retard the ignition) and diesel will show that rise moving forward and backwards slightly. This is that slightly uneven noise you get especially from older diesels that makes them stand out as a noise
The ELI:5 (this was way harder than I thought)
To make the car go, we set fire to some gasoline and air which we’ve mixed together and we use it to push a piston. In a gas engine we use a spark plug to set fire to this mixture, but a Diesel engine squeezes the mix a lot lot more until the mix begins to burn on its on, usually with a Big Bang! Because we turn on the spark plugs on a gas engine, we get to say “I want to start burning the mixture Now!” But in a Diesel engine there is a tiny tiny bit of difference everytime we get to the combustion (burning time) which means that it changes ever so slightly every time. The noise of the engine comes from this burning, so the petrol is smooth because it’s the same every time, but the diesel changes a little bit and the sound it makes is therefore a bit faster and slower sometimes.
There are a lot of close but incorrect answers here. The knocking sound comes from the rapid pressure increase that comes from injecting fuel directly into the compressed air in the cylinder at 3000 psi. Modern diesels pulse the injectors a few times for each combustion event which is why modern diesels are quieter. Had a GM engineer demonstrate this 10 years ago on a Duramax. 1 injector pulse per event caused a very loud and distinct diesel clatter. Changing it back to its default (I believe it was 4) caused most of the clatter to go away.
The distinctive diesel rattle has to do with the difference in the way diesel engines ignite their fuel versus gasoline engines.
With a gas engine, fuel is sprayed into the cylinders along with air. The air and fuel is allowed to mix before it is squished by the piston as it moves upwards in the cylinder. When the piston reaches the top, a spark ignites the compressed air-fuel mixture.
This spark sets off something called a flame front. If you’ve ever lit a gas stove or grill, you might have noticed that the flame kind of “runs” down or around the burner as it lights. The gas is coming out all around the element, but it takes time for the flame to make its way around. It happens so slowly, you can actually watch it happen.
The same thing happens inside a gasoline engine’s combustion chamber. The spark sets off something called a “flame front”, that propagates smoothly throughout the air-fuel mixture. This (relatively) slow, even process creates a smooth expansion of the gasses inside the cylinder.
With a diesel engine, there is no spark plug, and the fuel is not added to the cylinder until the air has already been squished by the piston. The fuel is forced into the cylinder just before the piston reaches the top, and it all ignites simultaneously in an explosion. This happens much more quickly than the flame front propagation in a gasoline engine.
Because of the way sound saves work, this gives a diesel engine combustion event a much harsher clacking noise. In a gasoline engine, the flame front spreads the explosion out over a much longer period of time. We’re talking milliseconds here, but when it comes to sound frequencies, the difference between 300 ms and 3 ms makes a big difference in how something sounds.
Latest Answers