z88dk icon indicating copy to clipboard operation
z88dk copied to clipboard

[mc1000/jupiter ace/sc3000][sound][bitbang & psg] missing explosion sounds in bitbang - psg produces beeps

Open Fabrizio-Caruso opened this issue 7 years ago • 19 comments

PSG is not working as expected for the MC1000 target: all effects in my game sound horribly wrong.

Bit bang works ok except for noise effects that are reproduced as beeps.

Fabrizio-Caruso avatar Aug 17 '18 08:08 Fabrizio-Caruso

some (few) noise effect uses the rom data as random data for white noise, but the mc1000 does not have a visible ROM when in games mode. What do you get if running in BASIC mode? The psg support is still missing iirc

zx70 avatar Aug 17 '18 20:08 zx70

@zx70 same issue on same effect on the Jupiter Ace

Fabrizio-Caruso avatar Aug 18 '18 10:08 Fabrizio-Caruso

SC3000 is also badly affected by sound issues: bit-bang has extremely long and wrong sounds.

Fabrizio-Caruso avatar Sep 06 '18 22:09 Fabrizio-Caruso

Sound is very subjective :)

I suspect there's a constant wrong somewhere for the speed of the PSG device

However, could you:

a) Attach an example program that shows the fault (including command line) b) Attach a recording of it working properly (say which port) c) Attach a recording of it failing on the port that's wrong

And then these issues will be a lot easier to investigate!

suborb avatar Sep 09 '18 20:09 suborb

@suborb sure, I will try to produce something. The problem is not a matter of taste, which would not be a bug. Even if sounds were different across targets, it would not be a bug because it may be impossible to reproduce the same sounds. If a presumed explosion/noise effect sounds like a long pulsing beep that locks the computer for a few seconds, them we have a problem.

I am reporting on different targets the following kind of problems:

  1. noise being both totally wrong and taking several seconds (overflow issue?)
  2. noise sounds not being noises (rom-related problem? maybe bank switching?)

I will list the exact sounds that fail badly on specific targets.

Fabrizio-Caruso avatar Sep 09 '18 20:09 Fabrizio-Caruso

@suborb The following example shows some of the issues.

One of the worst issues are the first two sounds on the m5 (third sound is OK on the m5).

I compile the m5 case with:

	$(Z88DK_PATH)$(MYZ88DK) +m5 -create-app \
	-vn -lndos \
	$(SOURCE_PATH)/../experiments/sounds.c

The following code:

#include <sound.h>
#include <stdio.h>

int main(void)
{
	printf("Press any key to start");
	getchar();
	
	printf("bit_fx(1)	Fast increasing scale\n");
	// M5 and SC3000 have an issue with this
	bit_fx(1);
	getchar();
	
	printf("bit_fx(7)	Medium duration moving down, then up\n");
        // M5 and SC3000 have an issue with this	
	bit_fx(7);
	getchar();
	
	printf("bit_fx3(0)	Quick noisy high pitch buzz / break noise\n");
	// ACE, MC1000, SC3000 have an issue with this
	bit_fx3(0);
	getchar();
	
	return 0;
}

Fabrizio-Caruso avatar Sep 09 '18 21:09 Fabrizio-Caruso

@zx70 @suborb I have attached a recording of the two very wrong sounds on the m5. I am not asking for good sounds but the two sounds should at least vaguely resemble their description.

2018-09-09 23-10-01.zip

Fabrizio-Caruso avatar Sep 09 '18 21:09 Fabrizio-Caruso

@zx70 @suborb I have attached the binary produced for the Sepcrum, which has the good sounds but I am not picky about the sounds. The sounds could be different as long as it vaguely resembles their description and do not last multiple seconds when they are described as short/quick. spectrum_ok.zip

Fabrizio-Caruso avatar Sep 10 '18 11:09 Fabrizio-Caruso

Thanks for the samples, they clarify several things. This problem is not related to the white noise generation, it affects the effects based on bit_beep (square wave generation). My first impression is that the impacted targets are those machines using the new SN76489 library: https://github.com/z88dk/z88dk/blob/master/libsrc/psg/sn76489.inc

zx70 avatar Sep 13 '18 06:09 zx70

Yes, indeed. We also have a noise issue on some targets, which is a different issue.

Fabrizio-Caruso avatar Sep 13 '18 06:09 Fabrizio-Caruso

I think I found one of the problems you experimented with the sound rountines: part of them used Self Modifying Code, which cannot be run in ROM. I changed the section assignments to smc_clib where necessary, so that the segment initialization will do the proper job at startup. Please check it after the next nighty build ;)

zx70 avatar Jan 09 '19 13:01 zx70