SN76489 best sample playback?

discussion of beeb/electron applications, languages, utils and educational s/w
User avatar
SarahWalker
Posts: 1085
Joined: Fri Jan 14, 2005 3:56 pm
Contact:

Re: SN76489 best sample playback?

Post by SarahWalker » Sat May 12, 2018 4:40 pm

tricky wrote:
SarahWalker wrote:The SN76489AN used in most (all?) BBCs does indeed reset the bit sequence when writing to the noise control register. I know the NCR 8496 does not (this is required by the LucasArts Tandy music driver), not sure about the other chips.
Most then as I have one that doesn't and seems to be factory fitted.
Are you saying your Beeb doesn't have an SN76489AN, or that it does and writing to the noise control doesn't reset the shift register?

User avatar
tricky
Posts: 2448
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: SN76489 best sample playback?

Post by tricky » Sat May 12, 2018 10:18 pm

I'll have to check the part number, but unless I got the code wrong, it didn't reset. That is, it played perfectly on jsbeeb, but not on my beeb.
I'll have to try and remember which one it was, but it came from a batch from someone who bought them from a school.

User avatar
Rich Talbot-Watkins
Posts: 1280
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: SN76489 best sample playback?

Post by Rich Talbot-Watkins » Sun May 13, 2018 8:05 am

So, just to rewind the thread for a moment, does this mean that another potential way to play PCM on a Beeb is to constantly select low frequency noise at a sample rate at least double that of the noise frequency and then adjust the volume? The idea being that you can maintain a constant output level from the PSG that way?

@cmorley: How did you build the PWM data? I assume you had to convert from a PCM representation, but I'm not really clear how the process works. Also is there a more optimal representation? e.g. instead of 1 bit data at a high sample rate, maybe "number of ticks before toggling the output"?

cmorley
Posts: 458
Joined: Sat Jul 30, 2016 7:11 pm
Location: Oxford
Contact:

Re: SN76489 best sample playback?

Post by cmorley » Sun May 13, 2018 8:23 am

Rich Talbot-Watkins wrote:@cmorley: How did you build the PWM data? I assume you had to convert from a PCM representation, but I'm not really clear how the process works. Also is there a more optimal representation? e.g. instead of 1 bit data at a high sample rate, maybe "number of ticks before toggling the output"?
PCM value straight to duty cycle. That gives you an on duration and an off duration for every sample. Then it is just turn on... wait Ton... turn off... wait Toff... repeat. A look up table from sample value to delays works.

User avatar
Rich Talbot-Watkins
Posts: 1280
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: SN76489 best sample playback?

Post by Rich Talbot-Watkins » Sun May 13, 2018 9:00 am

cmorley wrote:PCM value straight to duty cycle. That gives you an on duration and an off duration for every sample. Then it is just turn on... wait Ton... turn off... wait Toff... repeat. A look up table from sample value to delays works.
Really? :o Where 0=duty cycle 0% and 15=duty cycle 100% (or 50%?)? Or something else? I imagined needing to somehow take into account the derivative of the PCM data.

Edit: I honestly never realised it was so straightforward. I did some searching to clarify the details, and found the following document which concurs.

Image

cmorley
Posts: 458
Joined: Sat Jul 30, 2016 7:11 pm
Location: Oxford
Contact:

Re: SN76489 best sample playback?

Post by cmorley » Sun May 13, 2018 11:20 am

Rich Talbot-Watkins wrote:Edit: I honestly never realised it was so straightforward.
Yes it really is that straightforward.

The problem is here that the CPU+sound chip combo is too slow to generate a carrier very much higher than the modulating signal - so you get audible artefacts.

steve3000
Posts: 1838
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: SN76489 best sample playback?

Post by steve3000 » Sun May 13, 2018 12:20 pm

Great discussion, I hadn't appreciated the different possibilities to output sampled sound from the beeb!
SarahWalker wrote:
tricky wrote:
SarahWalker wrote:The SN76489AN used in most (all?) BBCs does indeed reset the bit sequence when writing to the noise control register. I know the NCR 8496 does not (this is required by the LucasArts Tandy music driver), not sure about the other chips.
Most then as I have one that doesn't and seems to be factory fitted.
Are you saying your Beeb doesn't have an SN76489AN, or that it does and writing to the noise control doesn't reset the shift register?
I've taken a quick look at my two beebs, as they're open on the desk at the moment. My issue 3 beeb has a SN76489AN, however my issue 2 beeb has a SN76489N.

User avatar
SarahWalker
Posts: 1085
Joined: Fri Jan 14, 2005 3:56 pm
Contact:

Re: SN76489 best sample playback?

Post by SarahWalker » Sun May 13, 2018 12:38 pm

Interesting! I wonder if the shift register reset is one of the differences with the 'A' variant?

cmorley
Posts: 458
Joined: Sat Jul 30, 2016 7:11 pm
Location: Oxford
Contact:

Re: SN76489 best sample playback?

Post by cmorley » Sun May 13, 2018 2:36 pm

From wikipedia.
There are two versions of the SN76489: the SN76489 (Narrow DIP version labeled SN76489N) and the SN76489A (Narrow DIP version labeled SN76489AN). The former was made around 1980-1982 and the latter from 1983 onward. They differ in that the output of the SN76489 is the inverse of the expected waveform (the waveform 'grows' towards 0 V from 2.5 V), while the SN76489A the waveform is not inverted.
A is the newer model it seems. Perhaps they changed other things too?

ThomasHarte
Posts: 458
Joined: Sat Dec 23, 2000 5:56 pm
Contact:

