In article <4ov3hk$cjk@bignews.shef.ac.uk>, thdb86%teach@dcs.shef.ac.uk (Damion Yates) wrote: >It sounds exactly like just a sumation, on a real speccy. One thing I have >noticed though, is that when you combine tones on real speccy its NOTHING >like the sounds Z80 makes. I'm pretty sure the AY-3-819x is whats wrong, as >sounds become to quiet. The problem is that the outputs of the AY are wire-ored together and if you add two identical tones together then the output could be any of the following. ___ ___ 1. ___| |___| |___ ___ ___ + ___| |___| |___ ___ ___ = | | | | ___| |___| |___ ___ ___ 2. ___| |___| |___ _ ___ ___ + |___| |___| |_ _ _ = _ _| |_ _| |_ |_| |_| |_ ___ ___ 3. ___| |___| |___ ___ ___ ___ + |___| |___| = ___________________ Or anything in between. Note that number 2 has only 0.7 times the rms amplitude of number 1 and it also has a different tone quality. ---------------------------------------------------- [snip. a VERY VERY good description of the exact problem] That made perfect sence, thanks. : Or anything in between. Note that number 2 has only 0.7 times the rms : amplitude of number 1 and it also has a different tone quality. this is EXACTLY the effect that a 128k emulator should have, as many tunes rely on this sound!! ---------------------------------------------------- Xref: vanilla comp.sys.sinclair:3692 Path: vanilla!asbach!noris.net!blackbush.xlink.net!tank.news.pipex.net!pipex!news.mathworks.com!newsfeed.internetmci.com!howland.reston.ans.net!EU.net!usenet2.news.uk.psi.net!uknet!uknet!lyra.csx.cam.ac.uk!mgr11 From: mgr11@cus.cam.ac.uk (M.G. Rison) Newsgroups: comp.sys.amstrad.8bit,comp.sys.sinclair Subject: AY-3-819x PSG sound generation Date: 4 Jun 1996 10:15:48 GMT Organization: University of Cambridge, England Lines: 36 Sender: rison@hep.phy.cam.ac.uk Message-ID: <4p12ck$hqo@lyra.csx.cam.ac.uk> Reply-To: rison@hep.phy.cam.ac.uk NNTP-Posting-Host: bootes.cus.cam.ac.uk [Note cross-post] When exactly do sounds get `reinitialised' on the PSG? For example: 1) When does a sound get launched? As soon as its enable bit is active? 2) Say channel 1 tone is active. If I write to channel 1's tone period register, does the tone change immediately, or only when the enable bit is written to again? Does the phase get reset? 3) Say channel 1 tone is active. If I write to channel 1's tone period register, but with the existing values (i.e. nothing has changed), does the phase get reset, or not? 4) Say channel 1 tone is active with a hardware envelope. If I change the envelope shape, does channel 1's envelope shape change? If I change the envelope period, does channel 1's envelope period change? If I change to fixed amplitude, does channel 1 change to fixed amplitude? If all these things do change in unison, do the phases get reset? Depending on the answers to these questions, I may ask more! Also, can I confirm that (despite what SOFT968 says), the unit for the tone (full-) period is 16 us, and the unit for each step of the hardware envelope is 256 us (i.e. the 16-step ramp unit is 2.084 ms)? Mark P.S.: And what happens to read/writes to R15 on AY-3-8192? ====================================================================== | rison@hep.phy.cam.ac.uk | Esperanto - lingvo inter-nacia | | rison@vxcern.cern.ch | * Mi estas riisto * | ====================================================================== ---- Xref: vanilla comp.sys.sinclair:3821 Path: vanilla!asbach!noris.net!blackbush.xlink.net!tank.news.pipex.net!pipex!usenet1.news.uk.psi.net!uknet!peer.news.xara.net!xara.net!SoNet!rmplc!yama.mcc.ac.uk!daresbury!lyra.csx.cam.ac.uk!news.ox.ac.uk!news From: imc@ecs.ox.ac.uk (Ian Collier) Newsgroups: comp.sys.amstrad.8bit,comp.sys.sinclair Subject: Re: AY-3-819x PSG sound generation Date: 6 Jun 1996 12:36:18 GMT Organization: Oxford University Computing Laboratory Lines: 50 Message-ID: <8490.imc@comlab.ox.ac.uk> References: <4p12ck$hqo@lyra.csx.cam.ac.uk> NNTP-Posting-Host: boothp2.ecs.ox.ac.uk X-Local-Date: Thursday, 6th June 1996 at 1:36pm BST In article <4p12ck$hqo@lyra.csx.cam.ac.uk>, rison@hep.phy.cam.ac.uk wrote: >When exactly do sounds get `reinitialised' on the PSG? My take on this is that there are several independent elements on the PSG: the three tone generators, the noise generator, the mixers (one on each channel that lets through or does not let through the tone and noise and mixes them together), the volume controllers and the envelope generator. My opinion after doing some tests is that changing register 7 (the tone and noise enable register) does not affect any part of the circuit apart from the mixers. Also, repeatedly sending the same value to a frequency register does not affect the tone and sending different values rapidly still produces a sensible output, so I would say that there is no action which resets the tone generator (though I bet setting the frequency to zero and waiting for the current cycle to finish would do the trick). >4) Say channel 1 tone is active with a hardware envelope. If I change >the envelope shape, does channel 1's envelope shape change? If I change >the envelope period, does channel 1's envelope period change? If I >change to fixed amplitude, does channel 1 change to fixed amplitude? >If all these things do change in unison, do the phases get reset? Again, the envelope generator is an independent unit (and there is only the one). Setting the volume register of any channel to 16 (or a number with bit 4 set) tells the volume controller of that channel to obey the envelope generator (and setting the volume register to any value takes effect immediately). The envelope generator always starts whenever register 13 is set to a waveform number and at no other time, so you can see that it is impossible to change the shape without starting a new envelope. The envelope generator continues to generate the envelope even if all the channels are on fixed volume. Changing the envelope period takes effect "immediately" (meaning, probably, after the timer next counts down to zero) so you can have a sound which decays slowly for a time and then quickly. >Also, can I confirm that (despite what SOFT968 says), the unit for >the tone (full-) period is 16 us, and the unit for each step of the >hardware envelope is 256 us (i.e. the 16-step ramp unit is 2.084 ms)? On the +3 the PSG is fed half the CPU clock - that is, 1.7735 MHz. This is divided by 16 to form the time unit of everything (110.8 KHz). The maximum 16-step ramp time for an envelope is 9.46 seconds (with register 11/12 set to 65535). >P.S.: And what happens to read/writes to R15 on AY-3-8192? I didn't check, but I assume it just acts like a normal register. Ian Collier - imc@comlab.ox.ac.uk - WWW Home Page (including Spectrum section): http://www.comlab.ox.ac.uk/oucl/users/ian.collier/index.html ---- Xref: vanilla comp.sys.sinclair:3997 Path: vanilla!asbach!noris.net!blackbush.xlink.net!tank.news.pipex.net!pipex!news.mathworks.com!news.kei.com!nntp.coast.net!howland.reston.ans.net!agate!sunsite.doc.ic.ac.uk!ukc!falcon.ukc.ac.uk!jmg7 From: jmg7@ukc.ac.uk (J.M.Garner) Newsgroups: comp.sys.amstrad.8bit,comp.sys.sinclair Subject: Re: AY-3-819x PSG sound generation Followup-To: comp.sys.amstrad.8bit,comp.sys.sinclair Date: Mon, 10 Jun 96 11:32:36 GMT Organization: University of Kent at Canterbury, UK. Lines: 48 Message-ID: <13056@falcon.ukc.ac.uk> References: <4p12ck$hqo@lyra.csx.cam.ac.uk> <8490.imc@comlab.ox.ac.uk> NNTP-Posting-Host: falcon.ukc.ac.uk Ian Collier (imc@ecs.ox.ac.uk) wrote: : In article <4p12ck$hqo@lyra.csx.cam.ac.uk>, rison@hep.phy.cam.ac.uk wrote: : >When exactly do sounds get `reinitialised' on the PSG? : My take on this is that there are several independent elements on the PSG: : the three tone generators, the noise generator, the mixers (one on each : channel that lets through or does not let through the tone and noise and : mixes them together), the volume controllers and the envelope generator. : My opinion after doing some tests is that changing register 7 (the tone : and noise enable register) does not affect any part of the circuit apart : from the mixers. Also, repeatedly sending the same value to a frequency : register does not affect the tone and sending different values rapidly : still produces a sensible output, so I would say that there is no action : which resets the tone generator (though I bet setting the frequency to zero : and waiting for the current cycle to finish would do the trick). Well setting tone to zero is equivalent to sample mode. If you output values to the volume register (still lower 4 bits) in tone=0 for that channel, you get a click of varying loudness. I'm not quite sure whether there is special circuitry inside the AY chip, or whether just tone=0 means it never gets counted down, or ....???? The tone will change immediately you set it. : >P.S.: And what happens to read/writes to R15 on AY-3-8192? : I didn't check, but I assume it just acts like a normal register. Well, err.. lets think (Speccy manuals at the house dammit). R8=vol chan A, 11/12=envelope pitch, 13=envelope control (or 11,12/13); 14 is the input/output channel for the RS232/Midi and Aux ports, and .... errrr... whats 15???? Doesn't do anything I've ever noticed, and I have messed around with AY chip registers in BASIC/machine code quite a lot. Maybe it would control another port if it was attached....... :-? That was my thought for the day... (well, apart from "aagh Im gonna fail this exam!") Datasoft / aka John Garner -- |~Life? Don't talk to me about life." (Marvin, HHGG)~~~~~~~~~| | Spectrum PD/usergroups web site=http://www.nvg.unit.no/spectrum/jmg7 | |__John Garner, 2nd year Comp Sci, University of Kent at Canterbury.____| |Home=The Orchard, Moor Rd, Langham, Colchester, Essex. CO4 5NR. ENGLAND| ---- Xref: vanilla comp.sys.sinclair:4001 Path: vanilla!asbach!noris.net!blackbush.xlink.net!tank.news.pipex.net!pipex!news.mathworks.com!newsfeed.internetmci.com!in2.uu.net!news.tcom.co.uk!morse.ukonline.co.uk!bath.ac.uk!bsmail!warwick!bham!bhamcs!news.ox.ac.uk!news From: imc@ecs.ox.ac.uk (Ian Collier) Newsgroups: comp.sys.amstrad.8bit,comp.sys.sinclair Subject: Re: AY-3-819x PSG sound generation Date: 11 Jun 1996 11:41:03 GMT Organization: Oxford University Computing Laboratory Lines: 23 Message-ID: <8519.imc@comlab.ox.ac.uk> References: <4p12ck$hqo@lyra.csx.cam.ac.uk> <8490.imc@comlab.ox.ac.uk> <13056@falcon.ukc.ac.uk> NNTP-Posting-Host: boothp2.ecs.ox.ac.uk X-Local-Date: Tuesday, 11th June 1996 at 12:40am BST In article <13056@falcon.ukc.ac.uk>, jmg7@ukc.ac.uk (J.M.Garner) wrote: >: >P.S.: And what happens to read/writes to R15 on AY-3-8192? >: I didn't check, but I assume it just acts like a normal register. >Well, err.. lets think (Speccy manuals at the house dammit). R8=vol chan >A, 11/12=envelope pitch, 13=envelope control (or 11,12/13); 14 is the >input/output channel for the RS232/Midi and Aux ports, and .... errrr... >whats 15???? Doesn't do anything I've ever noticed, and I have messed around >with AY chip registers in BASIC/machine code quite a lot. The manuals won't do you any good, because we can read too. :-) Register 15 of the AY-3-8910 controls the second parallel I/O port. The top two bits of register 7 decide whether the I/O ports are for input or output. If it's for input then reading the register gives you the value of the I/O port. If it's for output then reading the register presumably returns the last value that you put there. However, on the 8912 there is no second I/O port. I still think the register will store whatever you put there, though. Ian Collier - imc@comlab.ox.ac.uk - WWW Home Page (including Spectrum section): http://www.comlab.ox.ac.uk/oucl/users/ian.collier/index.html ---- Xref: vanilla comp.sys.sinclair:4021 Path: vanilla!asbach!noris.net!blackbush.xlink.net!howland.reston.ans.net!swrinde!newsfeed.internetmci.com!usenet.eel.ufl.edu!warwick!lyra.csx.cam.ac.uk!mgr11 From: mgr11@cus.cam.ac.uk (M.G. Rison) Newsgroups: comp.sys.amstrad.8bit,comp.sys.sinclair Subject: Re: AY-3-819x PSG sound generation Date: 12 Jun 1996 11:32:03 GMT Organization: University of Cambridge, England Lines: 51 Sender: rison@hep.phy.cam.ac.uk Message-ID: <4pm9rj$chl@lyra.csx.cam.ac.uk> References: <4p12ck$hqo@lyra.csx.cam.ac.uk> <8490.imc@comlab.ox.ac.uk> <13056@falcon.ukc.ac.uk> Reply-To: rison@hep.phy.cam.ac.uk NNTP-Posting-Host: ursa.cus.cam.ac.uk En la artikolo <13056@falcon.ukc.ac.uk>, J.M.Garner skribis: > Well setting tone to zero is equivalent to sample mode. If you output > values to the volume register (still lower 4 bits) in tone=0 for that > channel, you get a click of varying loudness. I'm not quite sure whether > there is special circuitry inside the AY chip, or whether just tone=0 means > it never gets counted down, or ....???? How long does the click last? 8 PSG clock cycles? Do successive clicks have opposite signs? [i.e: if I send, with tone period 0 set, values of 15, 10, 5, do I get: ------ 15 | | ------ 5 ................ 0 | | ------ (-) 10 or ------ 15 ------ 10 ------ 5 ................ 0 ?] > The tone will change immediately you set it. So if I send repeated clicks, they will not be 8 PSG clock cycles apart, but will appear as fast as I can send them? Have you tested this? Someone else claimed that it would only change when the current (half-?) period was done -- tested by sending lots of tone changes to the PSG and seeing whether the output was still sensible, or something. What about period 0 noise? Yikes, this PSG is *much* more difficult to emulate than one (I) would first have imagined! Mark ====================================================================== | rison@hep.phy.cam.ac.uk | Esperanto - lingvo inter-nacia | | rison@vxcern.cern.ch | * Mi estas riisto * | ====================================================================== ---- Xref: vanilla comp.sys.sinclair:4029 Path: vanilla!asbach!noris.net!blackbush.xlink.net!tank.news.pipex.net!pipex!swrinde!newsfeed.internetmci.com!in1.uu.net!news.tcom.co.uk!morse.ukonline.co.uk!bath.ac.uk!bsmail!warwick!bham!bhamcs!news.ox.ac.uk!news From: imc@ecs.ox.ac.uk (Ian Collier) Newsgroups: comp.sys.amstrad.8bit,comp.sys.sinclair Subject: Re: AY-3-819x PSG sound generation Date: 12 Jun 1996 13:44:37 GMT Organization: Oxford University Computing Laboratory Lines: 44 Message-ID: <8526.imc@comlab.ox.ac.uk> References: <4p12ck$hqo@lyra.csx.cam.ac.uk> <8490.imc@comlab.ox.ac.uk> <13056@falcon.ukc.ac.uk> <4pm9rj$chl@lyra.csx.cam.ac.uk> NNTP-Posting-Host: boothp2.ecs.ox.ac.uk X-Local-Date: Wednesday, 12th June 1996 at 2:44pm BST In article <4pm9rj$chl@lyra.csx.cam.ac.uk>, rison@hep.phy.cam.ac.uk wrote: >En la artikolo <13056@falcon.ukc.ac.uk>, J.M.Garner skribis: >> Well setting tone to zero is equivalent to sample mode. If you output >> values to the volume register (still lower 4 bits) in tone=0 for that >> channel, you get a click of varying loudness. My assumption is that either you get no wave but just a straight line at the given volume or you get a wave at the PSG's top frequency of the given volume. These are effectively the same thing since the PSG's top frequency is inaudible. Hmm, it might be possible to test this by comparing the loudness of a sample with normal tones. Or by comparing period 0 with period 1. >Do successive clicks have opposite signs? > >[i.e: if I send, with tone period 0 set, values of 15, 10, 5, do I get: > >------ 15 > | > | ------ 5 >................ 0 > | | > ------ (-) 10 There's no such thing as negative volume, or so I would assume. Besides, that sort of change which happens only when you send a new volume value is illogical. >> The tone will change immediately you set it. >So if I send repeated clicks, they will not be 8 PSG clock cycles apart, >but will appear as fast as I can send them? I would imagine so, since we are changing the volume controller and not doing anything to the tone generator. Describing them as "clicks" is misleading IMHO. >What about period 0 noise? I have no idea how the frequency of noise is calculated from the value of register 6. Ian Collier - imc@comlab.ox.ac.uk - WWW Home Page (including Spectrum section): http://www.comlab.ox.ac.uk/oucl/users/ian.collier/index.html ---- Xref: vanilla comp.sys.sinclair:4032 Path: vanilla!asbach!noris.net!blackbush.xlink.net!tank.news.pipex.net!pipex!usenet.eel.ufl.edu!warwick!lyra.csx.cam.ac.uk!mgr11 From: mgr11@cus.cam.ac.uk (M.G. Rison) Newsgroups: comp.sys.amstrad.8bit,comp.sys.sinclair Subject: Re: AY-3-819x PSG sound generation Date: 12 Jun 1996 14:31:16 GMT Organization: University of Cambridge, England Lines: 85 Sender: rison@hep.phy.cam.ac.uk Message-ID: <4pmkbk$ktb@lyra.csx.cam.ac.uk> References: <4p12ck$hqo@lyra.csx.cam.ac.uk> <13056@falcon.ukc.ac.uk> <4pm9rj$chl@lyra.csx.cam.ac.uk> <8526.imc@comlab.ox.ac.uk> Reply-To: rison@hep.phy.cam.ac.uk NNTP-Posting-Host: ursa.cus.cam.ac.uk En la artikolo <8526.imc@comlab.ox.ac.uk>, Ian Collier skribis: > In article <4pm9rj$chl@lyra.csx.cam.ac.uk>, rison@hep.phy.cam.ac.uk wrote: > >En la artikolo <13056@falcon.ukc.ac.uk>, J.M.Garner skribis: > >> Well setting tone to zero is equivalent to sample mode. If you output > >> values to the volume register (still lower 4 bits) in tone=0 for that > >> channel, you get a click of varying loudness. > My assumption is that either you get no wave but just a straight line at > the given volume or you get a wave at the PSG's top frequency of the given > volume. These are effectively the same thing since the PSG's top frequency > is inaudible. Hmm, it might be possible to test this by comparing the > loudness of a sample with normal tones. Or by comparing period 0 with > period 1. Hm. Not sure I quite follow you here, but that's life. > >Do successive clicks have opposite signs? > >[i.e: if I send, with tone period 0 set, values of 15, 10, 5, do I get: > >------ 15 > > | > > | ------ 5 > >................ 0 > > | | > > ------ (-) 10 > There's no such thing as negative volume, or so I would assume. Erm, maybe I was a bit unclear. The way I currently emulate a sound of amplitude x is to generate a square wave with amplitude x. On my system at least (my understanding of sound generation in general is very superficial), sounds are output as 8-bit signed samples: --- ---- ---- -- +x | | | | | | ....................... 0 | | | | | | ---- ---- ---- -x So by -x I mean that the magitude of the samples is x, but the sign bit is opposite to that used for the amplitude +x samples. Does that make any sense at all? Am I just very confused? > Besides, > that sort of change which happens only when you send a new volume value is > illogical. Ooook? > >> The tone will change immediately you set it. > >So if I send repeated clicks, they will not be 8 PSG clock cycles apart, > >but will appear as fast as I can send them? > I would imagine so, since we are changing the volume controller and not > doing anything to the tone generator. Describing them as "clicks" is > misleading IMHO. But how long will a given `click' last, if not interrupted by another, if not 8 PSG clock cycles? [I can already see I will not attempt to emulate this behaviour...] > >What about period 0 noise? > I have no idea how the frequency of noise is calculated from the value of > register 6. The following algorithm (first explained to me by Darren Salt, and then confirmed by Pierre Guerrier) seems to work: - count down 8*(R6)_b4-b0 PSG clock cycles (could be 16*; not sure) - while this is happening, send samples of the selected amplitude - when you hit zero, flip a virtual coin and set the sign of the samples being sent to the result - reload the counter - loop back I still don't understand how noise and tone are combined/related. Mark, who's getting more and more confused ====================================================================== | rison@hep.phy.cam.ac.uk | Esperanto - lingvo inter-nacia | | rison@vxcern.cern.ch | * Mi estas riisto * | ====================================================================== ---- Xref: vanilla comp.sys.sinclair:4052 Path: vanilla!asbach!noris.net!blackbush.xlink.net!tank.news.pipex.net!pipex!news.mathworks.com!news.kei.com!nntp.coast.net!dispatch.news.demon.net!demon!sunsite.doc.ic.ac.uk!yama.mcc.ac.uk!zippy.dct.ac.uk!str-ccsun!strath-cs!ftel.co.uk!bham!bhamcs!news.ox.ac.uk!news Newsgroups: comp.sys.amstrad.8bit,comp.sys.sinclair Subject: Re: AY-3-819x PSG sound generation Message-ID: <8530.imc@comlab.ox.ac.uk> From: imc@ecs.ox.ac.uk (Ian Collier) Date: 12 Jun 1996 16:40:11 GMT References: <4p12ck$hqo@lyra.csx.cam.ac.uk> <4pm9rj$chl@lyra.csx.cam.ac.uk> <8526.imc@comlab.ox.ac.uk> <4pmkbk$ktb@lyra.csx.cam.ac.uk> Organization: Oxford University Computing Laboratory NNTP-Posting-Host: boothp2.ecs.ox.ac.uk X-Modified-on: Wednesday, 12th June 1996 at 5:40pm BST X-Local-Date: Wednesday, 12th June 1996 at 5:22pm BST Lines: 102 In article <4pmkbk$ktb@lyra.csx.cam.ac.uk>, rison@hep.phy.cam.ac.uk wrote: >> My assumption is that either you get no wave but just a straight line at >> the given volume or you get a wave at the PSG's top frequency of the given >> volume. These are effectively the same thing since the PSG's top frequency >> is inaudible. >Hm. Not sure I quite follow you here, but that's life. Let me desribe how I think the sound chip works... +-----------+ T +-------+ +------------+ | Tone |-->--| mixer |-->--| volume |-->--output | generator | +->-| | +->-| controller | +-----------+ | N +-------+ | E +------------+ | | +-----+-----+ +----+------+ | noise | | envelope | | generator | | generator | +-----------+ +-----------+ Each channel has a tone generator, a mixer and a volume controller. There is also one sound generator and one envelope generator shared between the channels. Each unit works independently of the others. Let us take channel 0 as an example. The tone generator outputs a continuous tone at the frequency of clock/(R1R0 AND 0x0fff). Now its output could either oscillate between 0 and 1 or between -1 and +1 (or any other number) - it really doesn't matter. What happens when R1R0 is zero is not known exactly (see later). Call this output T. (Changes to R1R0 take effect the next time the counter gets down to zero). The noise generator outputs noise continually at a frequency in some way related to R6 AND 63. Call this output N. The mixer just outputs (!R7_0)*T + (!R7_3)*N. (The '+' could possibly be 'or'). (Changes to R7 take effect immediately). The envelope generator continually outputs a number between 0 and 15. The number changes clock/R12R11 times per second in accordance with the wave form number R13. Whenever R13 is stored the envelope waveform starts from the beginning of the new shape. Call this output E. The volume controller multiplies its input by (R8 AND 15) if R8_4 is zero but by E if R8_4 is non-zero, and outputs the result. (Changes to R8 take effect immediately). Now then. Suppose you set R1R0 to zero. What happens? There are three choices... 1. The zero is treated as 4096 (similar to the reason why LD BC,0:LDIR moves 65536 bytes). This seems unlikely because if it were true you would hear a very low note, and you don't. 2. The tone generator stops completely and outputs a constant signal of either +1, -1 or zero (depending on various factors - mainly, which values it normally produces). 3. The tone generator outputs a tone at a very high frequency. We have a similar problem with what happens if you set R6 to zero, but this time we know that it does produce a sound, and I think the sound has a frequency that makes the progression R6=63, R6=62, ... R6=1, R6=0 produce a smooth sound. That makes me wonder whether the formula frequency=clock*16/R6 is correct. Maybe it's R6+1 or something. Anyway, suppose you have set R1R0 to zero and then you fiddle with R8. What happens? In case (2) the output you get is either (a) +1 times R8, (b) -1 times R8 or (c) zero. The output stays the same until the next time you change R8, when it changes immediately. So, if you get anything at all when you fiddle with R8 then you get a waveform whose shape matches exactly the values you sent to R8. In case (3) the output will be either... _... _... ._ | ._ ._ | .. __ __ __ ..| | | _... | (a) ....|..|__|..|__|.... times R8 = ...| |__| |__| |__... (an amplitude modulated half-wave), or... _... _... ._ | ._ ._ | .. __ __ __ ..| | | _...| | (b) ....|..|..|..|..|.... times R8 = | | | | | | | |__| |__| .. | | .|__| | .. | .. .. | .. (an amplitude modulated fullwave). .|__ .|__ (don't you just love ASCII graphics!) It depends whether the tone generator oscillates between 0 and 1 (as in (a)) or between -1 and 1 (as in (b)). Now since the carrier frequency is going to be 50 or 100 KHz, it is inaudible and what we hear is its average. In case (a) we hear the sample being played, while in case (b) we do not. So it had better not be case (b)! Possible solutions are 2(a), 2(b) and 3(a). It should be possible to distinguish between (2) and (3) but not between 2(a) and 2(b). OK? :-) Ian Collier - imc@comlab.ox.ac.uk - WWW Home Page (including Spectrum section): http://www.comlab.ox.ac.uk/oucl/users/ian.collier/index.html ---- Xref: vanilla comp.sys.sinclair:4110 Path: vanilla!asbach!noris.net!blackbush.xlink.net!tank.news.pipex.net!pipex!dispatch.news.demon.net!demon!xara.net!agate.xara.net!SoNet!rmplc!yama.mcc.ac.uk!daresbury!lyra.csx.cam.ac.uk!news.ox.ac.uk!news From: imc@ecs.ox.ac.uk (Ian Collier) Newsgroups: comp.sys.amstrad.8bit,comp.sys.sinclair Subject: Re: AY-3-819x PSG sound generation Date: 14 Jun 1996 13:36:49 GMT Organization: Oxford University Computing Laboratory Lines: 55 Message-ID: <8541.imc@comlab.ox.ac.uk> References: <4p12ck$hqo@lyra.csx.cam.ac.uk> <8526.imc@comlab.ox.ac.uk> <4pmkbk$ktb@lyra.csx.cam.ac.uk> <8530.imc@comlab.ox.ac.uk> NNTP-Posting-Host: boothp2.ecs.ox.ac.uk X-Local-Date: Friday, 14th June 1996 at 2:36pm BST In article <8530.imc@comlab.ox.ac.uk>, imc@ecs.ox.ac.uk (that's me) wrote: > +-----------+ T +-------+ +------------+ > | Tone |-->--| mixer |-->--| volume |-->--output > | generator | +->-| | +->-| controller | > +-----------+ | N +-------+ | E +------------+ > | | > +-----+-----+ +----+------+ > | noise | | envelope | > | generator | | generator | > +-----------+ +-----------+ I have done some further experiments. Did you know that not all of the registers are 8 bits? For example, since only the lower 4 bits of register 1 have any effect on the tone, the upper 4 bits are not even stored. If you set it to 23 and read it back you get 7. Also, if you try to read register 15 you just get 255. The output of the mixer I have discovered to be: (T OR R7_0) AND (N OR R7_3) where T and N are each either 0 or 1. So if you set the tone generator to 27Hz and set the mixer to output both tone and noise, what you get is 27 bursts of noise per second. Now the interesting part. You will notice that if the tone and noise are both turned off the formula outputs 1. This 1 is then multiplied by the current volume and output. Result: you can play samples even with the sound turned off! If you doubt this try setting R8 to 16 so that channel 1 uses the envelope generator, select a repeating waveform at some speed around 16 and turn the sound off. You hear a tone which is the result of the volume being put up and down rapidly. Doing the above experiment and varying the value of R12R11 reveals that changing R12R11 affects the waveform immediately, rather than when the current counter reaches zero. It also reveals that setting it to zero has exactly the same effect as setting it to 1 - that is, the envelope generator makes 110840 changes per second and so emits a tone of frequency 6930Hz (if the shape is /|/| or |\|\) or 3460Hz (if the shape is \/\/\ or /\/\/). Listening to the white noise produced when R6 is zero reveals that it sounds identical to when R6 is 1, so going from the above we may conclude that setting it to zero is the same as setting it to 1. Incidentally, R6 has five significant bits. You can play samples with the sound turned on when R0 is as high as 4 without it affecting the sound in any way. It is difficult to tell the difference between different small values of R0 and also between having R7=62 and R7=63. We may conclude from the above that setting the tone registers to zero is the same as setting them to 1; also that my proposition above that T is either 0 or 1 is valid. >Ian Collier - imc@comlab.ox.ac.uk - WWW Home Page (including Spectrum section): >http://www.comlab.ox.ac.uk/oucl/users/ian.collier/index.html ---- Xref: vanilla comp.sys.sinclair:4090 Path: vanilla!asbach!noris.net!blackbush.xlink.net!tank.news.pipex.net!pipex!usenet.eel.ufl.edu!warwick!lyra.csx.cam.ac.uk!mgr11 From: mgr11@cus.cam.ac.uk (M.G. Rison) Newsgroups: comp.sys.amstrad.8bit,comp.sys.sinclair Subject: Re: AY-3-819x PSG sound generation Date: 14 Jun 1996 15:27:23 GMT Organization: University of Cambridge, England Lines: 92 Sender: rison@hep.phy.cam.ac.uk Message-ID: <4ps0cr$qod@lyra.csx.cam.ac.uk> References: <4p12ck$hqo@lyra.csx.cam.ac.uk> <4pmkbk$ktb@lyra.csx.cam.ac.uk> <8530.imc@comlab.ox.ac.uk> <8541.imc@comlab.ox.ac.uk> Reply-To: rison@hep.phy.cam.ac.uk NNTP-Posting-Host: taurus.cus.cam.ac.uk En la artikolo <8541.imc@comlab.ox.ac.uk>, Ian Collier skribis: > In article <8530.imc@comlab.ox.ac.uk>, imc@ecs.ox.ac.uk (that's me) wrote: > > +-----------+ T +-------+ +------------+ > > | Tone |-->--| mixer |-->--| volume |-->--output > > | generator | +->-| | +->-| controller | > > +-----------+ | N +-------+ | E +------------+ > > | | > > +-----+-----+ +----+------+ > > | noise | | envelope | > > | generator | | generator | > > +-----------+ +-----------+ > I have done some further experiments. > Did you know that not all of the registers are 8 bits? For example, > since only the lower 4 bits of register 1 have any effect on the tone, > the upper 4 bits are not even stored. If you set it to 23 and read it > back you get 7. Is this true of all registers where some bits are not significant (1,3,5,6,7?,8,9,10,13)? Maybe this explains why Barbarian won't come out of demo mode under !CPC... > Also, if you try to read register 15 you just get 255. Is that so even if you've previously written something else to it, and irrespective of the direction bit in R7? > The output of the mixer I have discovered to be: > (T OR R7_0) AND (N OR R7_3) It took me a while to understand why this works! I must be getting precocious Alzheimer's... > where T and N are each either 0 or 1. So if you set the tone generator to > 27Hz and set the mixer to output both tone and noise, what you get is 27 > bursts of noise per second. Ah, that's the weird modulation of the noise by the tone which I'd mumbled about earlier. > Now the interesting part. You will notice that if the tone and noise > are both turned off the formula outputs 1. This 1 is then multiplied by > the current volume and output. Result: you can play samples even with > the sound turned off! If you doubt this try setting R8 to 16 so that > channel 1 uses the envelope generator, select a repeating waveform at > some speed around 16 and turn the sound off. You hear a tone which is > the result of the volume being put up and down rapidly. Funky! This also explains why some technical manual I've got says that to stop sound on a channel requires not only the enables to be set to off, but the volume to be set to zero. > Doing the above experiment and varying the value of R12R11 reveals that > changing R12R11 affects the waveform immediately, rather than when the > current counter reaches zero. Ahaa! This disagrees with the thinking to date. Can you tell whether the phase is reset, or whether the steps in the ramp just change in duration (the latter would make more sense if we're still thinking changes to R0-R6 only take effect at the end of the current cycle)? [This may be vhard to determine without a scope.] > It also reveals that setting it to zero has > exactly the same effect as setting it to 1 - that is, the envelope generator > makes 110840 changes per second and so emits a tone of frequency 6930Hz (if > the shape is /|/| or |\|\) or 3460Hz (if the shape is \/\/\ or /\/\/). > Listening to the white noise produced when R6 is zero reveals that it sounds > identical to when R6 is 1, so going from the above we may conclude that > setting it to zero is the same as setting it to 1. Incidentally, R6 has > five significant bits. Hm, so 0 behaves as 1 for all the counters. The interesting question is whether the traditional formula f=1/p is wrong and should be f=1/(p+1) or whether 0=1 is just an implementation accident. > You can play samples with the sound turned on when R0 is as high as 4 > without it affecting the sound in any way. It is difficult to tell the > difference between different small values of R0 and also between having > R7=62 and R7=63. We may conclude from the above that setting the tone > registers to zero is the same as setting them to 1; also that my proposition > above that T is either 0 or 1 is valid. I'm not quite sure I get your point here, but since I don't propose to emulate sample playing... Mark, who's going to have to settle for an approximate emulation ====================================================================== | rison@hep.phy.cam.ac.uk | Esperanto - lingvo inter-nacia | | rison@vxcern.cern.ch | * Mi estas riisto * | ======================================================================