4-bit digisound on SAM Coupe/SAA1099?

category: code [glöplog]
I've been playing with some SAA1099 chips, and I tried to get 4-bit digisound from them.
I got it working but it doesn't seem to sound all that good.

This trick mainly seems to have been used on the SAM Coupe, such as Simon Cooke's Megablast and Star Trek demos.
I was wondering if someone had some information on how people do this on the SAM Coupe, or at least some tips on how to get the best results on SAA1099 in general.

What I am currently doing is to play a note at period 0 and octave 0, and set the amplitude as the 4-bit sample value. For every sample I play, I modify the amplitude and use the reset bit to restart the frequency generator.
It works, but there's quite a bit of high-pitched whine.
added on the 2017-12-10 17:29:37 by Scali Scali
Looking at the generated waveform using an oscilloscope or, if you don't have that, a 96ksps+ sound card, will help you figure out if there are any unexpected high-frequency artifacts.
added on the 2017-12-11 19:07:04 by trc_wm trc_wm
Yes, I did that. As it turns out, the 'pulse wave' it generates is not like the square or rectangular wave I was expecting. It has quite a steep dropoff, so it looks more like a triangle wave at low frequencies.

I have reverse-engineered the game Battletech 2, the only game I know of that uses samples on a Game Blaster/CMS on PC.
They use the highest possible frequency instead (~7.8 kHz). They do not retrigger the waveform however, so you actually hear that as a high-pitched whine (slightly different from the one I was hearing).

So I looked at that waveform as well, and it was not like a triangle wave at all, it looked more like a smoothed square wave, almost sine-like at that frequency.
I decided to try and combine the two methods: play at maximum frequency and reset the frequency generators at every sample.

With a high enough sample rate (about double of the 7.8 kHz), it actually sounds quite good, and the whine is gone.

But I still wonder if there are other/better ways to do it.
added on the 2017-12-12 12:49:04 by Scali Scali
this page seems to have a lot of tech info on saa1099, hope it helps: http://velesoft.speccy.cz/saa1099-cz.htm
added on the 2017-12-12 13:26:28 by havoc havoc

If that Sam Coupe schematic is correct, there must be very little bass coming out of the machine. The 1k resistor and 100nF DC blocking capacitor form a high-pass filter with a cutoff frequency of 1.5KHz. That would certainly explain the drooping of your square wave.
added on the 2017-12-12 18:34:02 by trc_wm trc_wm
Well, I'm not using a SAM Coupe. I'm using a clone of the Game Blaster for the PC.
It uses two SAA1099 chips, so I want to translate the SAM Coupe trick to the PC.
Sadly, I have not found any info yet.
I did find this: http://sam.speccy.cz/systech/unofficial_tech-man_v1-0.pdf
And there it lists in the contents: "Producing digital sound on the SAM"
Sadly, the document was never finished, and the sound chapter is one of the unfinished chapters, of course.

The trick is being done right here: https://youtu.be/7ofPSYbO1nU
But now to find some SAM Coupe coder who knows how it is done, or who at least can figure it out.
added on the 2017-12-12 21:39:28 by Scali Scali
From https://github.com/stefandrissen/SAM-MOD-player

All sound chip registers are set to zero.

Sound (register &1c) is enabled (&01)
Both envelope generators (register &18 and register &19) are enabled and the waveform is set to maximum amplitude (&82).

Amplitudes on channels &02 and &05 are pumped with sample data.

Note that this allows four channels of 3-bit sound - when the envelope generators are enabled, the lowest amplitude bit is ignored.

The two channels could be combined to provide 4-bit stereo sound.
Thanks for the information!
I will certainly experiment with this once I have some spare time.
added on the 2019-05-08 09:48:12 by Scali Scali