Jump to content
Visual Boy Advance-M
Dwedit

A sound test program which fails

Recommended Posts

This is a program that plays stuff through the sound channels, then uses the GBA timers to calculate exact times for the waveform to be okay before starting a new sound at a lower volume.

It sounds significantly different on hardware compared to VBA-M.

The sound played is just repeating E notes, but it waits for the exact timing necessary to begin another note with no impact from the "reset" bit.

On hardware it sounds smooth. On VBA-M, it sounds clicky/noisy/metalic.

 


//get_wavelength(4);
void test2()
{
REG_IME=0;

REG_TM2CNT_H=0;
REG_TM2CNT_L=0;
REG_TM2CNT_H=0xC1;   //256KiHz timer

REG_SOUNDCNT_X=0x80;
REG_SOUNDCNT_L=0xFF77;

int period = 0x673; //E-note after middle C
int target_time;
int last_time=0;
int num_tones=6;
int volume=15;
int real_period=2048-period;

do
{
	target_time=last_time+real_period*2*num_tones;
	target_time&=0xFFFF;
	while (1)
	{
		if (REG_TM2CNT_L==target_time-1)
		{
			break;
		}
	}
	REG_SOUND1CNT_H = 0x80 + (volume<<12);
	REG_SOUND1CNT_X = 0x8000 + period;
	last_time=target_time;
	volume--;
	if (volume==0) volume=15;
} while (1);
}

Share this post


Link to post
Share on other sites

This is in the sound core.

Sorry about some misinformation, it is not completely smooth on a GBA.

 

The wave is normally ~134 samples wide.

There is a 'bad wave' which is ~26 samples longer every ~1468 samples on VBA-M. The bad wave sounds like a pop. You get a pop about ~30 times a second.

The bad wave (~26 samples longer) occurs every ~5638 samples on hardware, so it's less noticable. The pop appears ~7.8 times a second.

 

I've attached the test program, VBA-M's wav output, and a bad recording of what hardware produces. WAV files don't compress well, so it's 900k.[attachment=23]

Share this post


Link to post
Share on other sites

ah, ok, well i've been having somewhat a feeling that the gba sound core wasn't correct.. i've noticed some strange squeaking at certain points in a few games, i just thought it was my single core cpu....

Share this post


Link to post
Share on other sites

Well, in that case, please let us know squall so Nach, Jonas, Spacy or I can have a look at them.

Share this post


Link to post
Share on other sites

I've been noticing this white noise when playing GBA games, its only audible when you come to a point where no bgm or sound is playing, and it sounds a wave thats eternally moving in, but not going back out.

 

Its not audible in DMG or CGB games.

 

related at all Dwedit?

 

a better description would be scratching to pieces of metal together, albeit very slowly,

Share this post


Link to post
Share on other sites

Here's a more or less clean recording from my NDS using my new ASUS Xonar DX sound card ^^

(NDS headphone jack to sound card line in, 48 kHz recording)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×