"Ping" is the loud ticking sound produced by preignition and minor detonation.
"Knock" is a very loud hammering sound produced by major detonation. Knock can also result from metal collisions.
Preignition occurs when fuel and air ignite within a combustion chamber prior to the ignition spark creating a single flame front. The expanding gases push down on the top of the piston prematurely before the piston reaches its optimum position within the cylinder. Preignition is akin to tapping the top of the piston with a small hammer. The "size of the hammer" depends on the timing of the preignition. Typically, the "ping" created is reminiscent of a couple of BBs in an aluminum soda can that is violently shaken end-to-end. However, depending on the timing of preignition, the "ping" can be more severe to the extent of small marbles rattling in a can. Preignition often is caused by a hot spot within the combustion chamber such as overheated spark plug electrodes as well as excessive compression pressures.
Detonation occurs when a second pocket of fuel and air ignite within the combustion chamber after the ignition spark has occurred, resulting in two colliding flame fronts. The collision of the two flame fronts effectively creates a supersonic acceleration at their intersection that results in a "ping" if minor, or "knock" if major. The resulting extreme pressure created by detonation is akin to hitting the top of the piston, cylinder head, and cylinder walls with a BIG hammer. Prolonged detonation can be very destructive to the entire combustion chamber, the rods, the crankshaft, and the block webbing. The "knock" created is reminiscent of a small marble shaken in a plastic coffee can to a hammer striking the cylinder head, depending on severity of effect. Detonation can be caused by one or more hot spots within a combustion chamber such as carbon peaks, sharp edges, and poor squish/quinch as well as by overadvanced ignition timing and poor coolant circulation through the cylinder head water jackets.