Just like energy from bullets comes from velocity and projectile weight, sound energy is the product of 2 parts. Pressure does make a big difference but total gas volume still matters because sound travels as an ever expanding sphere so the inverse square law applies.
There is a relationship but it's not quite that simple. To make things that simple we're going to assume that there's an atmosphere and that that atmosphere is constant in density and makeup and that it's roughly 1MM pascals (~10 atmospheres). We're not going to address variable atmospheric properties like density with elevation because it can confuse the hell out of things. If pedants would hold their protestations that would be excellent as this is intended as a simplification for a layaudience.
Sound has 2 big factors that we measure: Amplitude and Frequency. Frequency I'm pretty sure everyone gets, that's just the pitch of the sound... how many wave crests per unit time. Amplitude can be thought of as the loudness or how high and low the wave crests and troughs go.
Given the caveat above, it's not pressure but pressure differential between the inside of the pressure vessel (barrel) and the outside (atmosphere) and how long it takes for the event to occur. If you're running 1,100,000 Pascals of pressure inside a balloon and instantly release it (for arguments sake, making a single wave crest and trough of pressure) then you'll get a sound of X apparent loudness. If you raise the pressure inside the balloon to 10,000,000,000 Pascals you'll get a sound that's a bit more apparently loud (if I did the math almost 4dB higher which doesn't seem like much which is why I've avoided using dB as a unit of measure. It is mathematically a massively more powerful event). Now we did that with time set as near to zero as could be done without a divide by zero error in the math. If we slow down the release of pressure then the pressure differential inside the balloon gradually is neutralized and so the sound starts loudish but rapidly peters out.
So to finish answering your question: It has to do with how much gas is being dealt with (the size of the powder charge) and how high the pressure was to begin with.
Using your own numbers and some more:
22lr 25000 pressure: Charge weight 1gr
9mm is listed as having a max pressure of 35000 and 38000 for +p: Charge weight 3.5gr
40 is also 35000: Charge weight 4.5gr
38 special is a lowly 17500 and +p is 20000: Charge weight 4gr
357 mag is also surprisingly listed at 35000: Charge weight 12gr
357 Sig comes in at 44000: Charge weight 7gr
45 ACP is only 21000: Charge weight 5gr
And the 44 mag is 36000, also surprisingly: charge weight 24gr
223 rem is 62000: Charge weight 24gr
45cinderblock (my own wildcat) is >62000: charge weight is >15gr
So you'd expect a .40S&W to be marginally louder than a 9mm because both run about the same pressures but there's more charge weight in the 40.
Revolvers are a different beast because of the cylinder gap. That's why you don't see suppressors on revolvers except for oddballs with closing cylinder gaps like the Russian Nagant revolver. A ton of loud stuff exits the sides of a revolver near to where maximum pressures are at (which would be inside the cartridge case and cylinder) before anything happens out the front so revolvers can appear to be extremely loud even for their power level. Put a 9mm revolver and a 9mm semiauto side by side and I bet you'll say that the revolver is louder.
This is one reason why .223 rem seems so blindingly loud. It is blindingly loud. It's running .44mag size powder charges at very near 3 times the pressure. Put a .44mag Deagle next to an AR pistol (to be fair on barrel length and cylinder gap) and tell us which is louder. It's going to be the one with the higher pressure because they have they same basic charge weight.
If you put a .223rem next to my .45Cinderblock wildcat you'll definitely say that the 223 is louder. I've done this and it is. My .45Cinderblock is loud but nothing like a .223 even though pressures are higher with my .45C, because the gas volume is smaller.
