On my 5G, Doom sounds are at the correct pitch with r20590. However, they have a kind of crackly distortion. Changing SAMPLECOUNT from 128 to 256 in i_sound.c improves things somewhat, so I think the distortion is due to buffer underruns (audio data is being played faster than it's delivered). Further increases of SAMPLECOUNT don't seem to help, so a different solution is necessary.
Edit: Sound plays fine when sample rate is set to 11025. Resampling to 44100 is ok on the sim, so I still think the issue is underruns.
wm8758.c, in audiohw_set_frequency: CLKCTRL_MCLKDIV_8, ADDCTRL_SR_12kHz
i_sound.c: #define HW_HAVE_11
(This is just a quick experiment. It makes your music play slow and at low frequency. Proper support for switching sample rates seems easy and is probably coming soon.)
(Edit: No need to change BCLKDIV because BCLK already depends on SYSCLOCK. Interesting how BCLK is faster than necessary)
Edit: I created a patch which adds support for various sample rates on the 5G iPod
. With it, I don't get any problems with sounds in Doom. However, it doesn't address what seems to be the root cause: sound in plugins can underrun far too easily. BTW. The patch also adds support for various recording sample rates.
Edit: Sound is also glitchy in Rockbox 3.1. Did Doom sound ever work properly on the 5G iPod?
Edit: Sample rate setting was committed in r20635. On the 5G iPod, 11 KHz is used now and there seem to be no more underruns.