Page 1 of 1

A sound test program which fails

Posted: Fri Apr 18, 2008 1:37 pm
by Dwedit

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.

 

Code: Select all


//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);
}

A sound test program which fails

Posted: Fri Apr 18, 2008 10:07 pm
by mudlord

Thanks.

 

Any chance of a recording of the original sound and how VBA-M sounds?


A sound test program which fails

Posted: Sat Apr 19, 2008 1:14 am
by Squall Leonhart

ah, so where would the fault lie.... the sound core, or the output itself...


A sound test program which fails

Posted: Sat Apr 19, 2008 1:41 am
by Dwedit

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]


A sound test program which fails

Posted: Sat Apr 19, 2008 4:38 am
by Squall Leonhart

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....


A sound test program which fails

Posted: Sat Apr 19, 2008 8:11 am
by mudlord

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


A sound test program which fails

Posted: Sun Apr 20, 2008 10:01 pm
by Squall Leonhart

it was most noticeble in Super Robot Taisen - Original Generation 1 and 2


A sound test program which fails

Posted: Fri Jul 11, 2008 9:59 am
by Squall Leonhart

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,


A sound test program which fails

Posted: Fri Jul 11, 2008 1:21 pm
by spacy51

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)


A sound test program which fails

Posted: Thu Jan 22, 2009 5:17 am
by Squall Leonhart

This will likely be fixed when Blargg rewrites the audio core.