Which part are you asking about? Both sentences are grammatically OK, but, in fact, make little sense when read with a careful eye.
- I am wondering now, at this moment
- I wondered at a specific time in the past (last night at midnight?) or I (colloquially) I wonder...
Quote:... how he could sleep while you were listening to the radio so loudly.
The nonsensical part. Listening is a silent act, it makes no sound. The radio makes the sound. So rewrite thus:-
... how he could sleep while you were listening to the radio
which was playing so loudly.
... how he could sleep while you were
playing the radio so loudly.
3. My addition
A general observation not specific about time:-
I wonder how he can sleep while you play the radio so loudly.