GP32 Sound Plays @ Slightly Lower Pitch Than It Should


doogle

Still Fresh
Joined
Oct 27, 2004
Messages
6
Hi all!

I noticed today that my SoftStudio sound engine seems to be playing sound a semitone or so down from what it should be.
Most of the engine is cross-platform... atm only the audio 'driver' is either win32 or gp32. This allows me to test first on windows before sending it to my gp32. Most of the time, if it works on windows, it works on the gp32.
When playing a sequence out from FL Studio (the windows softstudio I use), and then when playing the sequence using my engine, exported MIDI files and the same .wav files, the pitch is correct. As soon as I play the sequence from my gp32 (using the same engine source, midi files and .wav files, but different audio driver) the pitch is slightly lower. It sounds fine apart from that, and if I was any kind of musician I probably would've spotted this earlier, but it's only now that I've noticed it (current test sequence has 7 drum sounds, bass, lead and strings... previous test sequence had 3 drum sounds and a arpeggiated bass line so maybe thats why).

I'm using sound code modified slightly from Mr Mirko SDK. I'm not saying it's his code... it's more likely an issue with something I did to the code. I know it could be some subtle difference between the gp32 and win32 versions, but I'd rather make sure the audio code was ok first.

Has anyone else come across this problem before? The audio DMA stuff seems to support abitrary sample rates (ie. not just 11025, 22050 and 44100Hz), so could it be some rate calculation thats off for some reason?

Thanks! (must learn to put same amount of information into less words dammit!)
Doogle
 
Hi all!

I noticed today that my SoftStudio sound engine seems to be playing sound a semitone or so down from what it should be.
Most of the engine is cross-platform... atm only the audio 'driver' is either win32 or gp32. This allows me to test first on windows before sending it to my gp32. Most of the time, if it works on windows, it works on the gp32.
When playing a sequence out from FL Studio (the windows softstudio I use), and then when playing the sequence using my engine, exported MIDI files and the same .wav files, the pitch is correct. As soon as I play the sequence from my gp32 (using the same engine source, midi files and .wav files, but different audio driver) the pitch is slightly lower. It sounds fine apart from that, and if I was any kind of musician I probably would've spotted this earlier, but it's only now that I've noticed it (current test sequence has 7 drum sounds, bass, lead and strings... previous test sequence had 3 drum sounds and a arpeggiated bass line so maybe thats why).

I'm using sound code modified slightly from Mr Mirko SDK. I'm not saying it's his code... it's more likely an issue with something I did to the code. I know it could be some subtle difference between the gp32 and win32 versions, but I'd rather make sure the audio code was ok first.

Has anyone else come across this problem before? The audio DMA stuff seems to support abitrary sample rates (ie. not just 11025, 22050 and 44100Hz), so could it be some rate calculation thats off for some reason?

Thanks! (must learn to put same amount of information into less words dammit!)
Doogle


The Problem is, that CPU clock, and Soundoutput freq depend on each other.
To playback a 44.1khz Sample, at the correct playback speed, you need a correct calculated Clockspeed. On spivvys web site is a little calulating tool for this.
 
Last edited by a moderator:
The Problem is, that CPU clock, and Soundoutput freq depend on each other.
To playback a 44.1khz Sample, at the correct playback speed, you need a correct calculated Clockspeed. On spivvys web site is a little calulating tool for this.

I've just compared the results from mr spiv's srate tool to the values that the code on the GP32 is calculating (InitIIS(), calcRate() using gp_getPCLK()) and they do match. However, srate says that the sound rate will be 21484Hz when I enter 22050Hz... does this mean that I'm not going to get exactly 22050Hz playback? (using PCLK from CPU rate of 133MHz).
I experimented with srate and found that a PCLK of 6413000 or 12826000 would give exactly 22050Hz.. is there any way I can use these values to set a valid, not too slow (~133MHz would be nice) CPU rate?

Thanks!
Doogle
 
Last edited by a moderator:
The Problem is, that CPU clock, and Soundoutput freq depend on each other.
To playback a 44.1khz Sample, at the correct playback speed, you need a correct calculated Clockspeed. On spivvys web site is a little calulating tool for this.

I've just compared the results from mr spiv's srate tool to the values that the code on the GP32 is calculating (InitIIS(), calcRate() using gp_getPCLK()) and they do match. However, srate says that the sound rate will be 21484Hz when I enter 22050Hz... does this mean that I'm not going to get exactly 22050Hz playback? (using PCLK from CPU rate of 133MHz).
I experimented with srate and found that a PCLK of 6413000 or 12826000 would give exactly 22050Hz.. is there any way I can use these values to set a valid, not too slow (~133MHz would be nice) CPU rate?

Thanks!
Doogle

Yes, you cant get a 22050khz playback speed, couse you can not set the clockspeed correct. 2148Khz is then the closest thing you can get...

I Tryed it:
Input XTAL0 Freq:12000000
Output MCLK Freq:128260000
MPS |MCLK |fvco|fi/P+2|PAR1<PAR2<PAR3|P|PAR4|
CLKDIV=0x38011; MCLK=128000000; CLKMODE=1;

But the result is a 128Mhz MCLK, and not 128.26Mhz

...
 
Last edited by a moderator:
Yes, you cant get a 22050khz playback speed, couse you can not set the clockspeed correct. 2148Khz is then the closest thing you can get...

Hmm.. so no exact 'standard' samplerates... Oh well.. I can see how things like that can happen with hardware like the GP32.
Now I've gotta fix my sample playing/mixing routine cos it doesn't seem to like playing samples when the playing samplerate and .wav samplerate aren't multiples of each other!

Thanks
 
Last edited by a moderator:
Back
Top