Re: SN76489 best sample playback?

Post by ThomasHarte » Sun May 13, 2018 3:35 pm

The variant in the Master System and Game Gear has a 16-bit shift register rather than a 15-bit, but it's embedded into the VDP so it's not necessarily drawn from official blueprints.

User avatar
simonm
Posts: 185
Joined: Mon May 09, 2016 2:40 pm
Contact:

Re: SN76489 best sample playback?

Post by simonm » Sun May 13, 2018 7:49 pm

This SMS Power link has been extremely useful for me over the past couple of years, while I was messing with sound chip things.
In a correction to my earlier post, it appears that setting a tone register to 0 creates a continuous output (not 1 as I previously posted). Which makes sense as the chip uses a 10 bit counter to flip the square wave output when it reaches 0.
A 4Mhz beeb will generate a squarewave frequency of 125Khz with register value of 1.
steve3000 wrote:My issue 3 beeb has a SN76489AN, however my issue 2 beeb has a SN76489N.
I'm very surprised and confused by this info as everything I've read suggests that the SN76489 max clock is 500Khz, (whereas SN76489A is 4Mhz max) so unless the issue 2 MB has a /8 compensation for the 4Mhz sysem clock, it seems it would be incompatible?

User avatar
simonm
Posts: 185
Joined: Mon May 09, 2016 2:40 pm
Contact:

Re: SN76489 best sample playback?

Post by simonm » Sun May 13, 2018 7:57 pm

ThomasHarte wrote:The variant in the Master System and Game Gear has a 16-bit shift register rather than a 15-bit, but it's embedded into the VDP so it's not necessarily drawn from official blueprints.
This is actually a good improvement by Sega for the MS/GG, since it means that the periodic noise is exactly 4 octaves lower than the tone registers, which means it's possible to play all 4 tone generators in harmony, whereas on the Beeb, the tone channel that drives the periodic noise pitch usually has to be muted because otherwise it will sound discordant.

For example: On Sega, a pitch of 440Hz on channel 2 will play 27.5Hz on Periodic noise channel3 (exactly 4 octaves lower). With the BBC, 440Hz on channel2 will deliver 29.33Hz on PN channel3 (almost 4 octaves lower - but, not quite, so will be out of tune).

steve3000
Posts: 1838
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: SN76489 best sample playback?

Post by steve3000 » Sun May 13, 2018 9:00 pm

simonm wrote:
steve3000 wrote:My issue 3 beeb has a SN76489AN, however my issue 2 beeb has a SN76489N.
I'm very surprised and confused by this info as everything I've read suggests that the SN76489 max clock is 500Khz, (whereas SN76489A is 4Mhz max) so unless the issue 2 MB has a /8 compensation for the 4Mhz sysem clock, it seems it would be incompatible?
The only difference I've noticed with the issue 2 in use, is that it doesn't do the 'normal' beeb start-up sound. By 'normal', I mean the low-tone followed by a beep, which I get from the issue 3 (and other beebs I've owned). The issue 2, however, gives a high tone (sounds more like a chord, rather than a single tone) followed by the beep...

Could this be due to the different sound chip?

User avatar
1024MAK
Posts: 7417
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: SN76489 best sample playback?

Post by 1024MAK » Sun May 13, 2018 10:09 pm

simonm wrote:
steve3000 wrote:My issue 3 beeb has a SN76489AN, however my issue 2 beeb has a SN76489N.
I'm very surprised and confused by this info as everything I've read suggests that the SN76489 max clock is 500Khz, (whereas SN76489A is 4Mhz max) so unless the issue 2 MB has a /8 compensation for the 4Mhz sysem clock, it seems it would be incompatible?
No. See the Wikipedia page I linked to earlier in this thread... or see the datasheet for these chips :wink:
1024MAK wrote:There are a number of variants. This Wikipedia page explains the differences ;-)
steve3000 wrote:The only difference I've noticed with the issue 2 in use, is that it doesn't do the 'normal' beeb start-up sound. By 'normal', I mean the low-tone followed by a beep, which I get from the issue 3 (and other beebs I've owned). The issue 2, however, gives a high tone (sounds more like a chord, rather than a single tone) followed by the beep...

Could this be due to the different sound chip?
The first sound from the Beeb when powered up, is the uninitialised state of the registers in the sound chip being heard, before the OS ROM tells the sound chip to 'shut-up', then the OS ROM actually plays a tone. Hence why you only get one sound when you press and then let go of the BREAK key. Due to differences between each chip, you may get different sounds from them in their uninitialised state. The Memotech MTX computers use the same sound chip, and if due to a fault that prevents it's ROM code from running, it will make a similar 'uninitialised state' sound.

Due to the differences (see the Wikipedia page) between the SN76489N and the SN76489AN, it's not surprising that there is a difference in the 'uninitialised state' sound, as there will be differences in the chip die.

Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki‬ - for answers to many questions...

cmorley
Posts: 458
Joined: Sat Jul 30, 2016 7:11 pm
Location: Oxford
Contact:

Re: SN76489 best sample playback?

Post by cmorley » Sun May 13, 2018 10:32 pm

simonm wrote: I'm very surprised and confused by this info as everything I've read suggests that the SN76489 max clock is 500Khz, (whereas SN76489A is 4Mhz max) so unless the issue 2 MB has a /8 compensation for the 4Mhz sysem clock, it seems it would be incompatible?
SN76489 = 4MHz
SN76494 = 500kHz

The number is different.

N means DIP chip (on any dip chip 74 series logic etc) and the SN76489A is a later model.

Post Reply